How to replace deprecated JSHint parameters with AOS rules?
the JSHint option reference lists some options as deprecated with the following notice.
Warning This parameter is deprecated and will be removed in the next major release of JSHint. JSHint limits its capabilities to issues of code correctness. If you want to enforce code style rules, check out the AOC draft .
In particular, the deprecated parameters:
- CamelCase
- IMMED
- Indent
- MaxLen
- newcap
- noempty
- quotmark
- laxbreak
- laxcomma
- multistr
- sub
Unfortunately, the link does not indicate how to replace these deprecated parameters, and simply points to the AOC GitHub repository.
What AOC Rules match the legacy JSHint options? Are there any configuration differences when switching to AOC?
source to share
One way to determine this is to search the AOC Github Repo for "JSHint" or a specific rule ( search example ), as the corresponding rules in the AOC docs have links to their JSHint equivalents.
These are the equivalents for your shortlist at the time of writing:
- camelcase =
requireCamelCaseOrUpperCaseIdentifiers
- instant =
requireParenthesesAroundIIFE
- indent =
validateIndentation
- maxlen =
maximumLineLength
- newcap =
requireCapitalizedConstructors
- noempty =
disallowEmptyBlocks
- quotmark =
validateQuoteMarks
- laxbreak =
requireOperatorBeforeLineBreak
- laxcomma =
requireCommaBeforeLineBreak
ordisallowCommaBeforeLineBreak
(requires customization based on your preference). - multistr =
disallowMultipleLineStrings
- sub =
requireDotNotation
While many of these rules are very similar and require little work to switch, some have slightly different options, requirements or values ββand therefore require some configuration differences and in some cases you may need to choose between two rules ( require
against disallow
).
source to share