From 6e16025e8fbffa0e1d0c977cb4b6eae30a502d9b Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Wed, 18 May 2022 04:25:41 +0200 Subject: [PATCH] docs: update 'Related Rules' and 'Further Reading' in remaining rules (#15884) * chore: update 'Related Rules' and 'Further Reading' in remaining rules * remove extra backticks * remove broken links * update http -> https where possible * restore dead links as webarchive links * restore eslintVersion.js --- Makefile.js | 2 +- docs/src/rules/accessor-pairs.md | 18 ++++------- docs/src/rules/array-bracket-newline.md | 6 ++-- docs/src/rules/array-bracket-spacing.md | 10 +++--- docs/src/rules/array-element-newline.md | 20 ++++++------ docs/src/rules/arrow-parens.md | 7 ++-- docs/src/rules/block-spacing.md | 8 ++--- docs/src/rules/brace-style.md | 14 +++----- docs/src/rules/callback-return.md | 14 +++----- docs/src/rules/class-methods-use-this.md | 8 ++--- docs/src/rules/comma-spacing.md | 28 +++++++--------- docs/src/rules/comma-style.md | 15 +++------ docs/src/rules/complexity.md | 32 ++++++++----------- docs/src/rules/computed-property-spacing.md | 10 +++--- docs/src/rules/default-case-last.md | 12 +++---- docs/src/rules/default-case.md | 6 ++-- docs/src/rules/dot-location.md | 8 ++--- docs/src/rules/func-call-spacing.md | 6 ++-- docs/src/rules/func-names.md | 8 ++--- docs/src/rules/func-style.md | 6 ++-- .../rules/function-call-argument-newline.md | 12 +++---- docs/src/rules/generator-star-spacing.md | 6 ++-- docs/src/rules/generator-star.md | 6 ++-- docs/src/rules/getter-return.md | 8 ++--- docs/src/rules/grouped-accessor-pairs.md | 20 +++++------- docs/src/rules/guard-for-in.md | 14 +++----- docs/src/rules/handle-callback-err.md | 8 ++--- docs/src/rules/id-length.md | 12 +++---- docs/src/rules/implicit-arrow-linebreak.md | 6 ++-- docs/src/rules/jsx-quotes.md | 6 ++-- docs/src/rules/lines-around-comment.md | 8 ++--- docs/src/rules/lines-around-directive.md | 8 ++--- docs/src/rules/lines-between-class-members.md | 8 ++--- docs/src/rules/max-depth.md | 18 +++++------ docs/src/rules/max-len.md | 14 ++++---- docs/src/rules/max-lines-per-function.md | 18 +++++------ docs/src/rules/max-lines.md | 22 ++++++------- docs/src/rules/max-nested-callbacks.md | 28 +++++++--------- docs/src/rules/max-params.md | 18 +++++------ docs/src/rules/max-statements-per-line.md | 18 +++++------ docs/src/rules/max-statements.md | 18 +++++------ docs/src/rules/multiline-ternary.md | 6 ++-- docs/src/rules/newline-before-return.md | 6 ++-- docs/src/rules/no-alert.md | 8 ++--- docs/src/rules/no-array-constructor.md | 8 ++--- docs/src/rules/no-arrow-condition.md | 10 +++--- docs/src/rules/no-buffer-constructor.md | 10 +++--- docs/src/rules/no-case-declarations.md | 6 ++-- docs/src/rules/no-cond-assign.md | 6 ++-- docs/src/rules/no-confusing-arrow.md | 8 ++--- docs/src/rules/no-console.md | 8 ++--- .../rules/no-constant-binary-expression.md | 6 ++-- docs/src/rules/no-constant-condition.md | 6 ++-- docs/src/rules/no-control-regex.md | 8 ++--- docs/src/rules/no-debugger.md | 14 +++----- docs/src/rules/no-div-regex.md | 8 ++--- docs/src/rules/no-dupe-else-if.md | 8 ++--- docs/src/rules/no-empty-function.md | 6 ++-- docs/src/rules/no-empty-label.md | 10 +++--- docs/src/rules/no-empty.md | 6 ++-- docs/src/rules/no-eval.md | 14 +++----- docs/src/rules/no-ex-assign.md | 6 ++-- docs/src/rules/no-extend-native.md | 6 ++-- docs/src/rules/no-extra-bind.md | 8 ++--- docs/src/rules/no-extra-label.md | 10 +++--- docs/src/rules/no-extra-parens.md | 16 ++++------ docs/src/rules/no-extra-semi.md | 8 ++--- docs/src/rules/no-extra-strict.md | 6 ++-- docs/src/rules/no-fallthrough.md | 6 ++-- docs/src/rules/no-global-assign.md | 10 +++--- docs/src/rules/no-implicit-globals.md | 18 ++++------- docs/src/rules/no-implied-eval.md | 6 ++-- docs/src/rules/no-invalid-regexp.md | 6 ++-- docs/src/rules/no-irregular-whitespace.md | 8 ++--- docs/src/rules/no-iterator.md | 10 +++--- docs/src/rules/no-label-var.md | 10 +++--- docs/src/rules/no-labels.md | 10 +++--- docs/src/rules/no-mixed-operators.md | 6 ++-- docs/src/rules/no-mixed-spaces-and-tabs.md | 6 ++-- docs/src/rules/no-multi-assign.md | 6 ++-- docs/src/rules/no-multi-spaces.md | 18 +++++------ docs/src/rules/no-native-reassign.md | 10 +++--- docs/src/rules/no-nested-ternary.md | 8 ++--- docs/src/rules/no-new-object.md | 8 ++--- docs/src/rules/no-new-symbol.md | 6 ++-- docs/src/rules/no-new-wrappers.md | 14 +++----- docs/src/rules/no-nonoctal-decimal-escape.md | 12 +++---- docs/src/rules/no-obj-calls.md | 6 ++-- docs/src/rules/no-param-reassign.md | 6 ++-- docs/src/rules/no-process-env.md | 8 ++--- docs/src/rules/no-promise-executor-return.md | 12 +++---- docs/src/rules/no-proto.md | 6 ++-- docs/src/rules/no-redeclare.md | 6 ++-- docs/src/rules/no-regex-spaces.md | 8 ++--- docs/src/rules/no-reserved-keys.md | 6 ++-- docs/src/rules/no-restricted-globals.md | 8 ++--- docs/src/rules/no-restricted-properties.md | 8 ++--- docs/src/rules/no-restricted-syntax.md | 12 +++---- docs/src/rules/no-return-await.md | 9 ++---- docs/src/rules/no-script-url.md | 6 ++-- docs/src/rules/no-setter-return.md | 12 +++---- docs/src/rules/no-shadow-restricted-names.md | 14 +++----- docs/src/rules/no-shadow.md | 12 +++---- docs/src/rules/no-space-before-semi.md | 8 ++--- docs/src/rules/no-sparse-arrays.md | 6 ++-- docs/src/rules/no-undef-init.md | 8 ++--- docs/src/rules/no-undef.md | 8 ++--- docs/src/rules/no-undefined.md | 22 ++++++------- docs/src/rules/no-unexpected-multiline.md | 10 +++--- docs/src/rules/no-unneeded-ternary.md | 8 ++--- docs/src/rules/no-unreachable-loop.md | 12 +++---- docs/src/rules/no-unused-labels.md | 10 +++--- docs/src/rules/no-useless-backreference.md | 16 ++++------ docs/src/rules/no-useless-call.md | 6 ++-- docs/src/rules/no-useless-rename.md | 6 ++-- docs/src/rules/no-void.md | 16 ++++------ docs/src/rules/no-with.md | 6 ++-- .../rules/nonblock-statement-body-position.md | 6 ++-- docs/src/rules/object-curly-newline.md | 12 +++---- docs/src/rules/object-curly-spacing.md | 12 +++---- docs/src/rules/object-property-newline.md | 12 +++---- docs/src/rules/object-shorthand.md | 12 +++---- .../src/rules/one-var-declaration-per-line.md | 6 ++-- docs/src/rules/operator-linebreak.md | 6 ++-- docs/src/rules/padded-blocks.md | 8 ++--- docs/src/rules/prefer-arrow-callback.md | 6 ++-- docs/src/rules/prefer-const.md | 8 ++--- docs/src/rules/prefer-destructuring.md | 10 ++---- .../rules/prefer-exponentiation-operator.md | 8 ++--- docs/src/rules/prefer-named-capture-group.md | 6 ++-- docs/src/rules/prefer-object-has-own.md | 6 ++-- .../src/rules/prefer-promise-reject-errors.md | 12 +++---- docs/src/rules/prefer-reflect.md | 10 +++--- docs/src/rules/prefer-regex-literals.md | 8 ++--- docs/src/rules/prefer-rest-params.md | 6 ++-- docs/src/rules/prefer-spread.md | 6 ++-- docs/src/rules/prefer-template.md | 8 ++--- docs/src/rules/quote-props.md | 8 ++--- docs/src/rules/radix.md | 6 ++-- docs/src/rules/require-await.md | 6 ++-- docs/src/rules/require-jsdoc.md | 6 ++-- docs/src/rules/require-yield.md | 6 ++-- docs/src/rules/rest-spread-spacing.md | 6 ++-- docs/src/rules/semi-spacing.md | 14 ++++---- docs/src/rules/semi-style.md | 10 +++--- docs/src/rules/semi.md | 18 ++++------- docs/src/rules/sort-imports.md | 8 ++--- docs/src/rules/sort-keys.md | 8 ++--- docs/src/rules/sort-vars.md | 8 ++--- docs/src/rules/space-before-blocks.md | 14 ++++---- docs/src/rules/space-before-function-paren.md | 8 ++--- .../space-before-function-parentheses.md | 8 ++--- docs/src/rules/space-before-keywords.md | 14 ++++---- docs/src/rules/space-in-brackets.md | 12 +++---- docs/src/rules/space-in-parens.md | 10 +++--- docs/src/rules/spaced-comment.md | 6 ++-- docs/src/rules/spaced-line-comment.md | 6 ++-- docs/src/rules/symbol-description.md | 6 ++-- docs/src/rules/template-tag-spacing.md | 10 ++---- docs/src/rules/valid-jsdoc.md | 12 +++---- docs/src/rules/valid-typeof.md | 6 ++-- docs/src/rules/vars-on-top.md | 12 +++---- docs/src/rules/yield-star-spacing.md | 6 ++-- docs/src/rules/yoda.md | 8 ++--- 164 files changed, 607 insertions(+), 998 deletions(-) diff --git a/Makefile.js b/Makefile.js index 49d3093c1f0..de786148c65 100644 --- a/Makefile.js +++ b/Makefile.js @@ -775,7 +775,7 @@ target.checkRuleFiles = function() { const docText = cat(docFilename); const docMarkdown = marked.lexer(docText, { gfm: true, silent: false }); const ruleCode = cat(filename); - const knownHeaders = ["Rule Details", "Options", "Environments", "Examples", "Known Limitations", "When Not To Use It", "Related Rules", "Compatibility", "Further Reading"]; + const knownHeaders = ["Rule Details", "Options", "Environments", "Examples", "Known Limitations", "When Not To Use It", "Compatibility"]; /** * Check if basename is present in rule-types.json file. diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index b5d5ece3d13..06bc33fe649 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -3,6 +3,13 @@ title: accessor-pairs layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/accessor-pairs.md rule_type: suggestion +related_rules: +- no-dupe-keys +- no-dupe-class-members +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects --- Enforces getter/setter pairs in objects and classes. @@ -287,14 +294,3 @@ See [no-dupe-class-members](no-dupe-class-members) if you also want to disallow ## When Not To Use It You can turn this rule off if you are not concerned with the simultaneous presence of setters and getters on objects. - -## Related Rules - -* [no-dupe-keys](no-dupe-keys) -* [no-dupe-class-members](no-dupe-class-members) - -## Further Reading - -* [Object Setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) -* [Object Getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) -* [Working with Objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects) diff --git a/docs/src/rules/array-bracket-newline.md b/docs/src/rules/array-bracket-newline.md index 54be1569819..a363f02e425 100644 --- a/docs/src/rules/array-bracket-newline.md +++ b/docs/src/rules/array-bracket-newline.md @@ -3,6 +3,8 @@ title: array-bracket-newline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/array-bracket-newline.md rule_type: layout +related_rules: +- array-bracket-spacing --- @@ -280,10 +282,6 @@ var e = [ If you don't want to enforce line breaks after opening and before closing array brackets, don't enable this rule. -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) - ## Compatibility * **JSCS:** [validateNewlineAfterArrayElements](https://jscs-dev.github.io/rule/validateNewlineAfterArrayElements) diff --git a/docs/src/rules/array-bracket-spacing.md b/docs/src/rules/array-bracket-spacing.md index 825557f070a..1caa2a6c107 100644 --- a/docs/src/rules/array-bracket-spacing.md +++ b/docs/src/rules/array-bracket-spacing.md @@ -3,6 +3,10 @@ title: array-bracket-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/array-bracket-spacing.md rule_type: layout +related_rules: +- space-in-parens +- object-curly-spacing +- computed-property-spacing --- @@ -224,9 +228,3 @@ var arr = [[ 1, 2 ], 2, [ 3, 4 ]]; ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing between array brackets. - -## Related Rules - -* [space-in-parens](space-in-parens) -* [object-curly-spacing](object-curly-spacing) -* [computed-property-spacing](computed-property-spacing) diff --git a/docs/src/rules/array-element-newline.md b/docs/src/rules/array-element-newline.md index 66db0024834..936f8fa9512 100644 --- a/docs/src/rules/array-element-newline.md +++ b/docs/src/rules/array-element-newline.md @@ -3,6 +3,15 @@ title: array-element-newline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/array-element-newline.md rule_type: layout +related_rules: +- array-bracket-spacing +- array-bracket-newline +- object-property-newline +- object-curly-spacing +- object-curly-newline +- max-statements-per-line +- block-spacing +- brace-style --- @@ -383,17 +392,6 @@ var [i = function foo() { If you don't want to enforce linebreaks between array elements, don't enable this rule. -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [array-bracket-newline](array-bracket-newline) -* [object-property-newline](object-property-newline) -* [object-curly-spacing](object-curly-spacing) -* [object-curly-newline](object-curly-newline) -* [max-statements-per-line](max-statements-per-line) -* [block-spacing](block-spacing) -* [brace-style](brace-style) - ## Compatibility * **JSCS:** [validateNewlineAfterArrayElements](https://jscs-dev.github.io/rule/validateNewlineAfterArrayElements) diff --git a/docs/src/rules/arrow-parens.md b/docs/src/rules/arrow-parens.md index 856bcb8f8ee..522034aacee 100644 --- a/docs/src/rules/arrow-parens.md +++ b/docs/src/rules/arrow-parens.md @@ -3,6 +3,8 @@ title: arrow-parens layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/arrow-parens.md rule_type: layout +further_reading: +- https://github.com/airbnb/javascript#arrows--one-arg-parens --- @@ -230,8 +232,3 @@ a((foo) => { if (true) {} }); ([a, b]) => a; ({a, b}) => a; ``` - -## Further Reading - -* The `"as-needed", { "requireForBlockBody": true }` rule is directly inspired by the Airbnb - [JS Style Guide](https://github.com/airbnb/javascript#arrows--one-arg-parens). diff --git a/docs/src/rules/block-spacing.md b/docs/src/rules/block-spacing.md index e07b7652dcb..76ca2e61273 100644 --- a/docs/src/rules/block-spacing.md +++ b/docs/src/rules/block-spacing.md @@ -3,6 +3,9 @@ title: block-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/block-spacing.md rule_type: layout +related_rules: +- space-before-blocks +- brace-style --- @@ -82,8 +85,3 @@ class C { ## When Not To Use It If you don't want to be notified about spacing style inside of blocks, you can safely disable this rule. - -## Related Rules - -* [space-before-blocks](space-before-blocks) -* [brace-style](brace-style) diff --git a/docs/src/rules/brace-style.md b/docs/src/rules/brace-style.md index 6b69184fd19..477d866d93d 100644 --- a/docs/src/rules/brace-style.md +++ b/docs/src/rules/brace-style.md @@ -3,6 +3,11 @@ title: brace-style layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/brace-style.md rule_type: layout +related_rules: +- block-spacing +- space-before-blocks +further_reading: +- https://en.wikipedia.org/wiki/Indent_style --- @@ -392,12 +397,3 @@ class D { static { foo(); } } ## When Not To Use It If you don't want to enforce a particular brace style, don't enable this rule. - -## Related Rules - -* [block-spacing](block-spacing) -* [space-before-blocks](space-before-blocks) - -## Further Reading - -* [Indent style](https://en.wikipedia.org/wiki/Indent_style) diff --git a/docs/src/rules/callback-return.md b/docs/src/rules/callback-return.md index 7acf5dc9c67..87a927ec98b 100644 --- a/docs/src/rules/callback-return.md +++ b/docs/src/rules/callback-return.md @@ -3,6 +3,11 @@ title: callback-return layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/callback-return.md rule_type: suggestion +related_rules: +- handle-callback-err +further_reading: +- https://github.com/maxogden/art-of-node#callbacks +- https://web.archive.org/web/20171224042620/https://docs.nodejitsu.com/articles/errors/what-are-the-error-conventions/ --- Enforces return after callback. @@ -171,12 +176,3 @@ function foo(err, callback) { There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings. - -## Related Rules - -* [handle-callback-err](handle-callback-err) - -## Further Reading - -* [The Art Of Node: Callbacks](https://github.com/maxogden/art-of-node#callbacks) -* [Nodejitsu: What are the error conventions?](https://docs.nodejitsu.com/articles/errors/what-are-the-error-conventions/) diff --git a/docs/src/rules/class-methods-use-this.md b/docs/src/rules/class-methods-use-this.md index 350e0f7c3d0..b02cf487ed2 100644 --- a/docs/src/rules/class-methods-use-this.md +++ b/docs/src/rules/class-methods-use-this.md @@ -3,6 +3,9 @@ title: class-methods-use-this layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/class-methods-use-this.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static --- Enforces that class methods utilize `this`. @@ -173,8 +176,3 @@ class A { foo = () => {} } ``` - -## Further Reading - -* [Classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) -* [Static Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static) diff --git a/docs/src/rules/comma-spacing.md b/docs/src/rules/comma-spacing.md index 2463c9bb9e8..55eb9ccdcde 100644 --- a/docs/src/rules/comma-spacing.md +++ b/docs/src/rules/comma-spacing.md @@ -3,6 +3,18 @@ title: comma-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/comma-spacing.md rule_type: layout +related_rules: +- array-bracket-spacing +- comma-style +- space-in-brackets +- space-in-parens +- space-infix-ops +- space-after-keywords +- space-unary-ops +- space-return-throw-case +further_reading: +- https://www.crockford.com/code.html +- https://dojotoolkit.org/reference-guide/1.9/developer/styleguide.html --- @@ -118,19 +130,3 @@ var arr = [,2 ,3] ## When Not To Use It If your project will not be following a consistent comma-spacing pattern, turn this rule off. - -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [comma-style](comma-style) -* [space-in-brackets](space-in-brackets) (deprecated) -* [space-in-parens](space-in-parens) -* [space-infix-ops](space-infix-ops) -* [space-after-keywords](space-after-keywords) -* [space-unary-ops](space-unary-ops) -* [space-return-throw-case](space-return-throw-case) - -## Further Reading - -* [JavaScript](http://javascript.crockford.com/code.html) -* [Dojo Style Guide](https://dojotoolkit.org/reference-guide/1.9/developer/styleguide.html) diff --git a/docs/src/rules/comma-style.md b/docs/src/rules/comma-style.md index 4ce1979c974..e72c59b79f5 100644 --- a/docs/src/rules/comma-style.md +++ b/docs/src/rules/comma-style.md @@ -3,6 +3,10 @@ title: comma-style layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/comma-style.md rule_type: layout +related_rules: +- operator-linebreak +further_reading: +- https://gist.github.com/isaacs/357981 --- @@ -165,14 +169,3 @@ var o = {fst:1, ## When Not To Use It This rule can safely be turned off if your project does not care about enforcing a consistent comma style. - -## Related Rules - -* [operator-linebreak](operator-linebreak) - -## Further Reading - -For more information on the Comma First style: - -* [A better coding convention for lists and object literals in JavaScript by isaacs](https://gist.github.com/isaacs/357981) -* [npm coding style guideline](https://docs.npmjs.com/misc/coding-style) diff --git a/docs/src/rules/complexity.md b/docs/src/rules/complexity.md index 16a2e05651b..e58e75415e7 100644 --- a/docs/src/rules/complexity.md +++ b/docs/src/rules/complexity.md @@ -3,6 +3,20 @@ title: complexity layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/complexity.md rule_type: suggestion +related_rules: +- max-depth +- max-len +- max-lines +- max-lines-per-function +- max-nested-callbacks +- max-params +- max-statements +further_reading: +- https://en.wikipedia.org/wiki/Cyclomatic_complexity +- https://ariya.io/2012/12/complexity-analysis-of-javascript-code +- https://craftsmanshipforsoftware.com/2015/05/25/complexity-for-javascript/ +- https://web.archive.org/web/20160808115119/http://jscomplexity.org/complexity +- https://github.com/eslint/eslint/issues/4808#issuecomment-167795140 --- Enforces a maximum cyclomatic complexity. @@ -130,21 +144,3 @@ is equivalent to ## When Not To Use It If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule. - -## Related Rules - -* [max-depth](max-depth) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) - -## Further Reading - -* [Cyclomatic Complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) -* [Complexity Analysis of JavaScript Code](https://ariya.io/2012/12/complexity-analysis-of-javascript-code) -* [More about Complexity in JavaScript](https://craftsmanshipforsoftware.com/2015/05/25/complexity-for-javascript/) -* [About Complexity](https://web.archive.org/web/20160808115119/http://jscomplexity.org/complexity) -* [Discussion about Complexity in ESLint and more links](https://github.com/eslint/eslint/issues/4808#issuecomment-167795140) diff --git a/docs/src/rules/computed-property-spacing.md b/docs/src/rules/computed-property-spacing.md index f9f97f4993e..e0546c6dbce 100644 --- a/docs/src/rules/computed-property-spacing.md +++ b/docs/src/rules/computed-property-spacing.md @@ -3,6 +3,10 @@ title: computed-property-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/computed-property-spacing.md rule_type: layout +related_rules: +- array-bracket-spacing +- comma-spacing +- space-in-parens --- @@ -180,9 +184,3 @@ const Bar = class { ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of computed properties. - -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [comma-spacing](comma-spacing) -* [space-in-parens](space-in-parens) diff --git a/docs/src/rules/default-case-last.md b/docs/src/rules/default-case-last.md index a75b1ebbb71..279d11280b9 100644 --- a/docs/src/rules/default-case-last.md +++ b/docs/src/rules/default-case-last.md @@ -3,6 +3,10 @@ title: default-case-last layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/default-case-last.md rule_type: suggestion +related_rules: +- default-case +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch --- Enforces default clauses in switch statements to be last. @@ -122,11 +126,3 @@ if (foo !== 0) { } doSomethingAnyway(); ``` - -## Related Rules - -* [default-case](default-case) - -## Further Reading - -* [MDN switch statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch) diff --git a/docs/src/rules/default-case.md b/docs/src/rules/default-case.md index 9e389ca2ffa..f43bc21b023 100644 --- a/docs/src/rules/default-case.md +++ b/docs/src/rules/default-case.md @@ -3,6 +3,8 @@ title: default-case layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/default-case.md rule_type: suggestion +related_rules: +- no-fallthrough --- Requires a `default` case in switch statements. @@ -126,7 +128,3 @@ switch(a) { ## When Not To Use It If you don't want to enforce a `default` case for `switch` statements, you can safely disable this rule. - -## Related Rules - -* [no-fallthrough](no-fallthrough) diff --git a/docs/src/rules/dot-location.md b/docs/src/rules/dot-location.md index 2193e6745db..73b0481edab 100644 --- a/docs/src/rules/dot-location.md +++ b/docs/src/rules/dot-location.md @@ -3,6 +3,9 @@ title: dot-location layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/dot-location.md rule_type: layout +related_rules: +- newline-after-var +- dot-notation --- @@ -87,8 +90,3 @@ var bar = object.property; ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of newlines before or after dots in member expressions. - -## Related Rules - -* [newline-after-var](newline-after-var) -* [dot-notation](dot-notation) diff --git a/docs/src/rules/func-call-spacing.md b/docs/src/rules/func-call-spacing.md index 775655aa957..0f5032b322c 100644 --- a/docs/src/rules/func-call-spacing.md +++ b/docs/src/rules/func-call-spacing.md @@ -3,6 +3,8 @@ title: func-call-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-call-spacing.md rule_type: layout +related_rules: +- no-spaced-func --- @@ -104,10 +106,6 @@ fn This rule can safely be turned off if your project does not care about enforcing a consistent style for spacing within function calls. -## Related Rules - -* [no-spaced-func](no-spaced-func) (deprecated) - ## Compatibility * **JSCS**: [disallowSpacesInCallExpression](https://jscs-dev.github.io/rule/disallowSpacesInCallExpression) diff --git a/docs/src/rules/func-names.md b/docs/src/rules/func-names.md index 4c2e87caeae..b626860066d 100644 --- a/docs/src/rules/func-names.md +++ b/docs/src/rules/func-names.md @@ -3,6 +3,9 @@ title: func-names layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-names.md rule_type: suggestion +further_reading: +- https://web.archive.org/web/20201112040809/http://markdaggett.com/blog/2013/02/15/functions-explained/ +- https://2ality.com/2015/09/function-names-es6.html --- Requires or disallows named `function` expressions. @@ -217,8 +220,3 @@ var foo = bar(function *baz() {}); * **JSCS**: [requireAnonymousFunctions](https://jscs-dev.github.io/rule/requireAnonymousFunctions) * **JSCS**: [disallowAnonymousFunctions](https://jscs-dev.github.io/rule/disallowAnonymousFunctions) - -## Further Reading - -* [Functions Explained](http://markdaggett.com/blog/2013/02/15/functions-explained/) -* [Function Names in ES6](http://2ality.com/2015/09/function-names-es6.html) diff --git a/docs/src/rules/func-style.md b/docs/src/rules/func-style.md index f2babc4c94f..769a7a1f8a5 100644 --- a/docs/src/rules/func-style.md +++ b/docs/src/rules/func-style.md @@ -3,6 +3,8 @@ title: func-style layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-style.md rule_type: suggestion +further_reading: +- https://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html --- Enforces the consistent use of either `function` declarations or expressions. @@ -132,7 +134,3 @@ var foo = () => {}; ## When Not To Use It If you want to allow developers to each decide how they want to write functions on their own, then you can disable this rule. - -## Further Reading - -* [JavaScript Scoping and Hoisting](http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html) diff --git a/docs/src/rules/function-call-argument-newline.md b/docs/src/rules/function-call-argument-newline.md index 834eebc12e6..53c04991560 100644 --- a/docs/src/rules/function-call-argument-newline.md +++ b/docs/src/rules/function-call-argument-newline.md @@ -3,6 +3,11 @@ title: function-call-argument-newline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/function-call-argument-newline.md rule_type: layout +related_rules: +- function-paren-newline +- func-call-spacing +- object-property-newline +- array-element-newline --- @@ -199,10 +204,3 @@ baz( ## When Not To Use It If you don't want to enforce line breaks between arguments, don't enable this rule. - -## Related Rules - -* [function-paren-newline](function-paren-newline) -* [func-call-spacing](func-call-spacing) -* [object-property-newline](object-property-newline) -* [array-element-newline](array-element-newline) diff --git a/docs/src/rules/generator-star-spacing.md b/docs/src/rules/generator-star-spacing.md index f30cb587db9..0833382a6c8 100644 --- a/docs/src/rules/generator-star-spacing.md +++ b/docs/src/rules/generator-star-spacing.md @@ -3,6 +3,8 @@ title: generator-star-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/generator-star-spacing.md rule_type: layout +further_reading: +- https://leanpub.com/understandinges6/read/#leanpub-auto-generators --- @@ -210,7 +212,3 @@ class Class { static * method() {} } ## When Not To Use It If your project will not be using generators or you are not concerned with spacing consistency, you do not need this rule. - -## Further Reading - -* [Understanding ES6: Generators](https://leanpub.com/understandinges6/read/#leanpub-auto-generators) diff --git a/docs/src/rules/generator-star.md b/docs/src/rules/generator-star.md index 0cddfddd49e..f944081a264 100644 --- a/docs/src/rules/generator-star.md +++ b/docs/src/rules/generator-star.md @@ -2,6 +2,8 @@ title: generator-star layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/generator-star.md +further_reading: +- https://leanpub.com/understandinges6/read/#leanpub-auto-generators --- Enforces consistent spacing around the asterisk in generator functions. @@ -126,7 +128,3 @@ The shortened object literal syntax for generators is not affected by this rule. ## When Not To Use It If your project will not be using generators you do not need this rule. - -## Further Reading - -* [Understanding ES6: Generators](https://leanpub.com/understandinges6/read/#leanpub-auto-generators) diff --git a/docs/src/rules/getter-return.md b/docs/src/rules/getter-return.md index 55fc49cda3e..4b3770d84e2 100644 --- a/docs/src/rules/getter-return.md +++ b/docs/src/rules/getter-return.md @@ -3,6 +3,9 @@ title: getter-return layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/getter-return.md rule_type: problem +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get +- https://leanpub.com/understandinges6/read/#leanpub-auto-accessor-properties --- @@ -99,8 +102,3 @@ p = { ## When Not To Use It If your project will not be using ES5 property getters you do not need this rule. - -## Further Reading - -* [MDN: Functions getter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) -* [Understanding ES6: Accessor Properties](https://leanpub.com/understandinges6/read/#leanpub-auto-accessor-properties) diff --git a/docs/src/rules/grouped-accessor-pairs.md b/docs/src/rules/grouped-accessor-pairs.md index 92dc21a2f84..45fd15f862a 100644 --- a/docs/src/rules/grouped-accessor-pairs.md +++ b/docs/src/rules/grouped-accessor-pairs.md @@ -3,6 +3,14 @@ title: grouped-accessor-pairs layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/grouped-accessor-pairs.md rule_type: suggestion +related_rules: +- accessor-pairs +- no-dupe-keys +- no-dupe-class-members +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes --- Requires grouped accessor pairs in object literals and classes. @@ -319,15 +327,3 @@ Also, this rule does not report any warnings for properties that have duplicate See [no-dupe-keys](no-dupe-keys) if you also want to disallow duplicate keys in object literals. See [no-dupe-class-members](no-dupe-class-members) if you also want to disallow duplicate names in class definitions. - -## Related Rules - -* [accessor-pairs](accessor-pairs) -* [no-dupe-keys](no-dupe-keys) -* [no-dupe-class-members](no-dupe-class-members) - -## Further Reading - -* [Object Setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) -* [Object Getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) -* [Classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) diff --git a/docs/src/rules/guard-for-in.md b/docs/src/rules/guard-for-in.md index 1a39d52214c..dec9df17999 100644 --- a/docs/src/rules/guard-for-in.md +++ b/docs/src/rules/guard-for-in.md @@ -3,6 +3,11 @@ title: guard-for-in layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/guard-for-in.md rule_type: suggestion +related_rules: +- no-prototype-builtins +further_reading: +- https://javascriptweblog.wordpress.com/2011/01/04/exploring-javascript-for-in-loops/ +- https://2ality.com/2012/01/objects-as-maps.html --- Requires `for in` loops to include an `if` statement. @@ -48,12 +53,3 @@ for (key in foo) { } } ``` - -## Related Rules - -* [no-prototype-builtins](no-prototype-builtins) - -## Further Reading - -* [Exploring JavaScript for-in loops](https://javascriptweblog.wordpress.com/2011/01/04/exploring-javascript-for-in-loops/) -* [The pitfalls of using objects as maps in JavaScript](http://2ality.com/2012/01/objects-as-maps.html) diff --git a/docs/src/rules/handle-callback-err.md b/docs/src/rules/handle-callback-err.md index 64db6d074f2..fb2b7c72b95 100644 --- a/docs/src/rules/handle-callback-err.md +++ b/docs/src/rules/handle-callback-err.md @@ -3,6 +3,9 @@ title: handle-callback-err layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/handle-callback-err.md rule_type: suggestion +further_reading: +- https://github.com/maxogden/art-of-node#callbacks +- https://web.archive.org/web/20171224042620/https://docs.nodejitsu.com/articles/errors/what-are-the-error-conventions/ --- Enforces callback error handling. @@ -83,8 +86,3 @@ If the configured name of the error variable begins with a `^` it is considered There are cases where it may be safe for your application to ignore errors, however only ignore errors if you are confident that some other form of monitoring will help you catch the problem. - -## Further Reading - -* [The Art Of Node: Callbacks](https://github.com/maxogden/art-of-node#callbacks) -* [Nodejitsu: What are the error conventions?](https://docs.nodejitsu.com/articles/errors/what-are-the-error-conventions/) diff --git a/docs/src/rules/id-length.md b/docs/src/rules/id-length.md index ba2051a584d..318b2be6571 100644 --- a/docs/src/rules/id-length.md +++ b/docs/src/rules/id-length.md @@ -3,6 +3,11 @@ title: id-length layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/id-length.md rule_type: suggestion +related_rules: +- max-len +- new-cap +- func-names +- camelcase --- Enforces minimum and maximum identifier lengths. @@ -253,10 +258,3 @@ var [E] = arr; const { y } = foo; const { a: z } = foo; ``` - -## Related Rules - -* [max-len](max-len) -* [new-cap](new-cap) -* [func-names](func-names) -* [camelcase](camelcase) diff --git a/docs/src/rules/implicit-arrow-linebreak.md b/docs/src/rules/implicit-arrow-linebreak.md index 876f9696508..1a0941bd1bd 100644 --- a/docs/src/rules/implicit-arrow-linebreak.md +++ b/docs/src/rules/implicit-arrow-linebreak.md @@ -3,6 +3,8 @@ title: implicit-arrow-linebreak layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/implicit-arrow-linebreak.md rule_type: layout +related_rules: +- brace-style --- @@ -103,7 +105,3 @@ Examples of **correct** code for this rule with the `"below"` option: If you're not concerned about consistent locations of implicitly returned arrow function expressions, you should not turn on this rule. You can also disable this rule if you are using the `"always"` option for the [`arrow-body-style`](arrow-body-style), since this will disable the use of implicit returns in arrow functions. - -## Related Rules - -* [`brace-style`](brace-style) which enforces this behavior for arrow functions with block bodies. diff --git a/docs/src/rules/jsx-quotes.md b/docs/src/rules/jsx-quotes.md index 91cc4501eeb..14d0aa533dc 100644 --- a/docs/src/rules/jsx-quotes.md +++ b/docs/src/rules/jsx-quotes.md @@ -3,6 +3,8 @@ title: jsx-quotes layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/jsx-quotes.md rule_type: layout +related_rules: +- quotes --- @@ -76,7 +78,3 @@ Examples of **correct** code for this rule with the `"prefer-single"` option: ## When Not To Use It You can turn this rule off if you don’t use JSX or if you aren’t concerned with a consistent usage of quotes within JSX attributes. - -## Related Rules - -* [quotes](quotes) diff --git a/docs/src/rules/lines-around-comment.md b/docs/src/rules/lines-around-comment.md index 2cb707e185e..100cd2daf2c 100644 --- a/docs/src/rules/lines-around-comment.md +++ b/docs/src/rules/lines-around-comment.md @@ -3,6 +3,9 @@ title: lines-around-comment layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/lines-around-comment.md rule_type: layout +related_rules: +- space-before-blocks +- spaced-comment --- @@ -577,8 +580,3 @@ foo(); ## When Not To Use It Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you. - -## Related Rules - -* [space-before-blocks](space-before-blocks) -* [spaced-comment](spaced-comment) diff --git a/docs/src/rules/lines-around-directive.md b/docs/src/rules/lines-around-directive.md index 4f8b7fc1df0..6c31f436885 100644 --- a/docs/src/rules/lines-around-directive.md +++ b/docs/src/rules/lines-around-directive.md @@ -3,6 +3,9 @@ title: lines-around-directive layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/lines-around-directive.md rule_type: layout +related_rules: +- lines-around-comment +- padded-blocks --- @@ -317,11 +320,6 @@ function foo() { You can safely disable this rule if you do not have any strict conventions about whether or not directive prologues should have blank newlines before or after them. -## Related Rules - -* [lines-around-comment](lines-around-comment) -* [padded-blocks](padded-blocks) - ## Compatibility * **JSCS**: [requirePaddingNewLinesAfterUseStrict](https://jscs-dev.github.io/rule/requirePaddingNewLinesAfterUseStrict) diff --git a/docs/src/rules/lines-between-class-members.md b/docs/src/rules/lines-between-class-members.md index 05a2c90cedd..0a798eb6af6 100644 --- a/docs/src/rules/lines-between-class-members.md +++ b/docs/src/rules/lines-between-class-members.md @@ -3,6 +3,9 @@ title: lines-between-class-members layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/lines-between-class-members.md rule_type: layout +related_rules: +- padded-blocks +- padding-line-between-statements --- @@ -129,11 +132,6 @@ class Foo{ If you don't want to enforce empty lines between class members, you can disable this rule. -## Related Rules - -* [padded-blocks](padded-blocks) -* [padding-line-between-statements](padding-line-between-statements) - ## Compatibility * [requirePaddingNewLinesAfterBlocks](https://jscs-dev.github.io/rule/requirePaddingNewLinesAfterBlocks) diff --git a/docs/src/rules/max-depth.md b/docs/src/rules/max-depth.md index fd2539b3f1e..0263e343a87 100644 --- a/docs/src/rules/max-depth.md +++ b/docs/src/rules/max-depth.md @@ -3,6 +3,14 @@ title: max-depth layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-depth.md rule_type: suggestion +related_rules: +- complexity +- max-len +- max-lines +- max-lines-per-function +- max-nested-callbacks +- max-params +- max-statements --- Enforces a maximum depth that blocks can be nested. @@ -100,13 +108,3 @@ function foo() { } } ``` - -## Related Rules - -* [complexity](complexity) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) diff --git a/docs/src/rules/max-len.md b/docs/src/rules/max-len.md index 5b2ab80b102..a52cefbba70 100644 --- a/docs/src/rules/max-len.md +++ b/docs/src/rules/max-len.md @@ -3,6 +3,12 @@ title: max-len layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-len.md rule_type: layout +related_rules: +- complexity +- max-depth +- max-nested-callbacks +- max-params +- max-statements --- Enforces a maximum line length. @@ -158,11 +164,3 @@ Examples of **correct** code for this rule with the `ignorePattern` option: var dep = require('really/really/really/really/really/really/really/really/long/module'); ``` - -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) diff --git a/docs/src/rules/max-lines-per-function.md b/docs/src/rules/max-lines-per-function.md index f04ef80261d..daf6f389d14 100644 --- a/docs/src/rules/max-lines-per-function.md +++ b/docs/src/rules/max-lines-per-function.md @@ -3,6 +3,14 @@ title: max-lines-per-function layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-lines-per-function.md rule_type: suggestion +related_rules: +- complexity +- max-depth +- max-lines +- max-nested-callbacks +- max-params +- max-statements +- max-statements-per-line --- Enforces a maximum function length. @@ -194,13 +202,3 @@ Examples of **correct** code for this rule with the `{ "IIFEs": true }` option: ## When Not To Use It You can turn this rule off if you are not concerned with the number of lines in your functions. - -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-lines](max-lines) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) -* [max-statements-per-line](max-statements-per-line) diff --git a/docs/src/rules/max-lines.md b/docs/src/rules/max-lines.md index 31d232a6ddb..2ce5e5813fb 100644 --- a/docs/src/rules/max-lines.md +++ b/docs/src/rules/max-lines.md @@ -3,6 +3,15 @@ title: max-lines layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-lines.md rule_type: suggestion +related_rules: +- complexity +- max-depth +- max-lines-per-function +- max-nested-callbacks +- max-params +- max-statements +further_reading: +- https://web.archive.org/web/20160725154648/http://www.mind2b.com/component/content/article/24-software-module-size-and-file-size --- Enforces a maximum file length. @@ -116,19 +125,6 @@ var a, You can turn this rule off if you are not concerned with the number of lines in your files. -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) - ## Compatibility * **JSCS**: [maximumNumberOfLines](https://jscs-dev.github.io/rule/maximumNumberOfLines) - -## Further Reading - -* [Software Module size and file size](https://web.archive.org/web/20160725154648/http://www.mind2b.com/component/content/article/24-software-module-size-and-file-size) diff --git a/docs/src/rules/max-nested-callbacks.md b/docs/src/rules/max-nested-callbacks.md index 61a2ca750ab..a541eb7a50f 100644 --- a/docs/src/rules/max-nested-callbacks.md +++ b/docs/src/rules/max-nested-callbacks.md @@ -3,6 +3,18 @@ title: max-nested-callbacks layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-nested-callbacks.md rule_type: suggestion +related_rules: +- complexity +- max-depth +- max-len +- max-lines +- max-lines-per-function +- max-params +- max-statements +further_reading: +- http://book.mixu.net/node/ch7.html +- https://web.archive.org/web/20220104141150/https://howtonode.org/control-flow +- https://web.archive.org/web/20220127215850/https://howtonode.org/control-flow-part-ii --- Enforces a maximum depth that callbacks can be nested. @@ -74,19 +86,3 @@ function handleFoo4() { foo5(); } ``` - -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-params](max-params) -* [max-statements](max-statements) - -## Further Reading - -* [Control flow in Node.js](http://book.mixu.net/node/ch7.html) -* [Control Flow in Node](https://howtonode.org/control-flow) -* [Control Flow in Node Part II](https://howtonode.org/control-flow-part-ii) diff --git a/docs/src/rules/max-params.md b/docs/src/rules/max-params.md index ece9598811f..ad45082ec65 100644 --- a/docs/src/rules/max-params.md +++ b/docs/src/rules/max-params.md @@ -3,6 +3,14 @@ title: max-params layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-params.md rule_type: suggestion +related_rules: +- complexity +- max-depth +- max-len +- max-lines +- max-lines-per-function +- max-nested-callbacks +- max-statements --- Enforces a maximum number of parameters in function definitions. @@ -58,13 +66,3 @@ let foo = (bar, baz, qux) => { doSomething(); }; ``` - -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-statements](max-statements) diff --git a/docs/src/rules/max-statements-per-line.md b/docs/src/rules/max-statements-per-line.md index d2a17245060..8d34246ea9a 100644 --- a/docs/src/rules/max-statements-per-line.md +++ b/docs/src/rules/max-statements-per-line.md @@ -3,6 +3,14 @@ title: max-statements-per-line layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-statements-per-line.md rule_type: layout +related_rules: +- max-depth +- max-len +- max-lines +- max-lines-per-function +- max-nested-callbacks +- max-params +- max-statements --- Enforces a maximum number of statements allowed per line. @@ -82,13 +90,3 @@ var foo = function foo() { bar = 1; }; ## When Not To Use It You can turn this rule off if you are not concerned with the number of statements on each line. - -## Related Rules - -* [max-depth](max-depth) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) diff --git a/docs/src/rules/max-statements.md b/docs/src/rules/max-statements.md index 9c1dfe0ffef..2d18021f34a 100644 --- a/docs/src/rules/max-statements.md +++ b/docs/src/rules/max-statements.md @@ -3,6 +3,14 @@ title: max-statements layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-statements.md rule_type: suggestion +related_rules: +- complexity +- max-depth +- max-len +- max-lines +- max-lines-per-function +- max-nested-callbacks +- max-params --- Enforces a maximum number of statements allowed in function blocks. @@ -164,13 +172,3 @@ function foo() { var foo11 = 11; } ``` - -## Related Rules - -* [complexity](complexity) -* [max-depth](max-depth) -* [max-len](max-len) -* [max-lines](max-lines) -* [max-lines-per-function](max-lines-per-function) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) diff --git a/docs/src/rules/multiline-ternary.md b/docs/src/rules/multiline-ternary.md index d4c5e1e6d9a..f92d6715f41 100644 --- a/docs/src/rules/multiline-ternary.md +++ b/docs/src/rules/multiline-ternary.md @@ -3,6 +3,8 @@ title: multiline-ternary layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/multiline-ternary.md rule_type: layout +related_rules: +- operator-linebreak --- @@ -153,10 +155,6 @@ foo > bar ? ( You can safely disable this rule if you do not have any strict conventions about whether the operands of a ternary expression should be separated by newlines. -## Related Rules - -* [operator-linebreak](operator-linebreak) - ## Compatibility * **JSCS**: [requireMultiLineTernary](https://jscs-dev.github.io/rule/requireMultiLineTernary) diff --git a/docs/src/rules/newline-before-return.md b/docs/src/rules/newline-before-return.md index 718ceb25365..261b8619ffb 100644 --- a/docs/src/rules/newline-before-return.md +++ b/docs/src/rules/newline-before-return.md @@ -3,6 +3,8 @@ title: newline-before-return layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/newline-before-return.md rule_type: layout +related_rules: +- newline-after-var --- @@ -119,7 +121,3 @@ function foo() { ## When Not To Use It You can safely disable this rule if you do not have any strict conventions about whitespace before `return` statements. - -## Related Rules - -* [newline-after-var](newline-after-var) diff --git a/docs/src/rules/no-alert.md b/docs/src/rules/no-alert.md index 48167bd1f8d..414cce09d12 100644 --- a/docs/src/rules/no-alert.md +++ b/docs/src/rules/no-alert.md @@ -3,6 +3,9 @@ title: no-alert layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-alert.md rule_type: suggestion +related_rules: +- no-console +- no-debugger --- Disallows the use of `alert`, `confirm`, and `prompt`. @@ -45,8 +48,3 @@ function foo() { alert(); } ``` - -## Related Rules - -* [no-console](no-console) -* [no-debugger](no-debugger) diff --git a/docs/src/rules/no-array-constructor.md b/docs/src/rules/no-array-constructor.md index 746704b55b8..da49901c4f4 100644 --- a/docs/src/rules/no-array-constructor.md +++ b/docs/src/rules/no-array-constructor.md @@ -3,6 +3,9 @@ title: no-array-constructor layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-array-constructor.md rule_type: suggestion +related_rules: +- no-new-object +- no-new-wrappers --- Disallows `Array` constructors. @@ -43,8 +46,3 @@ new Array(someOtherArray.length) This rule enforces a nearly universal stylistic concern. That being said, this rule may be disabled if the constructor style is preferred. - -## Related Rules - -* [no-new-object](no-new-object) -* [no-new-wrappers](no-new-wrappers) diff --git a/docs/src/rules/no-arrow-condition.md b/docs/src/rules/no-arrow-condition.md index be451c87797..ad15b469848 100644 --- a/docs/src/rules/no-arrow-condition.md +++ b/docs/src/rules/no-arrow-condition.md @@ -3,6 +3,10 @@ title: no-arrow-condition layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-arrow-condition.md +related_rules: +- arrow-parens +- no-confusing-arrow +- no-constant-condition --- Disallows arrow functions where test conditions are expected. @@ -47,9 +51,3 @@ a => 1 ? 2 : 3 var x = a => 1 ? 2 : 3 var x = (a) => 1 ? 2 : 3 ``` - -## Related Rules - -* [arrow-parens](arrow-parens) -* [no-confusing-arrow](no-confusing-arrow) -* [no-constant-condition](no-constant-condition) diff --git a/docs/src/rules/no-buffer-constructor.md b/docs/src/rules/no-buffer-constructor.md index 64e7c1e1702..93dde30184d 100644 --- a/docs/src/rules/no-buffer-constructor.md +++ b/docs/src/rules/no-buffer-constructor.md @@ -3,6 +3,10 @@ title: no-buffer-constructor layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-buffer-constructor.md rule_type: problem +further_reading: +- https://nodejs.org/api/buffer.html +- https://github.com/ChALkeR/notes/blob/master/Lets-fix-Buffer-API.md +- https://github.com/nodejs/node/issues/4660 --- Disallows use of the `Buffer()` constructor. @@ -42,9 +46,3 @@ Buffer.from(res.body.values); ## When Not To Use It If you don't use Node.js, or you still need to support versions of Node.js that lack methods like `Buffer.from`, then you should not enable this rule. - -## Further Reading - -* [Buffer API documentation](https://nodejs.org/api/buffer.html) -* [Let's fix Node.js Buffer API](https://github.com/ChALkeR/notes/blob/master/Lets-fix-Buffer-API.md) -* [Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) diff --git a/docs/src/rules/no-case-declarations.md b/docs/src/rules/no-case-declarations.md index 4e0717e8d27..feeb25499f5 100644 --- a/docs/src/rules/no-case-declarations.md +++ b/docs/src/rules/no-case-declarations.md @@ -3,6 +3,8 @@ title: no-case-declarations layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-case-declarations.md rule_type: suggestion +related_rules: +- no-fallthrough --- @@ -78,7 +80,3 @@ switch (foo) { ## When Not To Use It If you depend on fall through behavior and want access to bindings introduced in the case block. - -## Related Rules - -* [no-fallthrough](no-fallthrough) diff --git a/docs/src/rules/no-cond-assign.md b/docs/src/rules/no-cond-assign.md index 318a9e8bf34..a1e61504ba8 100644 --- a/docs/src/rules/no-cond-assign.md +++ b/docs/src/rules/no-cond-assign.md @@ -3,6 +3,8 @@ title: no-cond-assign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-cond-assign.md rule_type: problem +related_rules: +- no-extra-parens --- @@ -130,7 +132,3 @@ if (x === 0) { var b = 1; } ``` - -## Related Rules - -* [no-extra-parens](no-extra-parens) diff --git a/docs/src/rules/no-confusing-arrow.md b/docs/src/rules/no-confusing-arrow.md index d5a3a0e40c1..094497135ec 100644 --- a/docs/src/rules/no-confusing-arrow.md +++ b/docs/src/rules/no-confusing-arrow.md @@ -3,6 +3,9 @@ title: no-confusing-arrow layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-confusing-arrow.md rule_type: suggestion +related_rules: +- no-constant-condition +- arrow-parens --- @@ -95,8 +98,3 @@ Examples of **correct** code for this rule with the `{"onlyOneSimpleParam": true ([a]) => 1 ? 2 : 3; (...a) => 1 ? 2 : 3; ``` - -## Related Rules - -* [no-constant-condition](no-constant-condition) -* [arrow-parens](arrow-parens) diff --git a/docs/src/rules/no-console.md b/docs/src/rules/no-console.md index 6bf0637aa86..1b258a3d8a5 100644 --- a/docs/src/rules/no-console.md +++ b/docs/src/rules/no-console.md @@ -3,6 +3,9 @@ title: no-console layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-console.md rule_type: suggestion +related_rules: +- no-alert +- no-debugger --- Disallows the use of `console`. @@ -97,8 +100,3 @@ However, you might not want to manually add `eslint-disable-next-line` or `eslin } } ``` - -## Related Rules - -* [no-alert](no-alert) -* [no-debugger](no-debugger) diff --git a/docs/src/rules/no-constant-binary-expression.md b/docs/src/rules/no-constant-binary-expression.md index 7efd4fcf4c6..5f3c42aa4a0 100644 --- a/docs/src/rules/no-constant-binary-expression.md +++ b/docs/src/rules/no-constant-binary-expression.md @@ -3,6 +3,8 @@ title: no-constant-binary-expression layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-constant-binary-expression.md rule_type: problem +related_rules: +- no-constant-condition --- Disallows expressions where the operation doesn't affect the value. @@ -69,7 +71,3 @@ const objIsEmpty = Object.keys(someObj).length === 0; const arrIsEmpty = someArr.length === 0; ``` - -## Related Rules - -* [no-constant-condition](no-constant-condition) diff --git a/docs/src/rules/no-constant-condition.md b/docs/src/rules/no-constant-condition.md index 14ad92d0488..a2b4e025aac 100644 --- a/docs/src/rules/no-constant-condition.md +++ b/docs/src/rules/no-constant-condition.md @@ -3,6 +3,8 @@ title: no-constant-condition layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-constant-condition.md rule_type: problem +related_rules: +- no-constant-binary-expression --- @@ -132,7 +134,3 @@ do { } } while (true) ``` - -## Related Rules - -* [no-constant-binary-expression](no-constant-binary-expression) diff --git a/docs/src/rules/no-control-regex.md b/docs/src/rules/no-control-regex.md index 542e8f39153..57e85e470d3 100644 --- a/docs/src/rules/no-control-regex.md +++ b/docs/src/rules/no-control-regex.md @@ -3,6 +3,9 @@ title: no-control-regex layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-control-regex.md rule_type: problem +related_rules: +- no-div-regex +- no-regex-spaces --- @@ -67,8 +70,3 @@ There is no difference in behavior between `new RegExp("\t")` and `new RegExp("\ ## When Not To Use It If you need to use control character pattern matching, then you should turn this rule off. - -## Related Rules - -* [no-div-regex](no-div-regex) -* [no-regex-spaces](no-regex-spaces) diff --git a/docs/src/rules/no-debugger.md b/docs/src/rules/no-debugger.md index 99188c8018a..67588f209d0 100644 --- a/docs/src/rules/no-debugger.md +++ b/docs/src/rules/no-debugger.md @@ -3,6 +3,11 @@ title: no-debugger layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-debugger.md rule_type: problem +related_rules: +- no-alert +- no-console +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger --- @@ -39,12 +44,3 @@ function isTruthy(x) { ## When Not To Use It If your code is still very much in development and don't want to worry about stripping `debugger` statements, then turn this rule off. You'll generally want to turn it back on when testing code prior to deployment. - -## Related Rules - -* [no-alert](no-alert) -* [no-console](no-console) - -## Further Reading - -* [Debugger](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) diff --git a/docs/src/rules/no-div-regex.md b/docs/src/rules/no-div-regex.md index 26022d05840..60a1440a284 100644 --- a/docs/src/rules/no-div-regex.md +++ b/docs/src/rules/no-div-regex.md @@ -3,6 +3,9 @@ title: no-div-regex layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-div-regex.md rule_type: suggestion +related_rules: +- no-control-regex +- no-regex-spaces --- @@ -34,8 +37,3 @@ Examples of **correct** code for this rule: function bar() { return /[=]foo/; } ``` - -## Related Rules - -* [no-control-regex](no-control-regex) -* [no-regex-spaces](no-regex-spaces) diff --git a/docs/src/rules/no-dupe-else-if.md b/docs/src/rules/no-dupe-else-if.md index 73c98f9d246..38a9c969114 100644 --- a/docs/src/rules/no-dupe-else-if.md +++ b/docs/src/rules/no-dupe-else-if.md @@ -3,6 +3,9 @@ title: no-dupe-else-if layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-dupe-else-if.md rule_type: problem +related_rules: +- no-duplicate-case +- no-lonely-if --- @@ -180,8 +183,3 @@ if (a) { ## When Not To Use It In rare cases where you really need identical test conditions in the same chain, which necessarily means that the expressions in the chain are causing and relying on side effects, you will have to turn this rule off. - -## Related Rules - -* [no-duplicate-case](no-duplicate-case) -* [no-lonely-if](no-lonely-if) diff --git a/docs/src/rules/no-empty-function.md b/docs/src/rules/no-empty-function.md index bb97633610e..e80566c189d 100644 --- a/docs/src/rules/no-empty-function.md +++ b/docs/src/rules/no-empty-function.md @@ -3,6 +3,8 @@ title: no-empty-function layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-function.md rule_type: suggestion +related_rules: +- no-empty --- Disallows empty functions. @@ -348,7 +350,3 @@ class A { ## When Not To Use It If you don't want to be notified about empty functions, then it's safe to disable this rule. - -## Related Rules - -* [no-empty](./no-empty) diff --git a/docs/src/rules/no-empty-label.md b/docs/src/rules/no-empty-label.md index f7a3fadebc3..72ef07f7587 100644 --- a/docs/src/rules/no-empty-label.md +++ b/docs/src/rules/no-empty-label.md @@ -3,6 +3,10 @@ title: no-empty-label layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-label.md +related_rules: +- no-labels +- no-label-var +- no-unused-labels --- Disallows labels for anything other than loops and switches. @@ -38,9 +42,3 @@ for (var i=10; i; i--) { ## When Not To Use It If you don't want to be notified about usage of labels, then it's safe to disable this rule. - -## Related Rules - -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) diff --git a/docs/src/rules/no-empty.md b/docs/src/rules/no-empty.md index cf3ab39d1b9..4b1d428a105 100644 --- a/docs/src/rules/no-empty.md +++ b/docs/src/rules/no-empty.md @@ -3,6 +3,8 @@ title: no-empty layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty.md rule_type: suggestion +related_rules: +- no-empty-function --- @@ -92,7 +94,3 @@ finally { ## When Not To Use It If you intentionally use empty block statements then you can disable this rule. - -## Related Rules - -* [no-empty-function](./no-empty-function) diff --git a/docs/src/rules/no-eval.md b/docs/src/rules/no-eval.md index 35cbc7ee193..f559ebe6641 100644 --- a/docs/src/rules/no-eval.md +++ b/docs/src/rules/no-eval.md @@ -3,6 +3,11 @@ title: no-eval layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-eval.md rule_type: suggestion +related_rules: +- no-implied-eval +further_reading: +- https://ericlippert.com/2003/11/01/eval-is-evil-part-one/ +- https://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/ --- Disallows eval(). @@ -151,12 +156,3 @@ global.eval("var a = 0"); var foo = window; foo.eval("var a = 0"); ``` - -## Related Rules - -* [no-implied-eval](no-implied-eval) - -## Further Reading - -* [Eval is Evil, Part One](https://ericlippert.com/2003/11/01/eval-is-evil-part-one/) -* [How evil is eval](https://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/) diff --git a/docs/src/rules/no-ex-assign.md b/docs/src/rules/no-ex-assign.md index 233ec239010..a4e186626df 100644 --- a/docs/src/rules/no-ex-assign.md +++ b/docs/src/rules/no-ex-assign.md @@ -3,6 +3,8 @@ title: no-ex-assign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-ex-assign.md rule_type: problem +further_reading: +- https://bocoup.com/blog/the-catch-with-try-catch --- @@ -39,7 +41,3 @@ try { var foo = 10; } ``` - -## Further Reading - -* [The "catch" with try...catch](https://bocoup.com/blog/the-catch-with-try-catch) by Ben Alman explains how the exception identifier can leak into the outer scope in IE 6-8 diff --git a/docs/src/rules/no-extend-native.md b/docs/src/rules/no-extend-native.md index d0be66af56d..eef3c34a0bd 100644 --- a/docs/src/rules/no-extend-native.md +++ b/docs/src/rules/no-extend-native.md @@ -3,6 +3,8 @@ title: no-extend-native layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extend-native.md rule_type: suggestion +related_rules: +- no-global-assign --- Disallows extending of native objects. @@ -76,7 +78,3 @@ window.Function.prototype.bind = 'tight'; ## When Not To Use It You may want to disable this rule when working with polyfills that try to patch older versions of JavaScript with the latest spec, such as those that might `Function.prototype.bind` or `Array.prototype.forEach` in a future-friendly way. - -## Related Rules - -* [no-global-assign](no-global-assign) diff --git a/docs/src/rules/no-extra-bind.md b/docs/src/rules/no-extra-bind.md index 5a7d28f321f..eebe43a4f6a 100644 --- a/docs/src/rules/no-extra-bind.md +++ b/docs/src/rules/no-extra-bind.md @@ -3,6 +3,9 @@ title: no-extra-bind layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-bind.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind +- https://www.smashingmagazine.com/2014/01/understanding-javascript-function-prototype-bind/ --- @@ -88,8 +91,3 @@ var x = function (a) { ## When Not To Use It If you are not concerned about unnecessary calls to `bind()`, you can safely disable this rule. - -## Further Reading - -* [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) -* [Understanding JavaScript's Function.prototype.bind](https://www.smashingmagazine.com/2014/01/understanding-javascript-function-prototype-bind/) diff --git a/docs/src/rules/no-extra-label.md b/docs/src/rules/no-extra-label.md index 82b98c1dce0..c5dda3f8d0a 100644 --- a/docs/src/rules/no-extra-label.md +++ b/docs/src/rules/no-extra-label.md @@ -3,6 +3,10 @@ title: no-extra-label layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-label.md rule_type: suggestion +related_rules: +- no-labels +- no-label-var +- no-unused-labels --- @@ -83,9 +87,3 @@ C: switch (a) { ## When Not To Use It If you don't want to be notified about usage of labels, then it's safe to disable this rule. - -## Related Rules - -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) diff --git a/docs/src/rules/no-extra-parens.md b/docs/src/rules/no-extra-parens.md index 858734e4374..d5afd39a306 100644 --- a/docs/src/rules/no-extra-parens.md +++ b/docs/src/rules/no-extra-parens.md @@ -3,6 +3,12 @@ title: no-extra-parens layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-parens.md rule_type: layout +related_rules: +- arrow-parens +- no-cond-assign +- no-return-assign +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence --- @@ -297,13 +303,3 @@ a = (b * c); typeof (a); ``` - -## Related Rules - -* [arrow-parens](arrow-parens) -* [no-cond-assign](no-cond-assign) -* [no-return-assign](no-return-assign) - -## Further Reading - -* [MDN: Operator Precedence](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence) diff --git a/docs/src/rules/no-extra-semi.md b/docs/src/rules/no-extra-semi.md index 6aea002ebc9..ae7b65e3697 100644 --- a/docs/src/rules/no-extra-semi.md +++ b/docs/src/rules/no-extra-semi.md @@ -3,6 +3,9 @@ title: no-extra-semi layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-semi.md rule_type: suggestion +related_rules: +- semi +- semi-spacing --- @@ -72,8 +75,3 @@ class C { ## When Not To Use It If you intentionally use extra semicolons then you can disable this rule. - -## Related Rules - -* [semi](semi) -* [semi-spacing](semi-spacing) diff --git a/docs/src/rules/no-extra-strict.md b/docs/src/rules/no-extra-strict.md index f2627ebafda..28dba6d8a97 100644 --- a/docs/src/rules/no-extra-strict.md +++ b/docs/src/rules/no-extra-strict.md @@ -3,6 +3,8 @@ title: no-extra-strict layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-strict.md +further_reading: +- https://es5.github.io/#C --- Disallows strict mode directives when already in strict mode. @@ -51,7 +53,3 @@ Examples of **correct** code for this rule: var foo = true; }()); ``` - -## Further Reading - -* [The ECMAScript 5 Annotated Specification - Strict Mode](https://es5.github.io/#C) diff --git a/docs/src/rules/no-fallthrough.md b/docs/src/rules/no-fallthrough.md index bb7c618721b..d7a3e8031cf 100644 --- a/docs/src/rules/no-fallthrough.md +++ b/docs/src/rules/no-fallthrough.md @@ -3,6 +3,8 @@ title: no-fallthrough layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-fallthrough.md rule_type: problem +related_rules: +- default-case --- @@ -194,7 +196,3 @@ switch(foo) { ## When Not To Use It If you don't want to enforce that each `case` statement should end with a `throw`, `return`, `break`, or comment, then you can safely turn this rule off. - -## Related Rules - -* [default-case](default-case) diff --git a/docs/src/rules/no-global-assign.md b/docs/src/rules/no-global-assign.md index b5be6d41e93..4e10466d272 100644 --- a/docs/src/rules/no-global-assign.md +++ b/docs/src/rules/no-global-assign.md @@ -3,6 +3,10 @@ title: no-global-assign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-global-assign.md rule_type: suggestion +related_rules: +- no-extend-native +- no-redeclare +- no-shadow --- @@ -90,9 +94,3 @@ This rule accepts an `exceptions` option, which can be used to specify a list of ## When Not To Use It If you are trying to override one of the native objects. - -## Related Rules - -* [no-extend-native](no-extend-native) -* [no-redeclare](no-redeclare) -* [no-shadow](no-shadow) diff --git a/docs/src/rules/no-implicit-globals.md b/docs/src/rules/no-implicit-globals.md index c8a0a542f68..8c075ab62f7 100644 --- a/docs/src/rules/no-implicit-globals.md +++ b/docs/src/rules/no-implicit-globals.md @@ -3,6 +3,13 @@ title: no-implicit-globals layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-implicit-globals.md rule_type: suggestion +related_rules: +- no-undef +- no-global-assign +further_reading: +- https://benalman.com/news/2010/11/immediately-invoked-function-expression/ +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Undeclared_var +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone --- Disallows declarations in the global scope. @@ -220,14 +227,3 @@ In the case of a CommonJS module, if your code is in strict mode or you don't wa and you also don't want this rule to warn you about the read-only globals, you can disable this rule. In the case of an ES module, if you don't want this rule to warn you about the read-only globals you can disable this rule. - -## Related Rules - -* [no-undef](no-undef) -* [no-global-assign](no-global-assign) - -## Further Reading - -* [Immediately-Invoked Function Expression (IIFE)](http://benalman.com/news/2010/11/immediately-invoked-function-expression/) -* [ReferenceError: assignment to undeclared variable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Undeclared_var) -* [Temporal Dead Zone](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone) diff --git a/docs/src/rules/no-implied-eval.md b/docs/src/rules/no-implied-eval.md index 48af9609054..66596a9e56f 100644 --- a/docs/src/rules/no-implied-eval.md +++ b/docs/src/rules/no-implied-eval.md @@ -3,6 +3,8 @@ title: no-implied-eval layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-implied-eval.md rule_type: suggestion +related_rules: +- no-eval --- Disallows the use of `eval()`-like methods. @@ -63,7 +65,3 @@ setInterval(function() { ## When Not To Use It If you want to allow `setTimeout()` and `setInterval()` with string arguments, then you can safely disable this rule. - -## Related Rules - -* [no-eval](no-eval) diff --git a/docs/src/rules/no-invalid-regexp.md b/docs/src/rules/no-invalid-regexp.md index 724cf2118c7..5c70b81aae1 100644 --- a/docs/src/rules/no-invalid-regexp.md +++ b/docs/src/rules/no-invalid-regexp.md @@ -3,6 +3,8 @@ title: no-invalid-regexp layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-invalid-regexp.md rule_type: problem +further_reading: +- https://es5.github.io/#x7.8.5 --- @@ -60,7 +62,3 @@ new RegExp('.', 'a') new RegExp('.', 'az') ``` - -## Further Reading - -* [Annotated ES5 §7.8.5 - Regular Expression Literals](https://es5.github.io/#x7.8.5) diff --git a/docs/src/rules/no-irregular-whitespace.md b/docs/src/rules/no-irregular-whitespace.md index b99f1faf034..f470a893875 100644 --- a/docs/src/rules/no-irregular-whitespace.md +++ b/docs/src/rules/no-irregular-whitespace.md @@ -3,6 +3,9 @@ title: no-irregular-whitespace layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-irregular-whitespace.md rule_type: problem +further_reading: +- https://es5.github.io/#x7.2 +- https://web.archive.org/web/20200414142829/http://timelessrepo.com/json-isnt-a-javascript-subset --- @@ -174,8 +177,3 @@ function thing() { ## When Not To Use It If you decide that you wish to use whitespace other than tabs and spaces outside of strings in your application. - -## Further Reading - -* [ECMA whitespace](https://es5.github.io/#x7.2) -* [JSON whitespace issues](http://timelessrepo.com/json-isnt-a-javascript-subset) diff --git a/docs/src/rules/no-iterator.md b/docs/src/rules/no-iterator.md index 39116ee88c9..87aab8ce4e1 100644 --- a/docs/src/rules/no-iterator.md +++ b/docs/src/rules/no-iterator.md @@ -3,6 +3,10 @@ title: no-iterator layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-iterator.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators +- https://kangax.github.io/es5-compat-table/es6/#Iterators +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#Object_methods --- Disallows the use of the `__iterator__` property. @@ -43,9 +47,3 @@ Examples of **correct** code for this rule: var __iterator__ = foo; // Not using the `__iterator__` property. ``` - -## Further Reading - -* [MDN - Iterators and Generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) -* [ECMAScript 6 compatibility table - Iterators](https://kangax.github.io/es5-compat-table/es6/#Iterators) -* [Deprecated and Obsolete Features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#Object_methods) diff --git a/docs/src/rules/no-label-var.md b/docs/src/rules/no-label-var.md index 60f433d9421..3f98e2de32c 100644 --- a/docs/src/rules/no-label-var.md +++ b/docs/src/rules/no-label-var.md @@ -3,6 +3,10 @@ title: no-label-var layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-label-var.md rule_type: suggestion +related_rules: +- no-extra-label +- no-labels +- no-unused-labels --- Disallows labels that are variable names. @@ -47,9 +51,3 @@ q: ## When Not To Use It If you don't want to be notified about usage of labels, then it's safe to disable this rule. - -## Related Rules - -* [no-extra-label](./no-extra-label) -* [no-labels](./no-labels) -* [no-unused-labels](./no-unused-labels) diff --git a/docs/src/rules/no-labels.md b/docs/src/rules/no-labels.md index fdf9231c597..1165439538c 100644 --- a/docs/src/rules/no-labels.md +++ b/docs/src/rules/no-labels.md @@ -3,6 +3,10 @@ title: no-labels layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-labels.md rule_type: suggestion +related_rules: +- no-extra-label +- no-label-var +- no-unused-labels --- Disallows labeled statements. @@ -122,9 +126,3 @@ label: ## When Not To Use It If you need to use labeled statements everywhere, then you can safely disable this rule. - -## Related Rules - -* [no-extra-label](./no-extra-label) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) diff --git a/docs/src/rules/no-mixed-operators.md b/docs/src/rules/no-mixed-operators.md index 831bd3626ef..d47e47781dd 100644 --- a/docs/src/rules/no-mixed-operators.md +++ b/docs/src/rules/no-mixed-operators.md @@ -3,6 +3,8 @@ title: no-mixed-operators layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-mixed-operators.md rule_type: suggestion +related_rules: +- no-extra-parens --- Disallows mixes of different operators. @@ -181,7 +183,3 @@ var foo = (a + b) - c; ## When Not To Use It If you don't want to be notified about mixed operators, then it's safe to disable this rule. - -## Related Rules - -* [no-extra-parens](no-extra-parens) diff --git a/docs/src/rules/no-mixed-spaces-and-tabs.md b/docs/src/rules/no-mixed-spaces-and-tabs.md index d53fc786f35..2e7dc0cfccc 100644 --- a/docs/src/rules/no-mixed-spaces-and-tabs.md +++ b/docs/src/rules/no-mixed-spaces-and-tabs.md @@ -3,6 +3,8 @@ title: no-mixed-spaces-and-tabs layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-mixed-spaces-and-tabs.md rule_type: layout +further_reading: +- https://www.emacswiki.org/emacs/SmartTabs --- @@ -67,7 +69,3 @@ function main() { y = 7; } ``` - -## Further Reading - -* [Smart Tabs](https://www.emacswiki.org/emacs/SmartTabs) diff --git a/docs/src/rules/no-multi-assign.md b/docs/src/rules/no-multi-assign.md index 8ebc10b38f0..34909f92c2b 100644 --- a/docs/src/rules/no-multi-assign.md +++ b/docs/src/rules/no-multi-assign.md @@ -3,6 +3,8 @@ title: no-multi-assign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-multi-assign.md rule_type: suggestion +related_rules: +- max-statements-per-line --- Disallows use of chained assignment expressions. @@ -100,7 +102,3 @@ class Foo { a = b = 10; } ``` - -## Related Rules - -* [max-statements-per-line](max-statements-per-line) diff --git a/docs/src/rules/no-multi-spaces.md b/docs/src/rules/no-multi-spaces.md index 2e93c4571ee..373ef1ea4ec 100644 --- a/docs/src/rules/no-multi-spaces.md +++ b/docs/src/rules/no-multi-spaces.md @@ -3,6 +3,14 @@ title: no-multi-spaces layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-multi-spaces.md rule_type: layout +related_rules: +- key-spacing +- space-infix-ops +- space-in-brackets +- space-in-parens +- space-after-keywords +- space-unary-ops +- space-return-throw-case --- @@ -168,13 +176,3 @@ import someOtherMod from 'some-other-mod'; ## When Not To Use It If you don't want to check and disallow multiple spaces, then you should turn this rule off. - -## Related Rules - -* [key-spacing](key-spacing) -* [space-infix-ops](space-infix-ops) -* [space-in-brackets](space-in-brackets) (deprecated) -* [space-in-parens](space-in-parens) -* [space-after-keywords](space-after-keywords) -* [space-unary-ops](space-unary-ops) -* [space-return-throw-case](space-return-throw-case) diff --git a/docs/src/rules/no-native-reassign.md b/docs/src/rules/no-native-reassign.md index f66a09ca48d..ce6b557b18d 100644 --- a/docs/src/rules/no-native-reassign.md +++ b/docs/src/rules/no-native-reassign.md @@ -3,6 +3,10 @@ title: no-native-reassign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-native-reassign.md rule_type: suggestion +related_rules: +- no-extend-native +- no-redeclare +- no-shadow --- Disallows reassignment of native objects. @@ -90,9 +94,3 @@ This rule accepts an `exceptions` option, which can be used to specify a list of ## When Not To Use It If you are trying to override one of the native objects. - -## Related Rules - -* [no-extend-native](no-extend-native) -* [no-redeclare](no-redeclare) -* [no-shadow](no-shadow) diff --git a/docs/src/rules/no-nested-ternary.md b/docs/src/rules/no-nested-ternary.md index a9194ff3064..c1906cb1677 100644 --- a/docs/src/rules/no-nested-ternary.md +++ b/docs/src/rules/no-nested-ternary.md @@ -3,6 +3,9 @@ title: no-nested-ternary layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-nested-ternary.md rule_type: suggestion +related_rules: +- no-ternary +- no-unneeded-ternary --- Disallows nested ternary expressions. @@ -44,8 +47,3 @@ if (foo) { thing = foobar; } ``` - -## Related Rules - -* [no-ternary](no-ternary) -* [no-unneeded-ternary](no-unneeded-ternary) diff --git a/docs/src/rules/no-new-object.md b/docs/src/rules/no-new-object.md index 96533e5f03d..9655b13bbdb 100644 --- a/docs/src/rules/no-new-object.md +++ b/docs/src/rules/no-new-object.md @@ -3,6 +3,9 @@ title: no-new-object layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new-object.md rule_type: suggestion +related_rules: +- no-array-constructor +- no-new-wrappers --- Disallows `new` operators with the `Object` object. @@ -53,8 +56,3 @@ new Object(); ## When Not To Use It If you wish to allow the use of the `Object` constructor, you can safely turn this rule off. - -## Related Rules - -* [no-array-constructor](no-array-constructor) -* [no-new-wrappers](no-new-wrappers) diff --git a/docs/src/rules/no-new-symbol.md b/docs/src/rules/no-new-symbol.md index 06e965d5d4e..461cdc8f054 100644 --- a/docs/src/rules/no-new-symbol.md +++ b/docs/src/rules/no-new-symbol.md @@ -3,6 +3,8 @@ title: no-new-symbol layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new-symbol.md rule_type: problem +further_reading: +- https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects --- @@ -50,7 +52,3 @@ function bar(Symbol) { ## When Not To Use It This rule should not be used in ES3/5 environments. - -## Further Reading - -* [Symbol Objects specification](https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects) diff --git a/docs/src/rules/no-new-wrappers.md b/docs/src/rules/no-new-wrappers.md index 91f2d1821dd..174d27d9c02 100644 --- a/docs/src/rules/no-new-wrappers.md +++ b/docs/src/rules/no-new-wrappers.md @@ -3,6 +3,11 @@ title: no-new-wrappers layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new-wrappers.md rule_type: suggestion +related_rules: +- no-array-constructor +- no-new-object +further_reading: +- https://www.inkling.com/read/javascript-definitive-guide-david-flanagan-6th/chapter-3/wrapper-objects --- Disallows `new` operators with the `String`, `Number`, and `Boolean` objects. @@ -74,12 +79,3 @@ var object = new MyString(); ## When Not To Use It If you want to allow the use of primitive wrapper objects, then you can safely disable this rule. - -## Related Rules - -* [no-array-constructor](no-array-constructor) -* [no-new-object](no-new-object) - -## Further Reading - -* [Wrapper objects](https://www.inkling.com/read/javascript-definitive-guide-david-flanagan-6th/chapter-3/wrapper-objects) diff --git a/docs/src/rules/no-nonoctal-decimal-escape.md b/docs/src/rules/no-nonoctal-decimal-escape.md index 22b08a254c9..9fb530a7f0d 100644 --- a/docs/src/rules/no-nonoctal-decimal-escape.md +++ b/docs/src/rules/no-nonoctal-decimal-escape.md @@ -3,6 +3,10 @@ title: no-nonoctal-decimal-escape layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-nonoctal-decimal-escape.md rule_type: suggestion +related_rules: +- no-octal-escape +further_reading: +- https://tc39.es/ecma262/#prod-annexB-NonOctalDecimalEscapeSequence --- @@ -63,11 +67,3 @@ var baz = "Don't use \\8 and \\9 escapes."; var quux = "\0\u0038"; ``` - -## Related Rules - -* [no-octal-escape](no-octal-escape) - -## Further Reading - -* [NonOctalDecimalEscapeSequence](https://tc39.es/ecma262/#prod-annexB-NonOctalDecimalEscapeSequence) in ECMAScript specification diff --git a/docs/src/rules/no-obj-calls.md b/docs/src/rules/no-obj-calls.md index f8a3941037a..cd5bb376afc 100644 --- a/docs/src/rules/no-obj-calls.md +++ b/docs/src/rules/no-obj-calls.md @@ -3,6 +3,8 @@ title: no-obj-calls layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-obj-calls.md rule_type: problem +further_reading: +- https://es5.github.io/#x15.8 --- @@ -68,7 +70,3 @@ var value = Reflect.get({ x: 1, y: 2 }, "x"); var first = Atomics.load(foo, 0); ``` - -## Further Reading - -* [The Math Object](https://es5.github.io/#x15.8) diff --git a/docs/src/rules/no-param-reassign.md b/docs/src/rules/no-param-reassign.md index 08200d83828..8ee3eb57337 100644 --- a/docs/src/rules/no-param-reassign.md +++ b/docs/src/rules/no-param-reassign.md @@ -3,6 +3,8 @@ title: no-param-reassign layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-param-reassign.md rule_type: suggestion +further_reading: +- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/ --- Disallows reassignment of function parameters. @@ -160,7 +162,3 @@ function foo(barBaz) { ## When Not To Use It If you want to allow assignment to function parameters, then you can safely disable this rule. - -## Further Reading - -* [JavaScript: Don’t Reassign Your Function Arguments](https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/) diff --git a/docs/src/rules/no-process-env.md b/docs/src/rules/no-process-env.md index 9bd325cf218..f9223d46dc0 100644 --- a/docs/src/rules/no-process-env.md +++ b/docs/src/rules/no-process-env.md @@ -3,6 +3,9 @@ title: no-process-env layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-process-env.md rule_type: suggestion +further_reading: +- https://stackoverflow.com/questions/5869216/how-to-store-node-js-deployment-settings-configuration-files +- https://blog.benhall.me.uk/2012/02/storing-application-config-data-in/ --- Disallows the use of `process.env`. @@ -40,8 +43,3 @@ if(config.env === "development") { ## When Not To Use It If you prefer to use `process.env` throughout your project to retrieve values from environment variables, then you can safely disable this rule. - -## Further Reading - -* [How to store Node.js deployment settings/configuration files? - Stack Overflow](https://stackoverflow.com/questions/5869216/how-to-store-node-js-deployment-settings-configuration-files) -* [Storing Node.js application config data - Ben Hall's blog](https://blog.benhall.me.uk/2012/02/storing-application-config-data-in/) diff --git a/docs/src/rules/no-promise-executor-return.md b/docs/src/rules/no-promise-executor-return.md index d57988512ae..1a694603d69 100644 --- a/docs/src/rules/no-promise-executor-return.md +++ b/docs/src/rules/no-promise-executor-return.md @@ -3,6 +3,10 @@ title: no-promise-executor-return layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-promise-executor-return.md rule_type: problem +related_rules: +- no-async-promise-executor +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise --- Disallows returning values from Promise executor functions. @@ -93,11 +97,3 @@ new Promise((resolve, reject) => { Promise.resolve(1); ``` - -## Related Rules - -* [no-async-promise-executor](no-async-promise-executor) - -## Further Reading - -* [MDN Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) diff --git a/docs/src/rules/no-proto.md b/docs/src/rules/no-proto.md index 77063d3112f..07ee394123f 100644 --- a/docs/src/rules/no-proto.md +++ b/docs/src/rules/no-proto.md @@ -3,6 +3,8 @@ title: no-proto layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-proto.md rule_type: suggestion +further_reading: +- https://johnresig.com/blog/objectgetprototypeof/ --- Disallows the use of the `__proto__` property. @@ -43,7 +45,3 @@ var c = { __proto__: a }; You might want to turn this rule off if you need to support legacy browsers which implement the `__proto__` property but not `Object.getPrototypeOf` or `Object.setPrototypeOf`. - -## Further Reading - -* [Object.getPrototypeOf](http://ejohn.org/blog/objectgetprototypeof/) diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index e0e2e75634e..6a5de912090 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -3,6 +3,8 @@ title: no-redeclare layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-redeclare.md rule_type: suggestion +related_rules: +- no-shadow --- @@ -87,7 +89,3 @@ var top = 0; The `browser` environment has many built-in global variables (for example, `top`). Some of built-in global variables cannot be redeclared. Note that when using the `node` or `commonjs` environments (or `ecmaFeatures.globalReturn`, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [`no-shadow`](no-shadow) rule with the `"builtinGlobals"` option should be used. - -## Related Rules - -* [no-shadow](no-shadow) diff --git a/docs/src/rules/no-regex-spaces.md b/docs/src/rules/no-regex-spaces.md index 2edf2e586f4..8bb2133031b 100644 --- a/docs/src/rules/no-regex-spaces.md +++ b/docs/src/rules/no-regex-spaces.md @@ -3,6 +3,9 @@ title: no-regex-spaces layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-regex-spaces.md rule_type: suggestion +related_rules: +- no-div-regex +- no-control-regex --- @@ -50,8 +53,3 @@ var re = new RegExp("foo {3}bar"); ## When Not To Use It If you want to allow multiple spaces in a regular expression, then you can safely turn this rule off. - -## Related Rules - -* [no-div-regex](no-div-regex) -* [no-control-regex](no-control-regex) diff --git a/docs/src/rules/no-reserved-keys.md b/docs/src/rules/no-reserved-keys.md index 5644d0042cd..8608eeb6060 100644 --- a/docs/src/rules/no-reserved-keys.md +++ b/docs/src/rules/no-reserved-keys.md @@ -3,6 +3,8 @@ title: no-reserved-keys layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-reserved-keys.md +further_reading: +- https://kangax.github.io/compat-table/es5/#Reserved_words_as_property_names --- Disallows unquoted reserved words as property names in object literals. @@ -54,7 +56,3 @@ var values = { ## When Not To Use It If your code is only going to be executed in an ECMAScript 5 or higher environment, then you can safely leave this rule off. - -## Further Reading - -* [Reserved words as property names](https://kangax.github.io/compat-table/es5/#Reserved_words_as_property_names) diff --git a/docs/src/rules/no-restricted-globals.md b/docs/src/rules/no-restricted-globals.md index 5164b9f15c7..4e9de8a0efd 100644 --- a/docs/src/rules/no-restricted-globals.md +++ b/docs/src/rules/no-restricted-globals.md @@ -3,6 +3,9 @@ title: no-restricted-globals layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-globals.md rule_type: suggestion +related_rules: +- no-restricted-properties +- no-restricted-syntax --- Disallows specific global variables. @@ -90,8 +93,3 @@ function onClick() { console.log(event); // Unexpected global variable 'event'. Use local parameter instead. } ``` - -## Related Rules - -* [no-restricted-properties](no-restricted-properties) -* [no-restricted-syntax](no-restricted-syntax) diff --git a/docs/src/rules/no-restricted-properties.md b/docs/src/rules/no-restricted-properties.md index a2781c9d773..fbb925b5df1 100644 --- a/docs/src/rules/no-restricted-properties.md +++ b/docs/src/rules/no-restricted-properties.md @@ -3,6 +3,9 @@ title: no-restricted-properties layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-properties.md rule_type: suggestion +related_rules: +- no-restricted-globals +- no-restricted-syntax --- Disallows certain object properties. @@ -124,8 +127,3 @@ require('foo'); ## When Not To Use It If you don't have any object/property combinations to restrict, you should not use this rule. - -## Related Rules - -* [no-restricted-globals](no-restricted-globals) -* [no-restricted-syntax](no-restricted-syntax) diff --git a/docs/src/rules/no-restricted-syntax.md b/docs/src/rules/no-restricted-syntax.md index b94d47c30ed..e0a71e17b6b 100644 --- a/docs/src/rules/no-restricted-syntax.md +++ b/docs/src/rules/no-restricted-syntax.md @@ -3,6 +3,11 @@ title: no-restricted-syntax layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-syntax.md rule_type: suggestion +related_rules: +- no-alert +- no-console +- no-debugger +- no-restricted-properties --- Disallows specified syntax. @@ -82,10 +87,3 @@ foo instanceof bar; ## When Not To Use It If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule. - -## Related Rules - -* [no-alert](no-alert) -* [no-console](no-console) -* [no-debugger](no-debugger) -* [no-restricted-properties](no-restricted-properties) diff --git a/docs/src/rules/no-return-await.md b/docs/src/rules/no-return-await.md index 2ec7bbe02f6..a6a411f240c 100644 --- a/docs/src/rules/no-return-await.md +++ b/docs/src/rules/no-return-await.md @@ -3,6 +3,9 @@ title: no-return-await layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-return-await.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function +- https://jakearchibald.com/2017/await-vs-return-vs-return-await/ --- Disallows unnecessary `return await`. @@ -60,9 +63,3 @@ There are a few reasons you might want to turn this rule off: * If you want to use `await` to denote a value that is a thenable * If you do not want the performance benefit of avoiding `return await` * If you want the functions to show up in stack traces (useful for debugging purposes) - -## Further Reading - -[`async function` on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) - -[`await vs return vs return await` by Jake Archibald](https://jakearchibald.com/2017/await-vs-return-vs-return-await/) diff --git a/docs/src/rules/no-script-url.md b/docs/src/rules/no-script-url.md index 582233cc0f8..80ce5f7a6ff 100644 --- a/docs/src/rules/no-script-url.md +++ b/docs/src/rules/no-script-url.md @@ -3,6 +3,8 @@ title: no-script-url layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-script-url.md rule_type: suggestion +further_reading: +- https://stackoverflow.com/questions/13497971/what-is-the-matter-with-script-targeted-urls --- Disallows `javascript:` URLs. @@ -24,7 +26,3 @@ location.href = `javascript:void(0)`; ## Compatibility * **JSHint**: This rule corresponds to `scripturl` rule of JSHint. - -## Further Reading - -* [What is the matter with script-targeted URLs?](https://stackoverflow.com/questions/13497971/what-is-the-matter-with-script-targeted-urls) diff --git a/docs/src/rules/no-setter-return.md b/docs/src/rules/no-setter-return.md index 527411134b6..b2dd68ed4ca 100644 --- a/docs/src/rules/no-setter-return.md +++ b/docs/src/rules/no-setter-return.md @@ -3,6 +3,10 @@ title: no-setter-return layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-setter-return.md rule_type: problem +related_rules: +- getter-return +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set --- @@ -100,11 +104,3 @@ Object.defineProperty(foo, "bar", { } }); ``` - -## Related Rules - -* [getter-return](getter-return) - -## Further Reading - -* [MDN setter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) diff --git a/docs/src/rules/no-shadow-restricted-names.md b/docs/src/rules/no-shadow-restricted-names.md index e1c13853ac4..95a8553ad34 100644 --- a/docs/src/rules/no-shadow-restricted-names.md +++ b/docs/src/rules/no-shadow-restricted-names.md @@ -3,6 +3,11 @@ title: no-shadow-restricted-names layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-shadow-restricted-names.md rule_type: suggestion +related_rules: +- no-shadow +further_reading: +- https://es5.github.io/#x15.1.1 +- https://es5.github.io/#C --- @@ -45,12 +50,3 @@ function f(a, b){} // Exception: `undefined` may be shadowed if the variable is never assigned a value. var undefined; ``` - -## Related Rules - -* [no-shadow](no-shadow) - -## Further Reading - -* [Annotated ES5 - §15.1.1](https://es5.github.io/#x15.1.1) -* [Annotated ES5 - Annex C](https://es5.github.io/#C) diff --git a/docs/src/rules/no-shadow.md b/docs/src/rules/no-shadow.md index de033113bfe..fee157c5435 100644 --- a/docs/src/rules/no-shadow.md +++ b/docs/src/rules/no-shadow.md @@ -3,6 +3,10 @@ title: no-shadow layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-shadow.md rule_type: suggestion +related_rules: +- no-shadow-restricted-names +further_reading: +- https://en.wikipedia.org/wiki/Variable_shadowing --- Disallows variable declarations from shadowing variables declared in the outer scope. @@ -198,11 +202,3 @@ var y = (y => y)() ``` The rationale for callback functions is the assumption that they will be called during the initialization, so that at the time when the shadowing variable will be used, the shadowed variable has not yet been initialized. - -## Related Rules - -* [no-shadow-restricted-names](no-shadow-restricted-names) - -## Further Reading - -* [Variable Shadowing](https://en.wikipedia.org/wiki/Variable_shadowing) diff --git a/docs/src/rules/no-space-before-semi.md b/docs/src/rules/no-space-before-semi.md index 60c2116fd8e..627003d3cda 100644 --- a/docs/src/rules/no-space-before-semi.md +++ b/docs/src/rules/no-space-before-semi.md @@ -3,6 +3,9 @@ title: no-space-before-semi layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-space-before-semi.md +related_rules: +- semi +- no-extra-semi --- Disallows spaces before semicolons. @@ -43,8 +46,3 @@ Examples of **correct** code for this rule: var foo = "bar"; ``` - -## Related Rules - -* [semi](semi) -* [no-extra-semi](no-extra-semi) diff --git a/docs/src/rules/no-sparse-arrays.md b/docs/src/rules/no-sparse-arrays.md index 4340619cb8d..df061c50af5 100644 --- a/docs/src/rules/no-sparse-arrays.md +++ b/docs/src/rules/no-sparse-arrays.md @@ -3,6 +3,8 @@ title: no-sparse-arrays layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-sparse-arrays.md rule_type: problem +further_reading: +- https://www.nczonline.net/blog/2007/09/09/inconsistent-array-literals/ --- @@ -53,7 +55,3 @@ var colors = [ "red", "blue", ]; ## When Not To Use It If you want to use sparse arrays, then it is safe to disable this rule. - -## Further Reading - -* [Inconsistent array literals](https://www.nczonline.net/blog/2007/09/09/inconsistent-array-literals/) diff --git a/docs/src/rules/no-undef-init.md b/docs/src/rules/no-undef-init.md index 830d219e8b1..84908ace717 100644 --- a/docs/src/rules/no-undef-init.md +++ b/docs/src/rules/no-undef-init.md @@ -3,6 +3,9 @@ title: no-undef-init layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-undef-init.md rule_type: suggestion +related_rules: +- no-undefined +- no-void --- @@ -129,8 +132,3 @@ for (i = 0; i < 10; i++) { x = i; } ``` - -## Related Rules - -* [no-undefined](no-undefined) -* [no-void](no-void) diff --git a/docs/src/rules/no-undef.md b/docs/src/rules/no-undef.md index f3f99677911..6f153b94de8 100644 --- a/docs/src/rules/no-undef.md +++ b/docs/src/rules/no-undef.md @@ -3,6 +3,9 @@ title: no-undef layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-undef.md rule_type: problem +related_rules: +- no-global-assign +- no-redeclare --- @@ -110,11 +113,6 @@ module.exports = function() { If explicit declaration of global variables is not to your taste. -## Related Rules - -* [no-global-assign](no-global-assign) -* [no-redeclare](no-redeclare) - ## Compatibility This rule provides compatibility with treatment of global variables in [JSHint](http://jshint.com/) and [JSLint](http://www.jslint.com). diff --git a/docs/src/rules/no-undefined.md b/docs/src/rules/no-undefined.md index 54da12de5ce..9398312a05a 100644 --- a/docs/src/rules/no-undefined.md +++ b/docs/src/rules/no-undefined.md @@ -3,6 +3,15 @@ title: no-undefined layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-undefined.md rule_type: suggestion +related_rules: +- no-undef-init +- no-void +- no-shadow-restricted-names +- no-global-assign +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined +- https://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-preventing-referenceerrors/ +- https://es5.github.io/#x15.1.1.3 --- Disallows the use of `undefined` as an identifier. @@ -70,16 +79,3 @@ global.undefined = "foo"; ## When Not To Use It If you want to allow the use of `undefined` in your code, then you can safely turn this rule off. - -## Related Rules - -* [no-undef-init](no-undef-init) -* [no-void](no-void) -* [no-shadow-restricted-names](no-shadow-restricted-names) -* [no-global-assign](no-global-assign) - -## Further Reading - -* [undefined - JavaScript \| MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) -* [Understanding JavaScript’s ‘undefined’ \| JavaScript, JavaScript...](https://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-preventing-referenceerrors/) -* [ECMA262 edition 5.1 §15.1.1.3: undefined](https://es5.github.io/#x15.1.1.3) diff --git a/docs/src/rules/no-unexpected-multiline.md b/docs/src/rules/no-unexpected-multiline.md index 18a0b828a38..cae4d74500d 100644 --- a/docs/src/rules/no-unexpected-multiline.md +++ b/docs/src/rules/no-unexpected-multiline.md @@ -3,6 +3,10 @@ title: no-unexpected-multiline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unexpected-multiline.md rule_type: problem +related_rules: +- func-call-spacing +- semi +- space-unary-ops --- @@ -75,9 +79,3 @@ tag `hello` You can turn this rule off if you are confident that you will not accidentally introduce code like this. Note that the patterns considered problems are **not** flagged by the [semi](semi) rule. - -## Related Rules - -* [func-call-spacing](func-call-spacing) -* [semi](semi) -* [space-unary-ops](space-unary-ops) diff --git a/docs/src/rules/no-unneeded-ternary.md b/docs/src/rules/no-unneeded-ternary.md index e1550e9f252..a9a8b540f62 100644 --- a/docs/src/rules/no-unneeded-ternary.md +++ b/docs/src/rules/no-unneeded-ternary.md @@ -3,6 +3,9 @@ title: no-unneeded-ternary layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unneeded-ternary.md rule_type: suggestion +related_rules: +- no-ternary +- no-nested-ternary --- @@ -93,8 +96,3 @@ Note that `defaultAssignment: false` still allows expressions of the form `x ? e ## When Not To Use It You can turn this rule off if you are not concerned with unnecessary complexity in conditional expressions. - -## Related Rules - -* [no-ternary](no-ternary) -* [no-nested-ternary](no-nested-ternary) diff --git a/docs/src/rules/no-unreachable-loop.md b/docs/src/rules/no-unreachable-loop.md index c777d4807dd..8cdd64ee353 100644 --- a/docs/src/rules/no-unreachable-loop.md +++ b/docs/src/rules/no-unreachable-loop.md @@ -3,6 +3,11 @@ title: no-unreachable-loop layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unreachable-loop.md rule_type: problem +related_rules: +- no-unreachable +- no-constant-condition +- no-unmodified-loop-condition +- for-direction --- Disallows loops with a body that allows only one iteration. @@ -188,10 +193,3 @@ for (let i = 0; i < 10; i++) { } } ``` - -## Related Rules - -* [no-unreachable](no-unreachable) -* [no-constant-condition](no-constant-condition) -* [no-unmodified-loop-condition](no-unmodified-loop-condition) -* [for-direction](for-direction) diff --git a/docs/src/rules/no-unused-labels.md b/docs/src/rules/no-unused-labels.md index ecfeb3c36ac..6bdc389b4f0 100644 --- a/docs/src/rules/no-unused-labels.md +++ b/docs/src/rules/no-unused-labels.md @@ -3,6 +3,10 @@ title: no-unused-labels layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unused-labels.md rule_type: suggestion +related_rules: +- no-extra-label +- no-labels +- no-label-var --- @@ -71,9 +75,3 @@ for (let i = 0; i < 10; ++i) { ## When Not To Use It If you don't want to be notified about unused labels, then it's safe to disable this rule. - -## Related Rules - -* [no-extra-label](./no-extra-label) -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) diff --git a/docs/src/rules/no-useless-backreference.md b/docs/src/rules/no-useless-backreference.md index 4d31b3b31e3..615287b12bd 100644 --- a/docs/src/rules/no-useless-backreference.md +++ b/docs/src/rules/no-useless-backreference.md @@ -3,6 +3,12 @@ title: no-useless-backreference layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-backreference.md rule_type: problem +related_rules: +- no-control-regex +- no-empty-character-class +- no-invalid-regexp +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions --- @@ -127,13 +133,3 @@ Examples of additional **correct** code for this rule: /^\1$/.test("\x01"); // true. Since the group 1 doesn't exist, \1 is treated as an octal escape sequence. /^(a)\1\2$/.test("aa\x02"); // true. In this case, \1 is a backreference, \2 is an octal escape sequence. ``` - -## Related Rules - -* [no-control-regex](no-control-regex) -* [no-empty-character-class](no-empty-character-class) -* [no-invalid-regexp](no-invalid-regexp) - -## Further Reading - -* [MDN: Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) diff --git a/docs/src/rules/no-useless-call.md b/docs/src/rules/no-useless-call.md index 36765cecba4..053c2744ea4 100644 --- a/docs/src/rules/no-useless-call.md +++ b/docs/src/rules/no-useless-call.md @@ -3,6 +3,8 @@ title: no-useless-call layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-call.md rule_type: suggestion +related_rules: +- prefer-spread --- Disallows unnecessary `.call()` and `.apply()`. @@ -74,7 +76,3 @@ a[++i].foo.call(a[i], 1, 2, 3); ## When Not To Use It If you don't want to be notified about unnecessary `.call()` and `.apply()`, you can safely disable this rule. - -## Related Rules - -* [prefer-spread](prefer-spread) diff --git a/docs/src/rules/no-useless-rename.md b/docs/src/rules/no-useless-rename.md index 58f127c9625..ddaafdd0cb6 100644 --- a/docs/src/rules/no-useless-rename.md +++ b/docs/src/rules/no-useless-rename.md @@ -3,6 +3,8 @@ title: no-useless-rename layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-rename.md rule_type: suggestion +related_rules: +- object-shorthand --- @@ -130,10 +132,6 @@ function foo({ bar: bar }) {} You can safely disable this rule if you do not care about redundantly renaming import, export, and destructuring assignments. -## Related Rules - -* [`object-shorthand`](object-shorthand) which can enforce this behavior for properties in object literals. - ## Compatibility * **JSCS**: [disallowIdenticalDestructuringNames](https://jscs-dev.github.io/rule/disallowIdenticalDestructuringNames) diff --git a/docs/src/rules/no-void.md b/docs/src/rules/no-void.md index 1ff4709267d..d37beda429b 100644 --- a/docs/src/rules/no-void.md +++ b/docs/src/rules/no-void.md @@ -3,6 +3,12 @@ title: no-void layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-void.md rule_type: suggestion +related_rules: +- no-undef-init +- no-undefined +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void +- https://oreilly.com/javascript/excerpts/javascript-good-parts/bad-parts.html --- Disallows use of the void operator. @@ -102,13 +108,3 @@ void someFunction(); ## When Not To Use It If you intentionally use the `void` operator then you can disable this rule. - -## Related Rules - -* [no-undef-init](no-undef-init) -* [no-undefined](no-undefined) - -## Further Reading - -* [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void) -* [Bad Parts: Appendix B - JavaScript: The Good Parts by Douglas Crockford](https://oreilly.com/javascript/excerpts/javascript-good-parts/bad-parts.html) diff --git a/docs/src/rules/no-with.md b/docs/src/rules/no-with.md index b7fa4d7cb6f..4e479dee010 100644 --- a/docs/src/rules/no-with.md +++ b/docs/src/rules/no-with.md @@ -3,6 +3,8 @@ title: no-with layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-with.md rule_type: suggestion +further_reading: +- https://web.archive.org/web/20200717110117/https://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/ --- @@ -39,7 +41,3 @@ const r = ({x, y}) => Math.sqrt(x * x + y * y); ## When Not To Use It If you intentionally use `with` statements then you can disable this rule. - -## Further Reading - -* [with Statement Considered Harmful](https://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/) diff --git a/docs/src/rules/nonblock-statement-body-position.md b/docs/src/rules/nonblock-statement-body-position.md index 7ae31b5c43f..05b2a40ce9a 100644 --- a/docs/src/rules/nonblock-statement-body-position.md +++ b/docs/src/rules/nonblock-statement-body-position.md @@ -3,6 +3,8 @@ title: nonblock-statement-body-position layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/nonblock-statement-body-position.md rule_type: layout +further_reading: +- https://jscs-dev.github.io/rule/requireNewlineBeforeSingleStatementsInIf --- @@ -161,7 +163,3 @@ while (foo) ## When Not To Use It If you're not concerned about consistent locations of single-line statements, you should not turn on this rule. You can also disable this rule if you're using the `"all"` option for the [`curly`](/docs/rules/curly) rule, because this will disallow single-line statements entirely. - -## Further Reading - -* JSCS: [requireNewlineBeforeSingleStatementsInIf](https://jscs-dev.github.io/rule/requireNewlineBeforeSingleStatementsInIf) diff --git a/docs/src/rules/object-curly-newline.md b/docs/src/rules/object-curly-newline.md index 156a39a5405..eadbc77680f 100644 --- a/docs/src/rules/object-curly-newline.md +++ b/docs/src/rules/object-curly-newline.md @@ -3,6 +3,11 @@ title: object-curly-newline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/object-curly-newline.md rule_type: layout +related_rules: +- comma-spacing +- key-spacing +- object-curly-spacing +- object-property-newline --- @@ -543,13 +548,6 @@ export { foo as f, bar } from 'foo-bar'; If you don't want to enforce consistent line breaks after opening and before closing braces, then it's safe to disable this rule. -## Related Rules - -* [comma-spacing](comma-spacing) -* [key-spacing](key-spacing) -* [object-curly-spacing](object-curly-spacing) -* [object-property-newline](object-property-newline) - ## Compatibility * **JSCS**: [requirePaddingNewLinesInObjects](https://jscs-dev.github.io/rule/requirePaddingNewLinesInObjects) diff --git a/docs/src/rules/object-curly-spacing.md b/docs/src/rules/object-curly-spacing.md index bf2dceeb57f..42f296c2f2c 100644 --- a/docs/src/rules/object-curly-spacing.md +++ b/docs/src/rules/object-curly-spacing.md @@ -3,6 +3,11 @@ title: object-curly-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/object-curly-spacing.md rule_type: layout +related_rules: +- array-bracket-spacing +- comma-spacing +- computed-property-spacing +- space-in-parens --- @@ -156,10 +161,3 @@ var obj = { "foo": { "baz": 1, "bar": 2 }}; ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing between curly braces. - -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [comma-spacing](comma-spacing) -* [computed-property-spacing](computed-property-spacing) -* [space-in-parens](space-in-parens) diff --git a/docs/src/rules/object-property-newline.md b/docs/src/rules/object-property-newline.md index 43bc8bd8ec7..5e0985907ee 100644 --- a/docs/src/rules/object-property-newline.md +++ b/docs/src/rules/object-property-newline.md @@ -3,6 +3,11 @@ title: object-property-newline layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/object-property-newline.md rule_type: layout +related_rules: +- brace-style +- comma-dangle +- key-spacing +- object-curly-spacing --- @@ -267,13 +272,6 @@ const obj3 = { You can turn this rule off if you want to decide, case-by-case, whether to place property specifications on separate lines. -## Related Rules - -* [brace-style](brace-style) -* [comma-dangle](comma-dangle) -* [key-spacing](key-spacing) -* [object-curly-spacing](object-curly-spacing) - ## Compatibility * **JSCS**: This rule provides partial compatibility with [requireObjectKeysOnNewLine](https://jscs-dev.github.io/rule/requireObjectKeysOnNewLine). diff --git a/docs/src/rules/object-shorthand.md b/docs/src/rules/object-shorthand.md index 24e3dbda9fb..7ff7c2df6f7 100644 --- a/docs/src/rules/object-shorthand.md +++ b/docs/src/rules/object-shorthand.md @@ -3,6 +3,10 @@ title: object-shorthand layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/object-shorthand.md rule_type: suggestion +related_rules: +- no-useless-rename +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer --- @@ -250,11 +254,3 @@ var foo = { Anyone not yet in an ES6 environment would not want to apply this rule. Others may find the terseness of the shorthand syntax harder to read and may not want to encourage it with this rule. - -## Related Rules - -* [`no-useless-rename`](no-useless-rename) which disallows renaming import, export, and destructured assignments to the same name. - -## Further Reading - -[Object initializer - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer) diff --git a/docs/src/rules/one-var-declaration-per-line.md b/docs/src/rules/one-var-declaration-per-line.md index bb6e0d991a0..0a04ec25fcc 100644 --- a/docs/src/rules/one-var-declaration-per-line.md +++ b/docs/src/rules/one-var-declaration-per-line.md @@ -3,6 +3,8 @@ title: one-var-declaration-per-line layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/one-var-declaration-per-line.md rule_type: suggestion +related_rules: +- one-var --- @@ -92,7 +94,3 @@ var a, let a, b = 0; ``` - -## Related Rules - -* [one-var](one-var) diff --git a/docs/src/rules/operator-linebreak.md b/docs/src/rules/operator-linebreak.md index 085bc352147..34efbc6fcb3 100644 --- a/docs/src/rules/operator-linebreak.md +++ b/docs/src/rules/operator-linebreak.md @@ -3,6 +3,8 @@ title: operator-linebreak layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/operator-linebreak.md rule_type: layout +related_rules: +- comma-style --- @@ -339,7 +341,3 @@ answer = everything ## When Not To Use It If your project will not be using a common operator line break style, turn this rule off. - -## Related Rules - -* [comma-style](comma-style) diff --git a/docs/src/rules/padded-blocks.md b/docs/src/rules/padded-blocks.md index 731cf49cf49..7667c0a02df 100644 --- a/docs/src/rules/padded-blocks.md +++ b/docs/src/rules/padded-blocks.md @@ -3,6 +3,9 @@ title: padded-blocks layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/padded-blocks.md rule_type: layout +related_rules: +- lines-between-class-members +- padding-line-between-statements --- @@ -482,8 +485,3 @@ if (a) { ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of padding within blocks. - -## Related Rules - -* [lines-between-class-members](lines-between-class-members) -* [padding-line-between-statements](padding-line-between-statements) diff --git a/docs/src/rules/prefer-arrow-callback.md b/docs/src/rules/prefer-arrow-callback.md index e4222dc098f..0d0dbd9477c 100644 --- a/docs/src/rules/prefer-arrow-callback.md +++ b/docs/src/rules/prefer-arrow-callback.md @@ -3,6 +3,8 @@ title: prefer-arrow-callback layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-arrow-callback.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions --- @@ -103,7 +105,3 @@ someArray.map(function(item) { return this.doSomething(item); }, someObject); * In environments that have not yet adopted ES6 language features (ES3/5). * In ES6+ environments that allow the use of function expressions when describing callbacks or function arguments. - -## Further Reading - -* [More on ES6 arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) diff --git a/docs/src/rules/prefer-const.md b/docs/src/rules/prefer-const.md index 7d652b35a40..7bf20de6904 100644 --- a/docs/src/rules/prefer-const.md +++ b/docs/src/rules/prefer-const.md @@ -3,6 +3,9 @@ title: prefer-const layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-const.md rule_type: suggestion +related_rules: +- no-var +- no-use-before-define --- @@ -222,8 +225,3 @@ function initialize() { ## When Not To Use It If you don't want to be notified about variables that are never reassigned after initial assignment, you can safely disable this rule. - -## Related Rules - -* [no-var](no-var) -* [no-use-before-define](no-use-before-define) diff --git a/docs/src/rules/prefer-destructuring.md b/docs/src/rules/prefer-destructuring.md index e32be78b48c..e49efb2b02c 100644 --- a/docs/src/rules/prefer-destructuring.md +++ b/docs/src/rules/prefer-destructuring.md @@ -3,6 +3,9 @@ title: prefer-destructuring layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-destructuring.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment +- https://2ality.com/2015/01/es6-destructuring.html --- @@ -187,10 +190,3 @@ var $ = require('jquery'); var foo = $('body')[0]; var [bar] = $('body'); // fails with a TypeError ``` - -## Further Reading - -If you want to learn more about destructuring, check out the links below: - -* [Destructuring Assignment (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) -* [Destructuring and parameter handling in ECMAScript 6 (2ality blog)](http://2ality.com/2015/01/es6-destructuring.html) diff --git a/docs/src/rules/prefer-exponentiation-operator.md b/docs/src/rules/prefer-exponentiation-operator.md index 72b24a574c5..08759f14fbe 100644 --- a/docs/src/rules/prefer-exponentiation-operator.md +++ b/docs/src/rules/prefer-exponentiation-operator.md @@ -3,6 +3,9 @@ title: prefer-exponentiation-operator layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-exponentiation-operator.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation +- https://bugs.chromium.org/p/v8/issues/detail?id=5848 --- @@ -48,8 +51,3 @@ let quux = (-1) ** n; ## When Not To Use It This rule should not be used unless ES2016 is supported in your codebase. - -## Further Reading - -* [MDN Arithmetic Operators - Exponentiation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation) -* [Issue 5848: Exponentiation operator ** has different results for numbers and variables from 50 upwards](https://bugs.chromium.org/p/v8/issues/detail?id=5848) diff --git a/docs/src/rules/prefer-named-capture-group.md b/docs/src/rules/prefer-named-capture-group.md index a947a05c2a3..59f9638940d 100644 --- a/docs/src/rules/prefer-named-capture-group.md +++ b/docs/src/rules/prefer-named-capture-group.md @@ -3,6 +3,8 @@ title: prefer-named-capture-group layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-named-capture-group.md rule_type: suggestion +related_rules: +- no-invalid-regexp --- Suggest using named capture group in regular expression. @@ -50,7 +52,3 @@ foo.exec('bar').groups.id; // Retrieve the group result. ## When Not To Use It If you are targeting ECMAScript 2017 and/or older environments, you should not use this rule, because this ECMAScript feature is only supported in ECMAScript 2018 and/or newer environments. - -## Related Rules - -* [no-invalid-regexp](./no-invalid-regexp) diff --git a/docs/src/rules/prefer-object-has-own.md b/docs/src/rules/prefer-object-has-own.md index 91fdc8e9541..3608bc6b3f2 100644 --- a/docs/src/rules/prefer-object-has-own.md +++ b/docs/src/rules/prefer-object-has-own.md @@ -3,6 +3,8 @@ title: prefer-object-has-own layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-object-has-own.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn --- @@ -56,7 +58,3 @@ const hasProperty = Object.hasOwn(object, property); ## When Not To Use It This rule should not be used unless ES2022 is supported in your codebase. - -## Further Reading - -* [Object.hasOwn()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn) diff --git a/docs/src/rules/prefer-promise-reject-errors.md b/docs/src/rules/prefer-promise-reject-errors.md index 5c5c566997c..6c83c525dc7 100644 --- a/docs/src/rules/prefer-promise-reject-errors.md +++ b/docs/src/rules/prefer-promise-reject-errors.md @@ -3,6 +3,10 @@ title: prefer-promise-reject-errors layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-promise-reject-errors.md rule_type: suggestion +related_rules: +- no-throw-literal +further_reading: +- http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-rejected-with-a-non-error --- Requires using Error objects as Promise rejection reasons. @@ -78,11 +82,3 @@ To avoid conflicts between rules, this rule does not report non-error values use ## When Not To Use It If you're using custom non-error values as Promise rejection reasons, you can turn off this rule. - -## Related Rules - -* [`no-throw-literal`](no-throw-literal) - -## Further Reading - -* [Warning: a promise was rejected with a non-error](http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-rejected-with-a-non-error) diff --git a/docs/src/rules/prefer-reflect.md b/docs/src/rules/prefer-reflect.md index 2c25ddd8ef9..59063fd50bf 100644 --- a/docs/src/rules/prefer-reflect.md +++ b/docs/src/rules/prefer-reflect.md @@ -3,6 +3,10 @@ title: prefer-reflect layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-reflect.md rule_type: suggestion +related_rules: +- no-useless-call +- prefer-spread +- no-delete-var --- Suggest using Reflect methods where applicable. @@ -338,9 +342,3 @@ Reflect.deleteProperty(foo, 'bar'); This rule should not be used in ES3/5 environments. In ES2015 (ES6) or later, if you don't want to be notified about places where Reflect could be used, you can safely disable this rule. - -## Related Rules - -* [no-useless-call](no-useless-call) -* [prefer-spread](prefer-spread) -* [no-delete-var](no-delete-var) diff --git a/docs/src/rules/prefer-regex-literals.md b/docs/src/rules/prefer-regex-literals.md index 7ca6b3275f0..c8821095299 100644 --- a/docs/src/rules/prefer-regex-literals.md +++ b/docs/src/rules/prefer-regex-literals.md @@ -3,6 +3,9 @@ title: prefer-regex-literals layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-regex-literals.md rule_type: suggestion +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp --- @@ -128,8 +131,3 @@ Examples of `correct` code for `{ "disallowRedundantWrapping": true }` new RegExp(/abc/, flags); ``` - -## Further Reading - -* [MDN: Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) -* [MDN: RegExp Constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) diff --git a/docs/src/rules/prefer-rest-params.md b/docs/src/rules/prefer-rest-params.md index 5eb69ba9622..3583f8371b8 100644 --- a/docs/src/rules/prefer-rest-params.md +++ b/docs/src/rules/prefer-rest-params.md @@ -3,6 +3,8 @@ title: prefer-rest-params layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-rest-params.md rule_type: suggestion +related_rules: +- prefer-spread --- Suggests using rest parameters instead of `arguments`. @@ -66,7 +68,3 @@ function foo() { This rule should not be used in ES3/5 environments. In ES2015 (ES6) or later, if you don't want to be notified about `arguments` variables, then it's safe to disable this rule. - -## Related Rules - -* [prefer-spread](prefer-spread) diff --git a/docs/src/rules/prefer-spread.md b/docs/src/rules/prefer-spread.md index 08c0eae7308..f3f1fedce56 100644 --- a/docs/src/rules/prefer-spread.md +++ b/docs/src/rules/prefer-spread.md @@ -3,6 +3,8 @@ title: prefer-spread layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-spread.md rule_type: suggestion +related_rules: +- no-useless-call --- Suggests using spread syntax instead of `.apply()`. @@ -79,7 +81,3 @@ a[++i].foo.apply(a[i], args); This rule should not be used in ES3/5 environments. In ES2015 (ES6) or later, if you don't want to be notified about `Function.prototype.apply()` callings, you can safely disable this rule. - -## Related Rules - -* [no-useless-call](no-useless-call) diff --git a/docs/src/rules/prefer-template.md b/docs/src/rules/prefer-template.md index f2045ee2692..c47f81f1ba9 100644 --- a/docs/src/rules/prefer-template.md +++ b/docs/src/rules/prefer-template.md @@ -3,6 +3,9 @@ title: prefer-template layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-template.md rule_type: suggestion +related_rules: +- no-useless-concat +- quotes --- @@ -55,8 +58,3 @@ var str = "Hello, " + "World!"; This rule should not be used in ES3/5 environments. In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule. - -## Related Rules - -* [no-useless-concat](no-useless-concat) -* [quotes](quotes) diff --git a/docs/src/rules/quote-props.md b/docs/src/rules/quote-props.md index 6761bc0a3f1..796278f980f 100644 --- a/docs/src/rules/quote-props.md +++ b/docs/src/rules/quote-props.md @@ -3,6 +3,9 @@ title: quote-props layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/quote-props.md rule_type: suggestion +further_reading: +- https://kangax.github.io/compat-table/es5/#Reserved_words_as_property_names +- https://mathiasbynens.be/notes/javascript-properties --- @@ -270,8 +273,3 @@ var x = { ## When Not To Use It If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off. - -## Further Reading - -* [Reserved words as property names](https://kangax.github.io/compat-table/es5/#Reserved_words_as_property_names) -* [Unquoted property names / object keys in JavaScript](https://mathiasbynens.be/notes/javascript-properties) diff --git a/docs/src/rules/radix.md b/docs/src/rules/radix.md index b1adcee93a2..09a67df4c63 100644 --- a/docs/src/rules/radix.md +++ b/docs/src/rules/radix.md @@ -3,6 +3,8 @@ title: radix layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/radix.md rule_type: suggestion +further_reading: +- https://davidwalsh.name/parseint-radix --- @@ -97,7 +99,3 @@ var num = parseFloat(someValue); ## When Not To Use It If you don't want to enforce either presence or omission of the `10` radix value you can turn this rule off. - -## Further Reading - -* [parseInt and radix](https://davidwalsh.name/parseint-radix) diff --git a/docs/src/rules/require-await.md b/docs/src/rules/require-await.md index 0d9362d230d..94226b129f3 100644 --- a/docs/src/rules/require-await.md +++ b/docs/src/rules/require-await.md @@ -3,6 +3,8 @@ title: require-await layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-await.md rule_type: suggestion +related_rules: +- require-yield --- Disallows async functions which have no `await` expression. @@ -87,7 +89,3 @@ fail().catch(error => { In this case, the `fail()` function throws an error that is intended to be caught by the `catch()` handler assigned later. Converting the `fail()` function into a synchronous function would require the call to `fail()` to be refactored to use a `try-catch` statement instead of a promise. If you are throwing an error inside of an asynchronous function for this purpose, then you may want to disable this rule. - -## Related Rules - -* [require-yield](require-yield) diff --git a/docs/src/rules/require-jsdoc.md b/docs/src/rules/require-jsdoc.md index 52256697891..8bd899e79e1 100644 --- a/docs/src/rules/require-jsdoc.md +++ b/docs/src/rules/require-jsdoc.md @@ -3,6 +3,8 @@ title: require-jsdoc layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-jsdoc.md rule_type: suggestion +related_rules: +- valid-jsdoc --- Requires JSDoc comments. @@ -190,7 +192,3 @@ setTimeout(() => {}, 10); // since it's an anonymous arrow function ## When Not To Use It If you do not require JSDoc for your functions, then you can leave this rule off. - -## Related Rules - -* [valid-jsdoc](valid-jsdoc) diff --git a/docs/src/rules/require-yield.md b/docs/src/rules/require-yield.md index 291f438df40..08d183c1b79 100644 --- a/docs/src/rules/require-yield.md +++ b/docs/src/rules/require-yield.md @@ -3,6 +3,8 @@ title: require-yield layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-yield.md rule_type: suggestion +related_rules: +- require-await --- @@ -48,7 +50,3 @@ function* foo() { } ## When Not To Use It If you don't want to notify generator functions that have no `yield` expression, then it's safe to disable this rule. - -## Related Rules - -* [require-await](require-await) diff --git a/docs/src/rules/rest-spread-spacing.md b/docs/src/rules/rest-spread-spacing.md index 48c1a7a9923..1a9e71f8fdb 100644 --- a/docs/src/rules/rest-spread-spacing.md +++ b/docs/src/rules/rest-spread-spacing.md @@ -3,6 +3,8 @@ title: rest-spread-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/rest-spread-spacing.md rule_type: layout +further_reading: +- https://github.com/tc39/proposal-object-rest-spread --- @@ -143,7 +145,3 @@ let n = { x, y, ... z }; ## When Not To Use It You can safely disable this rule if you do not care about enforcing consistent spacing between spread operators and their expressions. - -## Further Reading - -* [Object Rest/Spread Properties for ECMAScript](https://github.com/tc39/proposal-object-rest-spread) diff --git a/docs/src/rules/semi-spacing.md b/docs/src/rules/semi-spacing.md index b2d465d4a23..8b60e16bf21 100644 --- a/docs/src/rules/semi-spacing.md +++ b/docs/src/rules/semi-spacing.md @@ -3,6 +3,12 @@ title: semi-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi-spacing.md rule_type: layout +related_rules: +- semi +- no-extra-semi +- comma-spacing +- block-spacing +- space-in-parens --- @@ -108,11 +114,3 @@ for (i = 0 ;i < 10 ;i++) {} ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons. - -## Related Rules - -* [semi](semi) -* [no-extra-semi](no-extra-semi) -* [comma-spacing](comma-spacing) -* [block-spacing](block-spacing) -* [space-in-parens](space-in-parens) diff --git a/docs/src/rules/semi-style.md b/docs/src/rules/semi-style.md index 1c44bd9ffcb..0cf379c3bcd 100644 --- a/docs/src/rules/semi-style.md +++ b/docs/src/rules/semi-style.md @@ -3,6 +3,10 @@ title: semi-style layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi-style.md rule_type: layout +related_rules: +- no-extra-semi +- semi +- semi-spacing --- @@ -125,9 +129,3 @@ class C { ## When Not To Use It If you don't want to notify the location of semicolons, then it's safe to disable this rule. - -## Related Rules - -* [no-extra-semi](./no-extra-semi) -* [semi](./semi) -* [semi-spacing](./semi-spacing) diff --git a/docs/src/rules/semi.md b/docs/src/rules/semi.md index 013b9675abe..10147935769 100644 --- a/docs/src/rules/semi.md +++ b/docs/src/rules/semi.md @@ -3,6 +3,13 @@ title: semi layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi.md rule_type: layout +related_rules: +- no-extra-semi +- no-unexpected-multiline +- semi-spacing +further_reading: +- https://blog.izs.me/2010/12/an-open-letter-to-javascript-leaders-regarding/ +- https://web.archive.org/web/20200420230322/http://inimino.org/~inimino/blog/javascript_semicolons --- @@ -218,14 +225,3 @@ import a from "a" ## When Not To Use It If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off. - -## Related Rules - -* [no-extra-semi](no-extra-semi) -* [no-unexpected-multiline](no-unexpected-multiline) -* [semi-spacing](semi-spacing) - -## Further Reading - -* [An Open Letter to JavaScript Leaders Regarding Semicolons](http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding) -* [JavaScript Semicolon Insertion](http://inimino.org/~inimino/blog/javascript_semicolons) diff --git a/docs/src/rules/sort-imports.md b/docs/src/rules/sort-imports.md index 40f7686c885..9f8459fda99 100644 --- a/docs/src/rules/sort-imports.md +++ b/docs/src/rules/sort-imports.md @@ -3,6 +3,9 @@ title: sort-imports layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-imports.md rule_type: suggestion +related_rules: +- sort-keys +- sort-vars --- @@ -292,8 +295,3 @@ Default is `false`. ## When Not To Use It This rule is a formatting preference and not following it won't negatively affect the quality of your code. If alphabetizing imports isn't a part of your coding standards, then you can leave this rule disabled. - -## Related Rules - -* [sort-keys](sort-keys) -* [sort-vars](sort-vars) diff --git a/docs/src/rules/sort-keys.md b/docs/src/rules/sort-keys.md index f01771336cb..1a803b19c22 100644 --- a/docs/src/rules/sort-keys.md +++ b/docs/src/rules/sort-keys.md @@ -3,6 +3,9 @@ title: sort-keys layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-keys.md rule_type: suggestion +related_rules: +- sort-imports +- sort-vars --- Requires object keys to be sorted. @@ -225,11 +228,6 @@ let obj = { If you don't want to notify about properties' order, then it's safe to disable this rule. -## Related Rules - -* [sort-imports](sort-imports) -* [sort-vars](sort-vars) - ## Compatibility * **JSCS:** [validateOrderInObjectKeys](https://jscs-dev.github.io/rule/validateOrderInObjectKeys) diff --git a/docs/src/rules/sort-vars.md b/docs/src/rules/sort-vars.md index 2cd8f478d36..a0282a65f82 100644 --- a/docs/src/rules/sort-vars.md +++ b/docs/src/rules/sort-vars.md @@ -3,6 +3,9 @@ title: sort-vars layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-vars.md rule_type: suggestion +related_rules: +- sort-keys +- sort-imports --- @@ -80,8 +83,3 @@ var a, B, c; ## When Not To Use It This rule is a formatting preference and not following it won't negatively affect the quality of your code. If you alphabetizing variables isn't a part of your coding standards, then you can leave this rule off. - -## Related Rules - -* [sort-keys](sort-keys) -* [sort-imports](sort-imports) diff --git a/docs/src/rules/space-before-blocks.md b/docs/src/rules/space-before-blocks.md index 755d057623b..0af8e7d0b9b 100644 --- a/docs/src/rules/space-before-blocks.md +++ b/docs/src/rules/space-before-blocks.md @@ -3,6 +3,12 @@ title: space-before-blocks layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-blocks.md rule_type: layout +related_rules: +- keyword-spacing +- arrow-spacing +- switch-colon-spacing +- block-spacing +- brace-style --- @@ -218,11 +224,3 @@ class Foo { ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing before blocks. - -## Related Rules - -* [keyword-spacing](keyword-spacing) -* [arrow-spacing](arrow-spacing) -* [switch-colon-spacing](switch-colon-spacing) -* [block-spacing](block-spacing) -* [brace-style](brace-style) diff --git a/docs/src/rules/space-before-function-paren.md b/docs/src/rules/space-before-function-paren.md index b16fc954887..ad0a20b57a4 100644 --- a/docs/src/rules/space-before-function-paren.md +++ b/docs/src/rules/space-before-function-paren.md @@ -3,6 +3,9 @@ title: space-before-function-paren layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-function-paren.md rule_type: layout +related_rules: +- space-after-keywords +- space-return-throw-case --- @@ -370,8 +373,3 @@ var foo = { ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis. - -## Related Rules - -* [space-after-keywords](space-after-keywords) -* [space-return-throw-case](space-return-throw-case) diff --git a/docs/src/rules/space-before-function-parentheses.md b/docs/src/rules/space-before-function-parentheses.md index 376bd1cfeed..2bc0e3b7433 100644 --- a/docs/src/rules/space-before-function-parentheses.md +++ b/docs/src/rules/space-before-function-parentheses.md @@ -3,6 +3,9 @@ title: space-before-function-parentheses layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-function-parentheses.md +related_rules: +- space-after-keywords +- space-return-throw-case --- Enforces consistent spacing before opening parenthesis in function definitions. @@ -260,8 +263,3 @@ var foo = { ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis. - -## Related Rules - -* [space-after-keywords](space-after-keywords) -* [space-return-throw-case](space-return-throw-case) diff --git a/docs/src/rules/space-before-keywords.md b/docs/src/rules/space-before-keywords.md index 1d9384e03f8..361a2626804 100644 --- a/docs/src/rules/space-before-keywords.md +++ b/docs/src/rules/space-before-keywords.md @@ -3,6 +3,12 @@ title: space-before-keywords layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-keywords.md +related_rules: +- space-after-keywords +- block-spacing +- space-return-throw-case +- space-unary-ops +- space-infix-ops --- Enforces consistent spacing before keywords. @@ -111,11 +117,3 @@ try{}catch(e) {} ## When Not To Use It If you do not wish to enforce consistency on keyword spacing. - -## Related Rules - -* [space-after-keywords](space-after-keywords) -* [block-spacing](block-spacing) -* [space-return-throw-case](space-return-throw-case) -* [space-unary-ops](space-unary-ops) -* [space-infix-ops](space-infix-ops) diff --git a/docs/src/rules/space-in-brackets.md b/docs/src/rules/space-in-brackets.md index d7de26eba12..4deafc6dde5 100644 --- a/docs/src/rules/space-in-brackets.md +++ b/docs/src/rules/space-in-brackets.md @@ -3,6 +3,11 @@ title: space-in-brackets layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-in-brackets.md +related_rules: +- array-bracket-spacing +- object-curly-spacing +- space-in-parens +- computed-property-spacing --- Enforces consistent spacing inside braces of object literals and brackets of array literals. @@ -305,10 +310,3 @@ var foo = obj[0, 1]; ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing between brackets. - -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [object-curly-spacing](object-curly-spacing) -* [space-in-parens](space-in-parens) -* [computed-property-spacing](computed-property-spacing) diff --git a/docs/src/rules/space-in-parens.md b/docs/src/rules/space-in-parens.md index 7d6f4bc3ad7..0625410ccf6 100644 --- a/docs/src/rules/space-in-parens.md +++ b/docs/src/rules/space-in-parens.md @@ -3,6 +3,10 @@ title: space-in-parens layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-in-parens.md rule_type: layout +related_rules: +- array-bracket-spacing +- object-curly-spacing +- computed-property-spacing --- @@ -293,9 +297,3 @@ foo({bar: 'baz'}, [1, 2]); ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing between parentheses. - -## Related Rules - -* [array-bracket-spacing](array-bracket-spacing) -* [object-curly-spacing](object-curly-spacing) -* [computed-property-spacing](computed-property-spacing) diff --git a/docs/src/rules/spaced-comment.md b/docs/src/rules/spaced-comment.md index c990773744b..6d9c6398220 100644 --- a/docs/src/rules/spaced-comment.md +++ b/docs/src/rules/spaced-comment.md @@ -3,6 +3,8 @@ title: spaced-comment layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/spaced-comment.md rule_type: suggestion +related_rules: +- spaced-line-comment --- @@ -289,7 +291,3 @@ subsequent lines are ignored /*global ABC*/ ``` - -## Related Rules - -* [spaced-line-comment](spaced-line-comment) diff --git a/docs/src/rules/spaced-line-comment.md b/docs/src/rules/spaced-line-comment.md index e032d05df96..ea5247bd6be 100644 --- a/docs/src/rules/spaced-line-comment.md +++ b/docs/src/rules/spaced-line-comment.md @@ -3,6 +3,8 @@ title: spaced-line-comment layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/spaced-line-comment.md +related_rules: +- spaced-comment --- Enforces consistent spacing after `//` in line comments. @@ -73,7 +75,3 @@ var foo = 5; // Comment block //-+-+-+-+-+-+-+ ``` - -## Related Rules - -* [spaced-comment](spaced-comment) diff --git a/docs/src/rules/symbol-description.md b/docs/src/rules/symbol-description.md index 88eabce8f15..d33284a46a0 100644 --- a/docs/src/rules/symbol-description.md +++ b/docs/src/rules/symbol-description.md @@ -3,6 +3,8 @@ title: symbol-description layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/symbol-description.md rule_type: suggestion +further_reading: +- https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-description --- Requires symbol descriptions. @@ -58,7 +60,3 @@ var bar = Symbol(someString); This rule should not be used in ES3/5 environments. In addition, this rule can be safely turned off if you don't want to enforce presence of `description` when creating Symbols. - -## Further Reading - -* [Symbol Objects specification: Symbol description](https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-description) diff --git a/docs/src/rules/template-tag-spacing.md b/docs/src/rules/template-tag-spacing.md index e6d6f189605..a2ec2d6d68c 100644 --- a/docs/src/rules/template-tag-spacing.md +++ b/docs/src/rules/template-tag-spacing.md @@ -3,6 +3,9 @@ title: template-tag-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/template-tag-spacing.md rule_type: layout +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals +- https://exploringjs.com/es6/ch_template-literals.html#_examples-of-using-tagged-template-literals --- @@ -76,10 +79,3 @@ func `Hello world`; ## When Not To Use It If you don't want to be notified about usage of spacing between tag functions and their template literals, then it's safe to disable this rule. - -## Further Reading - -If you want to learn more about tagged template literals, check out the links below: - -* [Template literals (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals) -* [Examples of using tagged template literals (Exploring ES6)](http://exploringjs.com/es6/ch_template-literals.html#_examples-of-using-tagged-template-literals) diff --git a/docs/src/rules/valid-jsdoc.md b/docs/src/rules/valid-jsdoc.md index 84eb32b0e4e..c7bed2ef882 100644 --- a/docs/src/rules/valid-jsdoc.md +++ b/docs/src/rules/valid-jsdoc.md @@ -3,6 +3,10 @@ title: valid-jsdoc layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/valid-jsdoc.md rule_type: suggestion +related_rules: +- require-jsdoc +further_reading: +- https://jsdoc.app --- @@ -392,11 +396,3 @@ function add(num1, num2) { ## When Not To Use It If you aren't using JSDoc, then you can safely turn this rule off. - -## Related Rules - -* [require-jsdoc](require-jsdoc) - -## Further Reading - -* [JSDoc](http://usejsdoc.org) diff --git a/docs/src/rules/valid-typeof.md b/docs/src/rules/valid-typeof.md index a37def6f496..b43884fea1d 100644 --- a/docs/src/rules/valid-typeof.md +++ b/docs/src/rules/valid-typeof.md @@ -3,6 +3,8 @@ title: valid-typeof layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/valid-typeof.md rule_type: problem +further_reading: +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof --- @@ -72,7 +74,3 @@ typeof bar === typeof qux ## When Not To Use It You may want to turn this rule off if you will be using the `typeof` operator on host objects. - -## Further Reading - -* [MDN: `typeof` documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) diff --git a/docs/src/rules/vars-on-top.md b/docs/src/rules/vars-on-top.md index 858689e658b..39a25c4a483 100644 --- a/docs/src/rules/vars-on-top.md +++ b/docs/src/rules/vars-on-top.md @@ -3,6 +3,11 @@ title: vars-on-top layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/vars-on-top.md rule_type: suggestion +further_reading: +- https://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html +- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting +- https://danhough.com/blog/single-var-pattern-rant/ +- https://benalman.com/news/2012/05/multiple-var-statements-javascript/ --- Requires variable declarations to be at the top of their scope. @@ -128,10 +133,3 @@ function doSomething() { var second } ``` - -## Further Reading - -* [JavaScript Scoping and Hoisting](http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html) -* [var Hoisting](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting) -* [A criticism of the Single Var Pattern in JavaScript, and a simple alternative](http://danielhough.co.uk/blog/single-var-pattern-rant/) -* [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) diff --git a/docs/src/rules/yield-star-spacing.md b/docs/src/rules/yield-star-spacing.md index dabe6b2a938..f97e00b5d69 100644 --- a/docs/src/rules/yield-star-spacing.md +++ b/docs/src/rules/yield-star-spacing.md @@ -3,6 +3,8 @@ title: yield-star-spacing layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/yield-star-spacing.md rule_type: layout +further_reading: +- https://leanpub.com/understandinges6/read/#leanpub-auto-generators --- @@ -97,7 +99,3 @@ function*generator() { ## When Not To Use It If your project will not be using generators or you are not concerned with spacing consistency, you do not need this rule. - -## Further Reading - -* [Understanding ES6: Generators](https://leanpub.com/understandinges6/read/#leanpub-auto-generators) diff --git a/docs/src/rules/yoda.md b/docs/src/rules/yoda.md index 65efff7ece1..64ad9f4fbe8 100644 --- a/docs/src/rules/yoda.md +++ b/docs/src/rules/yoda.md @@ -3,6 +3,9 @@ title: yoda layout: doc edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/yoda.md rule_type: suggestion +further_reading: +- https://en.wikipedia.org/wiki/Yoda_conditions +- http://thomas.tuerke.net/on/design/?with=1249091668#msg1146181680 --- @@ -189,8 +192,3 @@ if (-1 < str.indexOf(substr)) { // ... } ``` - -## Further Reading - -* [Yoda Conditions](https://en.wikipedia.org/wiki/Yoda_conditions) -* [Yoda Notation and Safe Switching](http://thomas.tuerke.net/on/design/?with=1249091668#msg1146181680)