🚨 Make the case correct, PLEASE!

Overview

🚨 CasePolice

NPM version

  • GitHub, not Github
  • TypeScript, not Typescript
  • macOS, not MacOS
  • VS Code, not Vscode
  • ...

Make the case correct, PLEASE!

Usage

Make sure you have committed all unsaved works, and then

npx case-police --fix

It will scan all your source files and fix the cases of known names.

Only the word including both uppercase and lowercase will be fixed. (e.g. Github -> GitHub; github and GITHUB will be left untouched).

Use in CI

Simply add case-police (without --fix) to your workflow and it will exit with a non-zero code for your CI to catch it.

Specific files

By default it will scan all the text files under the current directory (respects .gitignore), if you want it to check only specific files, you can pass the file paths of glob patterns to it.

npx case-police "**/*.md" path/to/file.html

CLI Options

Options Description
[...globs] Files or glob to be checked, if not provided, all the text files will be check
--fix Rewrite changes to file
-d, --dict <path> Custom dictionary JSON, will be merged with original dict
-p, --presets <presets> Filter the default presets, comma separated
--no-default Disable the default dictionary
--disable <rules> Disable rules, comma separated
--ignore <globs> Files or globs to be ignore, comma separated

Sponsors

License

MIT License © 2021 Anthony Fu

Comments
  • fix: correct case for Next.js

    fix: correct case for Next.js

    This was added in #82 but it didn't account for the "NextJS" typo which is quite common

    (should be "Next.js" as seen on https://nextjs.org)

    opened by styfle 2
  • feat: --append custom dictionary

    feat: --append custom dictionary

    Closes #27

    Allows a user to provide their own .json file to be appended onto the default dictionary via the --append option e.g. npx case-police --append my-dictionary.json --fix

    opened by iGalaxyYT 2
  • feat: add npm

    feat: add npm

    npm should always be lowercase, no matter where. See npm docs (emphasis mine):

    npm is the world's largest software registry. Open source developers from every continent use npm to share and borrow packages, and many organizations use npm to manage private development as well.

    opened by Josh-Cena 2
  • `NATs` -> `NATS`

    `NATs` -> `NATS`

    Describe the bug

    case-police flags NATs as incorrect, I'm trying to describe the plural of a Network Address Translator

    Reproduction

    Lint a file with NATs in it

    System Info

    System:
        OS: macOS 12.5
        CPU: (10) arm64 Apple M1 Max
        Memory: 14.20 GB / 64.00 GB
        Shell: 5.8.1 - /bin/zsh
      Binaries:
        Node: 18.7.0 - ~/.volta/tools/image/node/18.7.0/bin/node
        Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
        npm: 8.17.0 - ~/.volta/tools/image/npm/8.17.0/bin/npm
      Browsers:
        Firefox: 103.0.2
        Safari: 15.6
    

    Used Package Manager

    npm

    Validations

    • [X] Follow our Code of Conduct
    • [X] Read the Contributing Guide.
    • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
    • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
    • [X] The provided reproduction is a minimal reproducible of the bug.
    opened by jasikpark 1
  • False positive for curl command in sh file

    False positive for curl command in sh file

    Describe the bug

    RESPONSE=$(curl -sSL -H "${AUTH_HEADER}" -H "${HEADER}" --user "${GITHUB_ACTOR}" -X GET --data "${DATA}" ${PULLS_URL}) case-police tells me that sSL should be SSL though this is a curl shorthand rather than a word

    Reproduction

    https://stackblitz.com/edit/vitejs-vite-5bjczq?file=run.sh

    System Info

    System:
        OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
        CPU: (16) x64 AMD EPYC 7B13
        Memory: 19.95 GB / 62.81 GB
        Container: Yes
        Shell: 5.0.17 - /bin/bash
      Binaries:
        Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
        Yarn: 1.22.17 - ~/.nvm/versions/node/v16.16.0/bin/yarn
        npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    

    Used Package Manager

    yarn

    Validations

    • [X] Follow our Code of Conduct
    • [X] Read the Contributing Guide.
    • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
    • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
    • [X] The provided reproduction is a minimal reproducible of the bug.
    opened by jasikpark 1
  • Add webpack

    Add webpack

    Please read the Contributions Guide before making Pull Requests.

    Hi @antfu ! 👋 Thanks for this project, really cool!

    Quick PR to add webpack, since I see this commonly cased as Webpack.

    opened by karlhorky 1
  • Confusing about contributing guidelines

    Confusing about contributing guidelines

    Thinking about this rule:

    • Since case-police will only fix words that have both lowercase and uppercase letters, it WON'T convert java to Java. If correct form is a single capitalized word, there is no need to add it to the dictionary.

    , is that means if I have a entry:

    {
      // ...
      "eslint": "ESLint"
      // ...
    }
    

    , case-police will not change eslint to ESLint?

    But eslint have already in dict.json, is this guidelines express with confusing?

    opened by onsummer 1
  • revert: UTF-8 support breaks some languages, revert PR #120

    revert: UTF-8 support breaks some languages, revert PR #120

    Please read the Contributions Guide before making Pull Requests.

    PR #120 breaks some languages such as Japanese and Chinese. For example: GithubのVScode Github的VScode Github:

    containsUTF8 will return true because it takes Githubの, のVScode,Github的 ,的VScode and Github: as a whole respectively, so the Github and VScode won't be corrected. UTF-8 support should be implemented in another way.

    opened by ryougifujino 0
  • NebulaGraph added

    NebulaGraph added

    Previously we call it Nebula Graph, until this week, it’s rebranded as NebulaGraph, yes, we could ~~finally be a thing in case police then~~!

    Update: it turned out that the case-police supported space separated phrase before.

    opened by wey-gu 0
  • Files with UTF8 characters cause false positives

    Files with UTF8 characters cause false positives

    For example, the following file:

    Romania (România)
    

    Cause this output:

     Case  Police  v0.3.0
    
    1475 files found for checking
    
    Rom → ROM         ./file
    
    help wanted pr welcome 
    opened by skyrpex 1
Releases(v0.5.10)
Owner
Anthony Fu
A ship in harbor is safe, but that is not what ships are built for.
Anthony Fu
Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

khimaros 40 Dec 23, 2022
It shows an effective way to correct bus arrival information using data analytics based on Amazon Serverless such as Kiness Data Stream, Kinesis Data Firehose, S3, and Lambda.

Amazon Serverless를 이용한 실시간 버스 정보 수집 및 저장 본 github repository는 버스 정보를 주기적으로 수집하여 분석할 수 있도록, Amazon Serverless인 Amazon Kinesis Data Stream, Kinesis Data

John Park 4 Nov 13, 2022
Click in your components and open VSCode in the correct file and line number.

Inspect in VSCode This is a simple extension for deno/fresh projects that allows you to inspect your components' source code in VSCode. This repositor

deco 23 Nov 30, 2022
Library to download binary files from GitHub releases detecting the correct platform.

Dbin TypeScript library to download binary files from GitHub releases detecting the correct platform. Example: import dbin from "https://deno.land/x/d

Óscar Otero 7 Oct 4, 2022
In this project, I built a to-do list app, which is inspired by the minimalist website. Build withHTML/CSS & JavaScript best practices: Correct use of tags, elements, properties and syntax.

Webpack Exercise In this project, I built a to-do list app, which is inspired by the minimalist website. Built With HTML/CSS & JavaScript best practic

Vanessa Oliveros 3 Oct 11, 2022
Please do not use this tracker to scam anyone! This is free and will be forever free. This tracking will never ask for seed phrases nor private keys. Keep safe!

CryptoBlades Tracker Related modules express - web application framework for node pug - template engine stylus - pre-processor CSS mongoose - nodejs o

null 355 Oct 13, 2022
🌱 Ethereum provider solution for Dapp&Wallets, 🏷 If you have good suggestions, please submit issues

English | 简体中文 | 日本 ETH Wallet Modal An Ethereum Provider Solution for Integrated Wallets and Dapps ⚠️ Notice If you need to reduce unnecessary import

Dan Xu 35 Dec 19, 2022
Aron 8 Dec 17, 2022
Get discord application's assets in case you don't have them on your PC

get-discord-app-assets Get discord application's assets in case you don't have them on your PC (this is also the reason why I made this script) I came

Narcis B. 7 Dec 25, 2022
A TypeScript namespace declaration for KeyboardEvent.key strings, just in case your code is allergic to enums.

ts-key-namespace A TypeScript namespace declaration for KeyboardEvent.key strings, just in case you prefer namespaces to enums. Largely based on ts-ke

Daniel Soohan Park 3 Apr 5, 2022
This project demonstrates single transaction and batch transaction use case

Batch Transaction Fullstack ( Localhost:8545 ) This project demonstrates single transaction and batch transaction use case. It comes with a transactio

Lemonde Shazai  39 Dec 27, 2022
A webpack plugin to enforce case-sensitive paths when resolving module

@umijs/case-sensitive-paths-webpack-plugin A webpack plugin to enforce case-sensitive paths when resolving module, similar to the well-known case-sens

UmiJS 13 Jul 25, 2022
Switch case syntax for Svelte ✨

Svelte switch case Switch case syntax for your Svelte components. Demo · StackBlitz · NPM Package ⚡ Getting started Step 1: Add the preprocessor to yo

Lucas Portet 91 Dec 30, 2022
a simple wrapper nestjs dynamic module on top of surrealdb.js driver, with a consumer app to show case library in action, nothing fancy

README README Project Components Dynamic Module Consumer App Install SurrealDb Starts SurrealDb Init surrealDb Database Run App from Source Code Launc

Mário Monteiro 0 Oct 3, 2022
🌸 It's a frontend case for CicekSepeti

Ciceksepeti Frontend Case When we change the category all filters are reset byself. You can make empty search for listing all items again. Getting Sta

Altay Simsek 4 Sep 13, 2022
A leetcode workspace template with test case runner for JavaScript/TypeScript programmers.

leetcode-typescript-workspace English | 简体中文 A vscode workspace template with test case runner script for JavaScript/TypeScript programmers using exte

null 10 Dec 13, 2022
API for the Baby Food Introduction Application. Keep your baby's food introductions in check with this application and backtrack in case of allergies!

Baby food introduction API This API is part of the Baby Food Introduction application, which aims to help technological parents keep track of the food

David Alecrim 6 Nov 25, 2022
A library for boolean aliases to help you make your code more confusing and make your coworkers hate you.

yup-nope A library for boolean aliases to help you make your code more confusing and make your coworkers hate you. Installation Using npm: npm install

Bence A. Tóth 4 Dec 10, 2022