What naming convention do I use for scripts in package.json?

Viewed 11667

In package.json I have this script name with two words lint and fix. How should I make a right name?

There are options:

  1. lowerCamelCase - lintFix
  2. UpperCamelCase - LintFix
  3. snake_case - lint_fix
  4. kebab-case - lint-fix
  5. gulp-style with a colon delimiter - lint:fix
  6. Any another delimiter.

What option is right? And why?

4 Answers

Please always use kebab case. The colon is a throwback to gulp, and it looks terrible. I hate it.

Disclaimer: My opinions are often wrong.

You can use a mix of both dash and colon. Dash for chaining words, colon for grouping similar scripts. Example:

  • lint:check
  • lint:fix:all
  • lint:fix:staged-only
Related