Search code examples
javascriptjshintdeprecation-warningjscs

How to replace deprecated JSHint options with JSCS rules?


The JSHint option reference lists some options as deprecated with the following notice.

Warning This option has been deprecated and will be removed in the next major release of JSHint. JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check out the JSCS project.

Specifically, the deprecated options are:

  • camelcase
  • immed
  • indent
  • maxlen
  • newcap
  • noempty
  • quotmark
  • laxbreak
  • laxcomma
  • multistr
  • sub

Unfortunately, the reference does not indicate how to replace these deprecated options, and merely points to the JSCS GitHub repo.

What JSCS rules correspond to the deprecated JSHint options? Are there any configuration differences to be considered when switching to JSCS?


Solution

  • One way to determine this is to search the JSCS Github Repo for "JSHint" or the specific rule (example search), as the relevant rules in the JSCS docs all have links to their JSHint equivalents.

    These are the equivalents for your short list at time of writing:

    Though many of these rules are very similar and require little work to switch, some have slightly different options, requirements, or meaning and thus require some configuration differences, and in some cases you may need to choose between two rules (require vs. disallow).