eslint-plugin-package-json icon indicating copy to clipboard operation
eslint-plugin-package-json copied to clipboard

Rule request: kebab-case scripts

Open Zamiell opened this issue 1 year ago • 1 comments

It is conventional for scripts in the "package.json" file to be in kebab-case, as evidenced here:

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).

Zamiell avatar Oct 30 '23 23:10 Zamiell

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?

JoshuaKGoldberg avatar Nov 06 '23 01:11 JoshuaKGoldberg