Officially deprecate shorthand options #8112
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
documentation
Relates to ESLint's documentation
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
According to the discussion on #8092, shorthands like
max-depth: ["error", 4]
formax-depth: ["error", { max: 4}]
are intentionally not added for newer rules, likemax-statements-per-line
in that case. The rationale is that there should not be multiple ways to do the same thing, and that such shorthands are basically magic numbers.Personally, I can get behind that from a consistency stand-point. In the interest of consistency, I think all shorthands should be deprecated, just like the
maximum
option has been deprecated in favor of a standardmax
option.This may be tied to #7443, but I think the shorthands should at least be discouraged in the docs. As it stands, the docs are actually kind of propagating the shorthands. From my personal case: for convenience, I used the snippets from the rules examples, so from the
max-depth
rule page I tookmax-depth: ["error", 4]
. I guess, this applies to others as well. Also, thecomplexity
rule page lists the shorthand as the default way, and the explicit way as the optional alternative.The text was updated successfully, but these errors were encountered: