eslint-plugin-package-json
eslint-plugin-package-json copied to clipboard
Rule request: kebab-case scripts
It is conventional for scripts in the "package.json" file to be in kebab-case, as evidenced here:
- https://github.com/angular/angular/blob/main/package.json
- https://github.com/facebook/react/blob/main/package.json
- https://github.com/microsoft/TypeScript/blob/main/package.json
Thus, this plugin should warn when incorrectly named scripts exist such as "fooBar" (i.e. camelCase) or "FooBar" (i.e. PascalCase) or "foo_bar" (i.e. snake_case) or "FOO_BAR" (i.e. SCREAMING_SNAKE_CASE).
Makes sense! I can see value in having a naming conventions rule that enforces kebab-case. Other efforts have popped up to standardize them too:
- https://github.com/github/scripts-to-rule-them-all
- https://conventionalscripts.org (cc @bennycode)
I think for the first few iterations of this rule we probably wouldn't want it to be enabled by default - as it's rather pedantic and doesn't directly catch runtime issues (only indirectly). But strong +1 to it existing.
Questions that I think would need to be resolved:
- What other conventions exist?
- What "preset" conventions should it allow?
- How should it be configured, in general?