From 3e34a90b0f2cf592a6d5702023a3696943732335 Mon Sep 17 00:00:00 2001 From: Srijan Saurav <68371686+srijan-deepsource@users.noreply.github.com> Date: Mon, 30 May 2022 16:19:26 +0530 Subject: [PATCH] Revert "chore: Add static frontmatter to docs (#15782)" This reverts commit d7638af4e8c45c4620176d2b6b39566e7f5b3cfa. --- Makefile.js | 40 +++++++++-- docs/src/about/index.md | 7 +- docs/src/developer-guide/README.md | 21 +++--- .../index.md => architecture.md} | 9 +-- docs/src/developer-guide/code-conventions.md | 7 +- .../src/developer-guide/code-path-analysis.md | 7 +- .../code-path-analysis/README.md | 9 +-- .../developer-guide/contributing/README.md | 17 ++--- .../developer-guide/contributing/changes.md | 7 +- .../developer-guide/contributing/new-rules.md | 9 +-- .../contributing/pull-requests.md | 19 ++---- .../contributing/reporting-bugs.md | 9 +-- .../contributing/rule-changes.md | 11 +--- .../contributing/working-on-issues.md | 7 +- .../development-environment.md | 9 +-- docs/src/developer-guide/nodejs-api.md | 19 ++---- .../scope-manager-interface.md | 7 +- docs/src/developer-guide/selectors.md | 9 +-- docs/src/developer-guide/shareable-configs.md | 7 +- docs/src/developer-guide/source-code.md | 7 +- docs/src/developer-guide/unit-tests.md | 7 +- .../working-with-custom-formatters.md | 11 +--- .../working-with-custom-parsers.md | 9 +-- .../developer-guide/working-with-plugins.md | 15 ++--- .../working-with-rules-deprecated.md | 25 +++---- .../src/developer-guide/working-with-rules.md | 51 +++++++------- docs/src/maintainer-guide/README.md | 17 ++--- docs/src/maintainer-guide/governance.md | 7 +- docs/src/maintainer-guide/issues.md | 7 +- docs/src/maintainer-guide/pullrequests.md | 7 +- docs/src/maintainer-guide/releases.md | 7 +- docs/src/maintainer-guide/working-groups.md | 7 +- docs/src/pages/index.md | 6 +- docs/src/rules/accessor-pairs.md | 15 ++--- docs/src/rules/array-bracket-newline.md | 11 +--- docs/src/rules/array-bracket-spacing.md | 15 ++--- docs/src/rules/array-callback-return.md | 7 +- docs/src/rules/array-element-newline.md | 25 +++---- docs/src/rules/arrow-body-style.md | 9 +-- docs/src/rules/arrow-parens.md | 9 +-- docs/src/rules/arrow-spacing.md | 9 +-- docs/src/rules/block-scoped-var.md | 7 +- docs/src/rules/block-spacing.md | 13 +--- docs/src/rules/brace-style.md | 13 +--- docs/src/rules/callback-return.md | 9 +-- docs/src/rules/camelcase.md | 7 +- docs/src/rules/capitalized-comments.md | 9 +-- docs/src/rules/class-methods-use-this.md | 7 +- docs/src/rules/comma-dangle.md | 9 +-- docs/src/rules/comma-spacing.md | 27 +++----- docs/src/rules/comma-style.md | 11 +--- docs/src/rules/complexity.md | 21 +++--- docs/src/rules/computed-property-spacing.md | 15 ++--- docs/src/rules/consistent-return.md | 7 +- docs/src/rules/consistent-this.md | 7 +- docs/src/rules/constructor-super.md | 9 +-- docs/src/rules/curly.md | 9 +-- docs/src/rules/default-case-last.md | 11 +--- docs/src/rules/default-case.md | 10 +-- docs/src/rules/default-param-last.md | 7 +- docs/src/rules/dot-location.md | 13 +--- docs/src/rules/dot-notation.md | 9 +-- docs/src/rules/eol-last.md | 13 +--- docs/src/rules/eqeqeq.md | 9 +-- docs/src/rules/for-direction.md | 9 +-- docs/src/rules/func-call-spacing.md | 11 +--- docs/src/rules/func-name-matching.md | 7 +- docs/src/rules/func-names.md | 7 +- docs/src/rules/func-style.md | 7 +- .../rules/function-call-argument-newline.md | 17 ++--- docs/src/rules/function-paren-newline.md | 9 +-- docs/src/rules/generator-star-spacing.md | 9 +-- docs/src/rules/generator-star.md | 8 +-- docs/src/rules/getter-return.md | 9 +-- docs/src/rules/global-require.md | 7 +- docs/src/rules/global-strict.md | 9 +-- docs/src/rules/grouped-accessor-pairs.md | 19 ++---- docs/src/rules/guard-for-in.md | 11 +--- docs/src/rules/handle-callback-err.md | 7 +- docs/src/rules/id-blacklist.md | 9 +-- docs/src/rules/id-denylist.md | 7 +- docs/src/rules/id-length.md | 15 ++--- docs/src/rules/id-match.md | 7 +- docs/src/rules/implicit-arrow-linebreak.md | 14 ++-- docs/src/rules/indent-legacy.md | 11 +--- docs/src/rules/indent.md | 13 ++-- docs/src/rules/init-declarations.md | 7 +- docs/src/rules/jsx-quotes.md | 11 +--- docs/src/rules/key-spacing.md | 9 +-- docs/src/rules/keyword-spacing.md | 11 +--- docs/src/rules/line-comment-position.md | 7 +- docs/src/rules/linebreak-style.md | 9 +-- docs/src/rules/lines-around-comment.md | 14 ++-- docs/src/rules/lines-around-directive.md | 20 +++--- docs/src/rules/lines-between-class-members.md | 13 +--- docs/src/rules/max-classes-per-file.md | 7 +- docs/src/rules/max-depth.md | 21 +++--- docs/src/rules/max-len.md | 17 ++--- docs/src/rules/max-lines-per-function.md | 21 +++--- docs/src/rules/max-lines.md | 19 ++---- docs/src/rules/max-nested-callbacks.md | 21 +++--- docs/src/rules/max-params.md | 21 +++--- docs/src/rules/max-statements-per-line.md | 21 +++--- docs/src/rules/max-statements.md | 21 +++--- docs/src/rules/multiline-comment-style.md | 10 +-- docs/src/rules/multiline-ternary.md | 13 +--- docs/src/rules/new-cap.md | 7 +- docs/src/rules/new-parens.md | 9 +-- docs/src/rules/newline-after-var.md | 11 +--- docs/src/rules/newline-before-return.md | 13 +--- docs/src/rules/newline-per-chained-call.md | 9 +-- docs/src/rules/no-alert.md | 11 +--- docs/src/rules/no-array-constructor.md | 11 +--- docs/src/rules/no-arrow-condition.md | 15 ++--- docs/src/rules/no-async-promise-executor.md | 9 +-- docs/src/rules/no-await-in-loop.md | 7 +- docs/src/rules/no-bitwise.md | 7 +- docs/src/rules/no-buffer-constructor.md | 7 +- docs/src/rules/no-caller.md | 7 +- docs/src/rules/no-case-declarations.md | 11 +--- docs/src/rules/no-catch-shadow.md | 7 +- docs/src/rules/no-class-assign.md | 9 +-- docs/src/rules/no-comma-dangle.md | 9 +-- docs/src/rules/no-compare-neg-zero.md | 9 +-- docs/src/rules/no-cond-assign.md | 11 +--- docs/src/rules/no-confusing-arrow.md | 13 +--- docs/src/rules/no-console.md | 11 +--- docs/src/rules/no-const-assign.md | 9 +-- docs/src/rules/no-constant-condition.md | 9 +-- docs/src/rules/no-constructor-return.md | 7 +- docs/src/rules/no-continue.md | 7 +- docs/src/rules/no-control-regex.md | 13 +--- docs/src/rules/no-debugger.md | 13 +--- docs/src/rules/no-delete-var.md | 9 +-- docs/src/rules/no-div-regex.md | 13 +--- docs/src/rules/no-dupe-args.md | 9 +-- docs/src/rules/no-dupe-class-members.md | 9 +-- docs/src/rules/no-dupe-else-if.md | 13 +--- docs/src/rules/no-dupe-keys.md | 9 +-- docs/src/rules/no-duplicate-case.md | 9 +-- docs/src/rules/no-duplicate-imports.md | 7 +- docs/src/rules/no-else-return.md | 9 +-- docs/src/rules/no-empty-character-class.md | 9 +-- docs/src/rules/no-empty-class.md | 9 +-- docs/src/rules/no-empty-function.md | 9 +-- docs/src/rules/no-empty-label.md | 15 ++--- docs/src/rules/no-empty-pattern.md | 9 +-- docs/src/rules/no-empty.md | 11 +--- docs/src/rules/no-eq-null.md | 7 +- docs/src/rules/no-eval.md | 9 +-- docs/src/rules/no-ex-assign.md | 9 +-- docs/src/rules/no-extend-native.md | 9 +-- docs/src/rules/no-extra-bind.md | 9 +-- docs/src/rules/no-extra-boolean-cast.md | 11 +--- docs/src/rules/no-extra-label.md | 15 ++--- docs/src/rules/no-extra-parens.md | 21 ++---- docs/src/rules/no-extra-semi.md | 15 +---- docs/src/rules/no-extra-strict.md | 9 +-- docs/src/rules/no-fallthrough.md | 11 +--- docs/src/rules/no-floating-decimal.md | 9 +-- docs/src/rules/no-func-assign.md | 9 +-- docs/src/rules/no-global-assign.md | 15 ++--- docs/src/rules/no-implicit-coercion.md | 9 +-- docs/src/rules/no-implicit-globals.md | 11 +--- docs/src/rules/no-implied-eval.md | 9 +-- docs/src/rules/no-import-assign.md | 9 +-- docs/src/rules/no-inline-comments.md | 7 +- docs/src/rules/no-inner-declarations.md | 11 +--- docs/src/rules/no-invalid-regexp.md | 9 +-- docs/src/rules/no-invalid-this.md | 7 +- docs/src/rules/no-irregular-whitespace.md | 9 +-- docs/src/rules/no-iterator.md | 7 +- docs/src/rules/no-label-var.md | 13 ++-- docs/src/rules/no-labels.md | 13 ++-- docs/src/rules/no-lone-blocks.md | 7 +- docs/src/rules/no-lonely-if.md | 9 +-- docs/src/rules/no-loop-func.md | 7 +- docs/src/rules/no-loss-of-precision.md | 9 +-- docs/src/rules/no-magic-numbers.md | 7 +- .../rules/no-misleading-character-class.md | 9 +-- docs/src/rules/no-mixed-operators.md | 13 ++-- docs/src/rules/no-mixed-requires.md | 7 +- docs/src/rules/no-mixed-spaces-and-tabs.md | 9 +-- docs/src/rules/no-multi-assign.md | 9 +-- docs/src/rules/no-multi-spaces.md | 25 +++---- docs/src/rules/no-multi-str.md | 7 +- docs/src/rules/no-multiple-empty-lines.md | 17 ++--- docs/src/rules/no-native-reassign.md | 15 ++--- docs/src/rules/no-negated-condition.md | 7 +- docs/src/rules/no-negated-in-lhs.md | 9 +-- docs/src/rules/no-nested-ternary.md | 11 +--- docs/src/rules/no-new-func.md | 7 +- docs/src/rules/no-new-object.md | 11 +--- docs/src/rules/no-new-require.md | 7 +- docs/src/rules/no-new-symbol.md | 10 +-- docs/src/rules/no-new-wrappers.md | 11 +--- docs/src/rules/no-new.md | 7 +- docs/src/rules/no-nonoctal-decimal-escape.md | 13 +--- docs/src/rules/no-obj-calls.md | 9 +-- docs/src/rules/no-octal-escape.md | 7 +- docs/src/rules/no-octal.md | 9 +-- docs/src/rules/no-param-reassign.md | 7 +- docs/src/rules/no-path-concat.md | 7 +- docs/src/rules/no-plusplus.md | 7 +- docs/src/rules/no-process-env.md | 7 +- docs/src/rules/no-process-exit.md | 7 +- docs/src/rules/no-promise-executor-return.md | 9 +-- docs/src/rules/no-proto.md | 7 +- docs/src/rules/no-prototype-builtins.md | 9 +-- docs/src/rules/no-redeclare.md | 13 +--- docs/src/rules/no-regex-spaces.md | 15 +---- docs/src/rules/no-reserved-keys.md | 9 +-- docs/src/rules/no-restricted-exports.md | 7 +- docs/src/rules/no-restricted-globals.md | 11 +--- docs/src/rules/no-restricted-imports.md | 7 +- docs/src/rules/no-restricted-modules.md | 7 +- docs/src/rules/no-restricted-properties.md | 11 +--- docs/src/rules/no-restricted-syntax.md | 15 ++--- docs/src/rules/no-return-assign.md | 7 +- docs/src/rules/no-return-await.md | 7 +- docs/src/rules/no-script-url.md | 7 +- docs/src/rules/no-self-assign.md | 9 +-- docs/src/rules/no-self-compare.md | 7 +- docs/src/rules/no-sequences.md | 7 +- docs/src/rules/no-setter-return.md | 11 +--- docs/src/rules/no-shadow-restricted-names.md | 11 +--- docs/src/rules/no-shadow.md | 9 +-- docs/src/rules/no-space-before-semi.md | 13 ++-- docs/src/rules/no-spaced-func.md | 11 +--- docs/src/rules/no-sparse-arrays.md | 9 +-- docs/src/rules/no-sync.md | 7 +- docs/src/rules/no-tabs.md | 7 +- docs/src/rules/no-template-curly-in-string.md | 7 +- docs/src/rules/no-ternary.md | 11 +--- docs/src/rules/no-this-before-super.md | 9 +-- docs/src/rules/no-throw-literal.md | 7 +- docs/src/rules/no-trailing-spaces.md | 9 +-- docs/src/rules/no-undef-init.md | 13 +--- docs/src/rules/no-undef.md | 19 ++---- docs/src/rules/no-undefined.md | 17 ++--- docs/src/rules/no-underscore-dangle.md | 7 +- docs/src/rules/no-unexpected-multiline.md | 19 ++---- .../src/rules/no-unmodified-loop-condition.md | 7 +- docs/src/rules/no-unneeded-ternary.md | 14 ++-- docs/src/rules/no-unreachable-loop.md | 15 ++--- docs/src/rules/no-unreachable.md | 9 +-- docs/src/rules/no-unsafe-finally.md | 9 +-- docs/src/rules/no-unsafe-negation.md | 11 +--- docs/src/rules/no-unsafe-optional-chaining.md | 9 +-- docs/src/rules/no-unused-expressions.md | 7 +- docs/src/rules/no-unused-labels.md | 17 ++--- .../rules/no-unused-private-class-members.md | 7 +- docs/src/rules/no-unused-vars.md | 9 +-- docs/src/rules/no-use-before-define.md | 7 +- docs/src/rules/no-useless-backreference.md | 15 ++--- docs/src/rules/no-useless-call.md | 9 +-- docs/src/rules/no-useless-catch.md | 9 +-- docs/src/rules/no-useless-computed-key.md | 9 +-- docs/src/rules/no-useless-concat.md | 7 +- docs/src/rules/no-useless-constructor.md | 7 +- docs/src/rules/no-useless-escape.md | 11 +--- docs/src/rules/no-useless-rename.md | 11 +--- docs/src/rules/no-useless-return.md | 9 +-- docs/src/rules/no-var.md | 9 +-- docs/src/rules/no-void.md | 11 +--- docs/src/rules/no-warning-comments.md | 7 +- .../rules/no-whitespace-before-property.md | 9 +-- docs/src/rules/no-with.md | 9 +-- docs/src/rules/no-wrap-func.md | 9 +-- .../rules/nonblock-statement-body-position.md | 13 +--- docs/src/rules/object-curly-newline.md | 18 ++--- docs/src/rules/object-curly-spacing.md | 17 ++--- docs/src/rules/object-property-newline.md | 17 ++--- docs/src/rules/object-shorthand.md | 11 +--- .../src/rules/one-var-declaration-per-line.md | 11 +--- docs/src/rules/one-var.md | 9 +-- docs/src/rules/operator-assignment.md | 9 +-- docs/src/rules/operator-linebreak.md | 11 +--- docs/src/rules/padded-blocks.md | 13 +--- .../rules/padding-line-between-statements.md | 15 ++--- docs/src/rules/prefer-arrow-callback.md | 9 +-- docs/src/rules/prefer-const.md | 13 +--- docs/src/rules/prefer-destructuring.md | 9 +-- .../rules/prefer-exponentiation-operator.md | 9 +-- docs/src/rules/prefer-named-capture-group.md | 9 +-- docs/src/rules/prefer-numeric-literals.md | 9 +-- docs/src/rules/prefer-object-has-own.md | 11 +--- docs/src/rules/prefer-object-spread.md | 9 +-- .../src/rules/prefer-promise-reject-errors.md | 13 ++-- docs/src/rules/prefer-reflect.md | 15 ++--- docs/src/rules/prefer-regex-literals.md | 9 +-- docs/src/rules/prefer-rest-params.md | 9 +-- docs/src/rules/prefer-spread.md | 9 +-- docs/src/rules/prefer-template.md | 13 +--- docs/src/rules/quote-props.md | 9 +-- docs/src/rules/quotes.md | 11 +--- docs/src/rules/radix.md | 9 +-- docs/src/rules/require-atomic-updates.md | 7 +- docs/src/rules/require-await.md | 9 +-- docs/src/rules/require-jsdoc.md | 9 +-- docs/src/rules/require-unicode-regexp.md | 7 +- docs/src/rules/require-yield.md | 11 +--- docs/src/rules/rest-spread-spacing.md | 9 +-- docs/src/rules/semi-spacing.md | 19 ++---- docs/src/rules/semi-style.md | 15 ++--- docs/src/rules/semi.md | 19 ++---- docs/src/rules/sort-imports.md | 13 +--- docs/src/rules/sort-keys.md | 11 +--- docs/src/rules/sort-vars.md | 13 +--- docs/src/rules/space-after-function-name.md | 9 +-- docs/src/rules/space-after-keywords.md | 9 +-- docs/src/rules/space-before-blocks.md | 19 ++---- docs/src/rules/space-before-function-paren.md | 13 +--- .../space-before-function-parentheses.md | 13 ++-- docs/src/rules/space-before-keywords.md | 21 +++--- docs/src/rules/space-in-brackets.md | 17 ++--- docs/src/rules/space-in-parens.md | 15 ++--- docs/src/rules/space-infix-ops.md | 9 +-- docs/src/rules/space-return-throw-case.md | 9 +-- docs/src/rules/space-unary-ops.md | 9 +-- docs/src/rules/space-unary-word-ops.md | 9 +-- docs/src/rules/spaced-comment.md | 11 +--- docs/src/rules/spaced-line-comment.md | 11 +--- docs/src/rules/strict.md | 19 ++---- docs/src/rules/switch-colon-spacing.md | 9 +-- docs/src/rules/symbol-description.md | 7 +- docs/src/rules/template-curly-spacing.md | 9 +-- docs/src/rules/template-tag-spacing.md | 9 +-- docs/src/rules/unicode-bom.md | 9 +-- docs/src/rules/use-isnan.md | 9 +-- docs/src/rules/valid-jsdoc.md | 11 +--- docs/src/rules/valid-typeof.md | 11 +--- docs/src/rules/vars-on-top.md | 7 +- docs/src/rules/wrap-iife.md | 9 +-- docs/src/rules/wrap-regex.md | 9 +-- docs/src/rules/yield-star-spacing.md | 9 +-- docs/src/rules/yoda.md | 9 +-- docs/src/user-guide/README.md | 29 ++++---- docs/src/user-guide/command-line-interface.md | 33 ++++------ docs/src/user-guide/configuring/README.md | 66 +++++++++---------- .../configuring/configuration-files.md | 9 +-- .../user-guide/configuring/ignoring-code.md | 9 +-- .../configuring/language-options.md | 7 +- docs/src/user-guide/configuring/plugins.md | 7 +- docs/src/user-guide/configuring/rules.md | 7 +- docs/src/user-guide/getting-started.md | 15 ++--- docs/src/user-guide/integrations.md | 7 +- docs/src/user-guide/migrating-from-jscs.md | 7 +- docs/src/user-guide/migrating-to-1.0.0.md | 7 +- docs/src/user-guide/migrating-to-2.0.0.md | 9 +-- docs/src/user-guide/migrating-to-3.0.0.md | 7 +- docs/src/user-guide/migrating-to-4.0.0.md | 7 +- docs/src/user-guide/migrating-to-5.0.0.md | 7 +- docs/src/user-guide/migrating-to-6.0.0.md | 7 +- docs/src/user-guide/migrating-to-7.0.0.md | 7 +- docs/src/user-guide/migrating-to-8.0.0.md | 7 +- docs/src/user-guide/rule-deprecation.md | 7 +- 357 files changed, 924 insertions(+), 2995 deletions(-) rename docs/src/developer-guide/{architecture/index.md => architecture.md} (96%) diff --git a/Makefile.js b/Makefile.js index 4ef251b1415..25eb619fdc1 100644 --- a/Makefile.js +++ b/Makefile.js @@ -660,7 +660,9 @@ target.gensite = function(prereleaseVersion) { sourcePath = path.join("lib/rules", sourceBaseName), ruleName = path.basename(filename, ".md"), filePath = path.posix.join("docs", path.relative("tmp", filename)); - let text = cat(filename); + let text = cat(filename), + ruleType = "", + title; process.stdout.write(`> Updating files (Steps 4-9): ${i}/${length} - ${filePath + " ".repeat(30)}\r`); @@ -673,12 +675,40 @@ target.gensite = function(prereleaseVersion) { const isFixable = rule && rule.meta.fixable; const hasSuggestions = rule && rule.meta.hasSuggestions; - text = text.replace("", isFixable ? FIXABLE_TEXT : "") - .replace("", hasSuggestions ? HAS_SUGGESTIONS_TEXT : "") - .replace("", isRecommended ? RECOMMENDED_TEXT : ""); + // Incorporate the special portion into the documentation content + const textSplit = text.split("\n"); + const ruleHeading = textSplit[0]; + const ruleDocsContent = textSplit.slice(1).join("\n"); + text = `${ruleHeading}${isRecommended ? RECOMMENDED_TEXT : ""}${isFixable ? FIXABLE_TEXT : ""}${hasSuggestions ? HAS_SUGGESTIONS_TEXT : ""}\n${ruleDocsContent}`; + title = `${ruleName} - Rules`; + + if (rule && rule.meta) { + ruleType = `rule_type: ${rule.meta.type}`; + } + } else { + + // extract the title from the file itself + title = text.match(/#([^#].+)\n/u); + if (title) { + title = title[1].trim(); + } else { + title = "Documentation"; + } } + text = [ + "---", + `title: ${title}`, + "layout: doc", + `edit_link: https://github.com/eslint/eslint/edit/main/${filePath.replace("docs/", "docs/src/")}`, + ruleType, + "---", + "", + "", + text + ].join("\n"); + // 6. Remove .md extension for relative links and change README to empty string text = text.replace(/\((?!https?:\/\/)([^)]*?)\.md(.*?)\)/gu, "($1$2)").replace("README.html", ""); @@ -786,7 +816,7 @@ target.checkRuleFiles = function() { * @todo Will remove this check when the main heading is automatically generated from rule metadata. */ function hasIdInTitle(id) { - return new RegExp(`title: ${id}`, "u").test(docText); + return new RegExp(`^# ${id}`, "u").test(docText); } /** diff --git a/docs/src/about/index.md b/docs/src/about/index.md index 5b3b359b45d..a9c5acb4638 100644 --- a/docs/src/about/index.md +++ b/docs/src/about/index.md @@ -1,9 +1,4 @@ ---- -title: About -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/about/index.md - ---- +# About ESLint is an open source JavaScript linting utility originally created by Nicholas C. Zakas in June 2013. Code [linting][] is a type of static analysis that is frequently used to find problematic patterns or code that doesn't adhere to certain style guidelines. There are code linters for most programming languages, and compilers sometimes incorporate linting into the compilation process. diff --git a/docs/src/developer-guide/README.md b/docs/src/developer-guide/README.md index ea1bc20bd8e..a5e65927869 100644 --- a/docs/src/developer-guide/README.md +++ b/docs/src/developer-guide/README.md @@ -1,9 +1,4 @@ ---- -title: Developer Guide -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/README.md - ---- +# Developer Guide This guide is intended for those who wish to: @@ -19,31 +14,31 @@ In order to work with ESLint as a developer, it's recommended that: If that sounds like you, then continue reading to get started. -## Section 1: Get the [Source Code](source-code) +## Section 1: Get the [Source Code](source-code.md) Before you can get started, you'll need to get a copy of the ESLint source code. This section explains how to do that and a little about the source code structure. -## Section 2: Set up a [Development Environment](development-environment) +## Section 2: Set up a [Development Environment](development-environment.md) Developing for ESLint is a bit different than running it on the command line. This section shows you how to set up a development environment and get you ready to write code. -## Section 3: Run the [Unit Tests](unit-tests) +## Section 3: Run the [Unit Tests](unit-tests.md) There are a lot of unit tests included with ESLint to make sure that we're keeping on top of code quality. This section explains how to run the unit tests. -## Section 4: [Working with Rules](working-with-rules) +## Section 4: [Working with Rules](working-with-rules.md) You're finally ready to start working with rules. You may want to fix an existing rule or create a new one. This section explains how to do all of that. -## Section 5: [Working with Plugins](working-with-plugins) +## Section 5: [Working with Plugins](working-with-plugins.md) You've developed library-specific rules for ESLint and you want to share them with the community. You can publish an ESLint plugin on npm. -## Section 6: [Working with Custom Parsers](working-with-custom-parsers) +## Section 6: [Working with Custom Parsers](working-with-custom-parsers.md) If you aren't going to use the default parser of ESLint, this section explains about using custom parsers. -## Section 7: [Node.js API](nodejs-api) +## Section 7: [Node.js API](nodejs-api.md) If you're interested in writing a tool that uses ESLint, then you can use the Node.js API to get programmatic access to functionality. diff --git a/docs/src/developer-guide/architecture/index.md b/docs/src/developer-guide/architecture.md similarity index 96% rename from docs/src/developer-guide/architecture/index.md rename to docs/src/developer-guide/architecture.md index b2ec2bc194b..37261abcc3d 100644 --- a/docs/src/developer-guide/architecture/index.md +++ b/docs/src/developer-guide/architecture.md @@ -1,11 +1,6 @@ ---- -title: Architecture -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/architecture/index.md +# Architecture ---- - -
dependency graph
+
dependency graph
At a high level, there are a few key parts to ESLint: diff --git a/docs/src/developer-guide/code-conventions.md b/docs/src/developer-guide/code-conventions.md index 9b639c36cb9..0c1cbe6245d 100644 --- a/docs/src/developer-guide/code-conventions.md +++ b/docs/src/developer-guide/code-conventions.md @@ -1,9 +1,4 @@ ---- -title: Code Conventions -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-conventions.md - ---- +# Code Conventions Code conventions for ESLint are determined by [eslint-config-eslint](https://www.npmjs.com/package/eslint-config-eslint). diff --git a/docs/src/developer-guide/code-path-analysis.md b/docs/src/developer-guide/code-path-analysis.md index 68348f3e7a2..2b01bc77e81 100644 --- a/docs/src/developer-guide/code-path-analysis.md +++ b/docs/src/developer-guide/code-path-analysis.md @@ -1,9 +1,4 @@ ---- -title: Code Path Analysis Details -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis.md - ---- +# Code Path Analysis Details ESLint's rules can use code paths. The code path is execution routes of programs. diff --git a/docs/src/developer-guide/code-path-analysis/README.md b/docs/src/developer-guide/code-path-analysis/README.md index 6f48c809722..2b6fd7486f6 100644 --- a/docs/src/developer-guide/code-path-analysis/README.md +++ b/docs/src/developer-guide/code-path-analysis/README.md @@ -1,8 +1 @@ ---- -title: Code Path Analysis Details -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis/README.md - ---- - -[Code Path Analysis Details](../code-path-analysis) +[Code Path Analysis Details](../code-path-analysis.md) diff --git a/docs/src/developer-guide/contributing/README.md b/docs/src/developer-guide/contributing/README.md index 84ef50e9458..050953957e0 100644 --- a/docs/src/developer-guide/contributing/README.md +++ b/docs/src/developer-guide/contributing/README.md @@ -1,9 +1,4 @@ ---- -title: Contributing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/README.md - ---- +# Contributing One of the great things about open source projects is that anyone can contribute in any number of meaningful ways. ESLint couldn't exist without the help of the many contributors it's had since the project began, and we want you to feel like you can contribute and make a difference as well. @@ -17,15 +12,15 @@ ESLint welcomes contributions from everyone and adheres to the [OpenJS Foundatio Think you found a problem? We'd love to hear about it. This section explains how to submit a bug, the type of information we need to properly verify it, and the overall process. -## Proposing a [New Rule](new-rules) +## Proposing a [New Rule](new-rules.md) We get a lot of proposals for new rules in ESLint. This section explains how we determine which rules are accepted and what information you should provide to help us evaluate your proposal. -## Proposing a [Rule Change](rule-changes) +## Proposing a [Rule Change](rule-changes.md) Want to make a change to an existing rule? This section explains the process and how we evaluate such proposals. -## Requesting a [Change](changes) +## Requesting a [Change](changes.md) If you'd like to request a change other than a bug fix or new rule, this section explains that process. @@ -33,11 +28,11 @@ If you'd like to request a change other than a bug fix or new rule, this section To report a security vulnerability in ESLint, please use our [HackerOne program](https://hackerone.com/eslint). -## [Working on Issues](working-on-issues) +## [Working on Issues](working-on-issues.md) Have some extra time and want to contribute? This section talks about the process of working on issues. -## Submitting a [Pull Request](pull-requests) +## Submitting a [Pull Request](pull-requests.md) We're always looking for contributions from the community. This section explains the requirements for pull requests and the process of contributing code. diff --git a/docs/src/developer-guide/contributing/changes.md b/docs/src/developer-guide/contributing/changes.md index b6059676e1d..4c722ad660c 100644 --- a/docs/src/developer-guide/contributing/changes.md +++ b/docs/src/developer-guide/contributing/changes.md @@ -1,9 +1,4 @@ ---- -title: Change Requests -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/changes.md - ---- +# Change Requests If you'd like to request a change to ESLint, please [create a new issue](https://github.com/eslint/eslint/issues/new/choose) on GitHub. Be sure to include the following information: diff --git a/docs/src/developer-guide/contributing/new-rules.md b/docs/src/developer-guide/contributing/new-rules.md index 9288618c985..c3f6fbb0e6f 100644 --- a/docs/src/developer-guide/contributing/new-rules.md +++ b/docs/src/developer-guide/contributing/new-rules.md @@ -1,9 +1,4 @@ ---- -title: New Rules -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/new-rules.md - ---- +# New Rules ESLint is all about rules. For most of the project's lifetime, we've had over 200 rules, and that list continues to grow. However, we can't just accept any proposed rule because all rules need to work cohesively together. As such, we have some guidelines around which rules can be part of the ESLint core and which are better off as custom rules and plugins. @@ -44,4 +39,4 @@ The ESLint team doesn't implement new rules that are suggested by users because ## Alternative: Creating Your Own Rules -Remember that ESLint is completely pluggable, which means you can create your own rules and distribute them using plugins. We did this on purpose because we don't want to be the gatekeepers for all possible rules. Even if we don't accept a rule into the core, that doesn't mean you can't have the exact rule that you want. See the [working with rules](../working-with-rules) and [working with plugins](../working-with-plugins) documentation for more information. +Remember that ESLint is completely pluggable, which means you can create your own rules and distribute them using plugins. We did this on purpose because we don't want to be the gatekeepers for all possible rules. Even if we don't accept a rule into the core, that doesn't mean you can't have the exact rule that you want. See the [working with rules](../working-with-rules.md) and [working with plugins](../working-with-plugins.md) documentation for more information. diff --git a/docs/src/developer-guide/contributing/pull-requests.md b/docs/src/developer-guide/contributing/pull-requests.md index 8c9ede4d003..b58d105006c 100644 --- a/docs/src/developer-guide/contributing/pull-requests.md +++ b/docs/src/developer-guide/contributing/pull-requests.md @@ -1,9 +1,4 @@ ---- -title: Pull Requests -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/pull-requests.md - ---- +# Pull Requests If you want to contribute to an ESLint repo, please use a GitHub pull request. This is the fastest way for us to evaluate your code and to merge it into the code base. Please don't file an issue with snippets of code. Doing so means that we need to manually merge the changes in and update any appropriate tests. That decreases the likelihood that your code is going to get included in a timely manner. Please use pull requests. @@ -11,8 +6,8 @@ If you want to contribute to an ESLint repo, please use a GitHub pull request. T If you'd like to work on a pull request and you've never submitted code before, follow these steps: -1. Set up a [development environment](../development-environment). -1. If you want to implement a breaking change or a change to the core, ensure there's an issue that describes what you're doing and the issue has been accepted. You can create a new issue or just indicate you're [working on an existing issue](working-on-issues). Bug fixes, documentation changes, and other pull requests do not require an issue. +1. Set up a [development environment](../development-environment.md). +1. If you want to implement a breaking change or a change to the core, ensure there's an issue that describes what you're doing and the issue has been accepted. You can create a new issue or just indicate you're [working on an existing issue](working-on-issues.md). Bug fixes, documentation changes, and other pull requests do not require an issue. After that, you're ready to start working on code. @@ -44,7 +39,7 @@ You should do all of your development for the issue in this branch. ### Step 2: Make your changes -Make the changes to the code and tests, following the [code conventions](../code-conventions) as you go. Once you have finished, commit the changes to your branch: +Make the changes to the code and tests, following the [code conventions](../code-conventions.md) as you go. Once you have finished, commit the changes to your branch: ```shell git add -A @@ -77,7 +72,7 @@ The `tag` is one of the following: * `ci` - changes to our CI configuration files and scripts. * `perf` - a code change that improves performance. -Use the [labels of the issue you are working on](working-on-issues#issue-labels) to determine the best tag. +Use the [labels of the issue you are working on](working-on-issues.md#issue-labels) to determine the best tag. The message summary should be a one-sentence description of the change, and it must be 72 characters in length or shorter. If the pull request addresses an issue, then the issue number should be mentioned in the body of the commit message in the format `Fixes #1234`. If the commit doesn't completely fix the issue, then use `Refs #1234` instead of `Fixes #1234`. @@ -121,7 +116,7 @@ With your code ready to go, this is a good time to double-check your submission * Make separate pull requests for unrelated changes. Large pull requests with multiple unrelated changes may be closed without merging. * All changes must be accompanied by tests, even if the feature you're working on previously had no tests. * All user-facing changes must be accompanied by appropriate documentation. -* Follow the [Code Conventions](../code-conventions). +* Follow the [Code Conventions](../code-conventions.md). ### Step 6: Push your changes @@ -181,7 +176,7 @@ The commit messages in subsequent commits do not need to be in any specific form ### Rebasing -If your code is out-of-date, we might ask you to rebase. That means we want you to apply your changes on top of the latest upstream code. Make sure you have set up a [development environment](../development-environment) and then you can rebase using these commands: +If your code is out-of-date, we might ask you to rebase. That means we want you to apply your changes on top of the latest upstream code. Make sure you have set up a [development environment](../development-environment.md) and then you can rebase using these commands: ```shell git fetch upstream diff --git a/docs/src/developer-guide/contributing/reporting-bugs.md b/docs/src/developer-guide/contributing/reporting-bugs.md index 8d713c46004..0c59b345d2b 100644 --- a/docs/src/developer-guide/contributing/reporting-bugs.md +++ b/docs/src/developer-guide/contributing/reporting-bugs.md @@ -1,11 +1,6 @@ ---- -title: Reporting Bugs -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/reporting-bugs.md +# Reporting Bugs ---- - -If you think you've found a bug in ESLint, please [create a new issue](https://github.com/eslint/eslint/issues/new/choose) or a [pull request](/docs/developer-guide/contributing/pull-requests) on GitHub. +If you think you've found a bug in ESLint, please [create a new issue](https://github.com/eslint/eslint/issues/new/choose) or a [pull request](/docs/developer-guide/contributing/pull-requests.md) on GitHub. Please include as much detail as possible to help us properly address your issue. If we need to triage issues and constantly ask people for more detail, that's time taken away from actually fixing issues. Help us be as efficient as possible by including a lot of detail in your issues. diff --git a/docs/src/developer-guide/contributing/rule-changes.md b/docs/src/developer-guide/contributing/rule-changes.md index d6c07562e81..358862f1af7 100644 --- a/docs/src/developer-guide/contributing/rule-changes.md +++ b/docs/src/developer-guide/contributing/rule-changes.md @@ -1,15 +1,10 @@ ---- -title: Rule Changes -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/rule-changes.md - ---- +# Rule Changes Occasionally, a core ESLint rule needs to be changed. This is not necessarily a bug, but rather, an enhancement that makes a rule more configurable. In those situations, we will consider making changes to rules. ## Proposing a Rule Change -To propose a change to an existing rule, [create a pull request](/docs/developer-guide/contributing/pull-requests) or [new issue](https://github.com/eslint/eslint/issues/new/choose) and fill out the template. +To propose a change to an existing rule, [create a pull request](/docs/developer-guide/contributing/pull-requests.md) or [new issue](https://github.com/eslint/eslint/issues/new/choose) and fill out the template. We need all of this information in order to determine whether or not the change is a good candidate for inclusion. @@ -17,7 +12,7 @@ We need all of this information in order to determine whether or not the change In order for a rule change to be accepted into ESLint, it must: -1. Adhere to the [Core Rule Guidelines](new-rules#core-rule-guidelines) +1. Adhere to the [Core Rule Guidelines](new-rules.md#core-rule-guidelines) 1. Have an ESLint team member champion the change 1. Be important enough that rule is deemed incomplete without this change diff --git a/docs/src/developer-guide/contributing/working-on-issues.md b/docs/src/developer-guide/contributing/working-on-issues.md index 0065db77c0c..9e666d649b3 100644 --- a/docs/src/developer-guide/contributing/working-on-issues.md +++ b/docs/src/developer-guide/contributing/working-on-issues.md @@ -1,9 +1,4 @@ ---- -title: Working on Issues -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/working-on-issues.md - ---- +# Working on Issues Our public [issues tracker](https://github.com/eslint/eslint/issues) lists all of the things we plan on doing as well as suggestions from the community. Before starting to work on an issue, be sure you read through the rest of this page. diff --git a/docs/src/developer-guide/development-environment.md b/docs/src/developer-guide/development-environment.md index cd5f40febda..f61c3eb6d2d 100644 --- a/docs/src/developer-guide/development-environment.md +++ b/docs/src/developer-guide/development-environment.md @@ -1,9 +1,4 @@ ---- -title: Development Environment -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/development-environment.md - ---- +# Development Environment ESLint has a very lightweight development environment that makes updating code fast and easy. This is a step-by-step guide to setting up a local development environment that will let you contribute back to the project. @@ -64,7 +59,7 @@ The testing takes a few minutes to complete. If any tests fail, that likely mean ### Workflow -Once you have your development environment installed, you can make and submit changes to the ESLint source files. Doing this successfully requires careful adherence to our [pull-request submission workflow](contributing/pull-requests). +Once you have your development environment installed, you can make and submit changes to the ESLint source files. Doing this successfully requires careful adherence to our [pull-request submission workflow](contributing/pull-requests.md). ### Build Scripts diff --git a/docs/src/developer-guide/nodejs-api.md b/docs/src/developer-guide/nodejs-api.md index 8622326aa56..fc63072ad62 100644 --- a/docs/src/developer-guide/nodejs-api.md +++ b/docs/src/developer-guide/nodejs-api.md @@ -1,9 +1,4 @@ ---- -title: Node.js API -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/nodejs-api.md - ---- +# Node.js API While ESLint is designed to be run on the command line, it's possible to use ESLint programmatically through the Node.js API. The purpose of the Node.js API is to allow plugin and tool authors to use the ESLint functionality directly, without going through the command line interface. @@ -497,7 +492,7 @@ The `Linter` object does the actual evaluation of the JavaScript code. It doesn' The `Linter` is a constructor, and you can create a new instance by passing in the options you want to use. The available options are: -* `cwd` - Path to a directory that should be considered as the current working directory. It is accessible to rules by calling `context.getCwd()` (see [The Context Object](./working-with-rules#the-context-object)). If `cwd` is `undefined`, it will be normalized to `process.cwd()` if the global `process` object is defined (for example, in the Node.js runtime) , or `undefined` otherwise. +* `cwd` - Path to a directory that should be considered as the current working directory. It is accessible to rules by calling `context.getCwd()` (see [The Context Object](./working-with-rules.md#the-context-object)). If `cwd` is `undefined`, it will be normalized to `process.cwd()` if the global `process` object is defined (for example, in the Node.js runtime) , or `undefined` otherwise. For example: @@ -519,8 +514,8 @@ The most important method on `Linter` is `verify()`, which initiates linting of * **Note**: If you want to lint text and have your configuration be read and processed, use [`ESLint#lintFiles()`][eslint-lintfiles] or [`ESLint#lintText()`][eslint-linttext] instead. * `options` - (optional) Additional options for this run. * `filename` - (optional) the filename to associate with the source code. - * `preprocess` - (optional) A function that [Processors in Plugins](/docs/developer-guide/working-with-plugins#processors-in-plugins) documentation describes as the `preprocess` method. - * `postprocess` - (optional) A function that [Processors in Plugins](/docs/developer-guide/working-with-plugins#processors-in-plugins) documentation describes as the `postprocess` method. + * `preprocess` - (optional) A function that [Processors in Plugins](/docs/developer-guide/working-with-plugins.md#processors-in-plugins) documentation describes as the `preprocess` method. + * `postprocess` - (optional) A function that [Processors in Plugins](/docs/developer-guide/working-with-plugins.md#processors-in-plugins) documentation describes as the `postprocess` method. * `filterCodeBlock` - (optional) A function that decides which code blocks the linter should adopt. The function receives two arguments. The first argument is the virtual filename of a code block. The second argument is the text of the code block. If the function returned `true` then the linter adopts the code block. If the function was omitted, the linter adopts only `*.js` code blocks. If you provided a `filterCodeBlock` function, it overrides this default behavior, so the linter doesn't adopt `*.js` code blocks automatically. * `disableFixes` - (optional) when set to `true`, the linter doesn't make either the `fix` or `suggestions` property of the lint result. * `allowInlineConfig` - (optional) set to `false` to disable inline comments from changing ESLint rules. @@ -584,7 +579,7 @@ The information available for each linting message is: * `endColumn` - the end column of the range on which the error occurred (this property is omitted if it's not range). * `endLine` - the end line of the range on which the error occurred (this property is omitted if it's not range). * `fix` - an object describing the fix for the problem (this property is omitted if no fix is available). -* `suggestions` - an array of objects describing possible lint fixes for editors to programmatically enable (see details in the [Working with Rules docs](./working-with-rules#providing-suggestions)). +* `suggestions` - an array of objects describing possible lint fixes for editors to programmatically enable (see details in the [Working with Rules docs](./working-with-rules.md#providing-suggestions)). You can get the suppressed messages from the previous run by `getSuppressedMessages()` method. If there is not a previous run, `getSuppressedMessage()` will return an empty list. @@ -716,7 +711,7 @@ Map { ### Linter#defineParser Each instance of `Linter` holds a map of custom parsers. If you want to define a parser programmatically, you can add this function -with the name of the parser as first argument and the [parser object](/docs/developer-guide/working-with-custom-parsers) as second argument. The default `"espree"` parser will already be loaded for every `Linter` instance. +with the name of the parser as first argument and the [parser object](/docs/developer-guide/working-with-custom-parsers.md) as second argument. The default `"espree"` parser will already be loaded for every `Linter` instance. ```js const Linter = require("eslint").Linter; @@ -796,7 +791,7 @@ const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2015 } }); The `RuleTester#run()` method is used to run the tests. It should be passed the following arguments: * The name of the rule (string) -* The rule object itself (see ["working with rules"](./working-with-rules)) +* The rule object itself (see ["working with rules"](./working-with-rules.md)) * An object containing `valid` and `invalid` properties, each of which is an array containing test cases. A test case is an object with the following properties: diff --git a/docs/src/developer-guide/scope-manager-interface.md b/docs/src/developer-guide/scope-manager-interface.md index 4a6dc3302bb..e1a84dccad3 100644 --- a/docs/src/developer-guide/scope-manager-interface.md +++ b/docs/src/developer-guide/scope-manager-interface.md @@ -1,9 +1,4 @@ ---- -title: ScopeManager -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/scope-manager-interface.md - ---- +# ScopeManager This document was written based on the implementation of [eslint-scope](https://github.com/eslint/eslint-scope), a fork of [escope](https://github.com/estools/escope), and deprecates some members ESLint is not using. diff --git a/docs/src/developer-guide/selectors.md b/docs/src/developer-guide/selectors.md index 1ee40c7d6c4..78bb2608426 100644 --- a/docs/src/developer-guide/selectors.md +++ b/docs/src/developer-guide/selectors.md @@ -1,9 +1,4 @@ ---- -title: Selectors -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/selectors.md - ---- +# Selectors Some rules and APIs allow the use of selectors to query an AST. This page is intended to: @@ -95,7 +90,7 @@ If multiple selectors have equal specificity, their listeners will be called in ### Restricting syntax with selectors -With the [no-restricted-syntax](/docs/rules/no-restricted-syntax) rule, you can restrict the usage of particular syntax in your code. For example, you can use the following configuration to disallow using `if` statements that do not have block statements as their body: +With the [no-restricted-syntax](/docs/rules/no-restricted-syntax.md) rule, you can restrict the usage of particular syntax in your code. For example, you can use the following configuration to disallow using `if` statements that do not have block statements as their body: ```json { diff --git a/docs/src/developer-guide/shareable-configs.md b/docs/src/developer-guide/shareable-configs.md index bdee9e10ca4..15032d9e7a0 100644 --- a/docs/src/developer-guide/shareable-configs.md +++ b/docs/src/developer-guide/shareable-configs.md @@ -1,9 +1,4 @@ ---- -title: Shareable Configs -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/shareable-configs.md - ---- +# Shareable Configs The configuration that you have in your `.eslintrc` file is an important part of your project, and as such, you may want to share it with other projects or people. Shareable configs allow you to publish your configuration settings on [npm](https://www.npmjs.com/) and have others download and use it in their ESLint projects. diff --git a/docs/src/developer-guide/source-code.md b/docs/src/developer-guide/source-code.md index 5ee58ffeb25..a6b7fa5b1d7 100644 --- a/docs/src/developer-guide/source-code.md +++ b/docs/src/developer-guide/source-code.md @@ -1,9 +1,4 @@ ---- -title: Source Code -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/source-code.md - ---- +# Source Code ESLint is hosted at [GitHub](https://github.com/eslint/eslint) and uses [Git](https://git-scm.com/) for source control. In order to obtain the source code, you must first install Git on your system. Instructions for installing and setting up Git can be found at [https://help.github.com/articles/set-up-git/](https://help.github.com/articles/set-up-git/). diff --git a/docs/src/developer-guide/unit-tests.md b/docs/src/developer-guide/unit-tests.md index 0d318495fb4..2968a23805a 100644 --- a/docs/src/developer-guide/unit-tests.md +++ b/docs/src/developer-guide/unit-tests.md @@ -1,9 +1,4 @@ ---- -title: Unit Tests -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/unit-tests.md - ---- +# Unit Tests Most parts of ESLint have unit tests associated with them. Unit tests are written using [Mocha](https://mochajs.org/) and are required when making contributions to ESLint. You'll find all of the unit tests in the `tests` directory. diff --git a/docs/src/developer-guide/working-with-custom-formatters.md b/docs/src/developer-guide/working-with-custom-formatters.md index d9fd89356c2..bdcbdb12f6a 100644 --- a/docs/src/developer-guide/working-with-custom-formatters.md +++ b/docs/src/developer-guide/working-with-custom-formatters.md @@ -1,9 +1,4 @@ ---- -title: Working with Custom Formatters -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/working-with-custom-formatters.md - ---- +# Working with Custom Formatters While ESLint has some built-in formatters available to format the linting results, it's also possible to create and distribute your own custom formatters. You can include custom formatters in your project directly or create an npm package to distribute them separately. @@ -127,8 +122,8 @@ Each `message` object contains information about the ESLint rule that was trigge The formatter function receives an object as the second argument. The object has two properties: -* `cwd` ... The current working directory. This value comes from the `cwd` constructor option of the [ESLint](nodejs-api#-new-eslintoptions) class. -* `rulesMeta` ... The `meta` property values of rules. See the [Working with Rules](working-with-rules) page for more information about rules. +* `cwd` ... The current working directory. This value comes from the `cwd` constructor option of the [ESLint](nodejs-api.md#-new-eslintoptions) class. +* `rulesMeta` ... The `meta` property values of rules. See the [Working with Rules](working-with-rules.md) page for more information about rules. For example, here's what the object would look like if one rule, `no-extra-semi`, had been run: diff --git a/docs/src/developer-guide/working-with-custom-parsers.md b/docs/src/developer-guide/working-with-custom-parsers.md index 71a67eb0ede..6387b848584 100644 --- a/docs/src/developer-guide/working-with-custom-parsers.md +++ b/docs/src/developer-guide/working-with-custom-parsers.md @@ -1,15 +1,10 @@ ---- -title: Working with Custom Parsers -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/working-with-custom-parsers.md - ---- +# Working with Custom Parsers If you want to use your own parser and provide additional capabilities for your rules, you can specify your own custom parser. If a `parseForESLint` method is exposed on the parser, this method will be used to parse the code. Otherwise, the `parse` method will be used. Both methods should take in the source code as the first argument, and an optional configuration object as the second argument (provided as `parserOptions` in a config file). The `parse` method should simply return the AST. The `parseForESLint` method should return an object that contains the required property `ast` and optional properties `services`, `scopeManager`, and `visitorKeys`. * `ast` should contain the AST. * `services` can contain any parser-dependent services (such as type checkers for nodes). The value of the `services` property is available to rules as `context.parserServices`. Default is an empty object. -* `scopeManager` can be a [ScopeManager](./scope-manager-interface) object. Custom parsers can use customized scope analysis for experimental/enhancement syntaxes. Default is the `ScopeManager` object which is created by [eslint-scope](https://github.com/eslint/eslint-scope). +* `scopeManager` can be a [ScopeManager](./scope-manager-interface.md) object. Custom parsers can use customized scope analysis for experimental/enhancement syntaxes. Default is the `ScopeManager` object which is created by [eslint-scope](https://github.com/eslint/eslint-scope). * Support for `scopeManager` was added in ESLint v4.14.0. ESLint versions which support `scopeManager` will provide an `eslintScopeManager: true` property in `parserOptions`, which can be used for feature detection. * `visitorKeys` can be an object to customize AST traversal. The keys of the object are the type of AST nodes. Each value is an array of the property names which should be traversed. Default is [KEYS of `eslint-visitor-keys`](https://github.com/eslint/eslint-visitor-keys#evkkeys). * Support for `visitorKeys` was added in ESLint v4.14.0. ESLint versions which support `visitorKeys` will provide an `eslintVisitorKeys: true` property in `parserOptions`, which can be used for feature detection. diff --git a/docs/src/developer-guide/working-with-plugins.md b/docs/src/developer-guide/working-with-plugins.md index 68519d28b46..bea47021932 100644 --- a/docs/src/developer-guide/working-with-plugins.md +++ b/docs/src/developer-guide/working-with-plugins.md @@ -1,9 +1,4 @@ ---- -title: Working with Plugins -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/working-with-plugins.md - ---- +# Working with Plugins Each plugin is an npm module with a name in the format of `eslint-plugin-`, such as `eslint-plugin-jquery`. You can also use scoped packages in the format of `@/eslint-plugin-` such as `@jquery/eslint-plugin-jquery` or even `@/eslint-plugin` such as `@jquery/eslint-plugin`. @@ -89,7 +84,7 @@ module.exports = { **The `preprocess` method** takes the file contents and filename as arguments, and returns an array of code blocks to lint. The code blocks will be linted separately but still be registered to the filename. -A code block has two properties `text` and `filename`; the `text` property is the content of the block and the `filename` property is the name of the block. Name of the block can be anything, but should include the file extension, that would tell the linter how to process the current block. The linter will check [`--ext` CLI option](../user-guide/command-line-interface#--ext) to see if the current block should be linted, and resolve `overrides` configs to check how to process the current block. +A code block has two properties `text` and `filename`; the `text` property is the content of the block and the `filename` property is the name of the block. Name of the block can be anything, but should include the file extension, that would tell the linter how to process the current block. The linter will check [`--ext` CLI option](../user-guide/command-line-interface.md#--ext) to see if the current block should be linted, and resolve `overrides` configs to check how to process the current block. It's up to the plugin to decide if it needs to return just one part, or multiple pieces. For example in the case of processing `.html` files, you might want to return just one item in the array by combining all scripts, but for `.md` file where each JavaScript block might be independent, you can return multiple items. @@ -141,7 +136,7 @@ overrides: processor: a-plugin/markdown ``` -See [Specifying Processor](../user-guide/configuring/plugins#specifying-processor) for details. +See [Specifying Processor](../user-guide/configuring/plugins.md#specifying-processor) for details. #### File Extension-named Processor @@ -202,7 +197,7 @@ If the example plugin above were called `eslint-plugin-myPlugin`, the `myConfig` ``` -**Note:** Please note that configuration will not enable any of the plugin's rules by default, and instead should be treated as a standalone config. This means that you must specify your plugin name in the `plugins` array as well as any rules you want to enable that are part of the plugin. Any plugin rules must be prefixed with the short or long plugin name. See [Configuring Plugins](../user-guide/configuring/plugins#configuring-plugins) for more information. +**Note:** Please note that configuration will not enable any of the plugin's rules by default, and instead should be treated as a standalone config. This means that you must specify your plugin name in the `plugins` array as well as any rules you want to enable that are part of the plugin. Any plugin rules must be prefixed with the short or long plugin name. See [Configuring Plugins](../user-guide/configuring/plugins.md#configuring-plugins) for more information. ### Peer Dependency @@ -219,7 +214,7 @@ The plugin support was introduced in ESLint version `0.8.0`. Ensure the `peerDep ### Testing -ESLint provides the [`RuleTester`](/docs/developer-guide/nodejs-api#ruletester) utility to make it easy to test the rules of your plugin. +ESLint provides the [`RuleTester`](/docs/developer-guide/nodejs-api.md#ruletester) utility to make it easy to test the rules of your plugin. ### Linting diff --git a/docs/src/developer-guide/working-with-rules-deprecated.md b/docs/src/developer-guide/working-with-rules-deprecated.md index a700780a85f..63d7bb2fc69 100644 --- a/docs/src/developer-guide/working-with-rules-deprecated.md +++ b/docs/src/developer-guide/working-with-rules-deprecated.md @@ -1,11 +1,6 @@ ---- -title: Working with Rules (Deprecated) -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/working-with-rules-deprecated.md +# Working with Rules (Deprecated) ---- - -**Note:** This page covers the deprecated rule format for ESLint <= 2.13.1. [This is the most recent rule format](./working-with-rules). +**Note:** This page covers the deprecated rule format for ESLint <= 2.13.1. [This is the most recent rule format](./working-with-rules.md). Each rule in ESLint has two files named with its identifier (for example, `no-extra-semi`). @@ -39,17 +34,17 @@ module.exports.schema = []; // no options ## Rule Basics -`schema` (array) specifies the [options](#options-schemas) so ESLint can prevent invalid [rule configurations](../user-guide/configuring/rules#configuring-rules) +`schema` (array) specifies the [options](#options-schemas) so ESLint can prevent invalid [rule configurations](../user-guide/configuring/rules.md#configuring-rules) `create` (function) returns an object with methods that ESLint calls to "visit" nodes while traversing the abstract syntax tree (AST as defined by [ESTree](https://github.com/estree/estree)) of JavaScript code: * if a key is a node type, ESLint calls that **visitor** function while going **down** the tree * if a key is a node type plus `:exit`, ESLint calls that **visitor** function while going **up** the tree -* if a key is an event name, ESLint calls that **handler** function for [code path analysis](./code-path-analysis) +* if a key is an event name, ESLint calls that **handler** function for [code path analysis](./code-path-analysis.md) A rule can use the current node and its surrounding tree to report or fix problems. -Here are methods for the [array-callback-return](../rules/array-callback-return) rule: +Here are methods for the [array-callback-return](../rules/array-callback-return.md) rule: ```js function checkLastSegment (node) { @@ -79,7 +74,7 @@ module.exports = function(context) { The `context` object contains additional functionality that is helpful for rules to do their jobs. As the name implies, the `context` object contains information that is relevant to the context of the rule. The `context` object has the following properties: -* `parserOptions` - the parser options configured for this run (more details [here](../user-guide/configuring/language-options#specifying-parser-options)). +* `parserOptions` - the parser options configured for this run (more details [here](../user-guide/configuring/language-options.md#specifying-parser-options)). * `id` - the rule ID. * `options` - an array of rule options. * `settings` - the `settings` from configuration. @@ -92,7 +87,7 @@ Additionally, the `context` object has the following methods: * `getFilename()` - returns the filename associated with the source. * `getScope()` - returns the current scope. * `getSourceCode()` - returns a `SourceCode` object that you can use to work with the source that was passed to ESLint -* `markVariableAsUsed(name)` - marks the named variable in scope as used. This affects the [no-unused-vars](../rules/no-unused-vars) rule. +* `markVariableAsUsed(name)` - marks the named variable in scope as used. This affects the [no-unused-vars](../rules/no-unused-vars.md) rule. * `report(descriptor)` - reports a problem in the code. **Deprecated:** The following methods on the `context` object are deprecated. Please use the corresponding methods on `SourceCode` instead: @@ -329,7 +324,7 @@ Keep in mind that comments are technically not a part of the AST and are only at ESLint analyzes code paths while traversing AST. You can access that code path objects with five events related to code paths. -[details here](./code-path-analysis) +[details here](./code-path-analysis.md) ## Rule Unit Tests @@ -483,7 +478,7 @@ valid: [ ] ``` -The options available and the expected syntax for `parserOptions` is the same as those used in [configuration](../user-guide/configuring/language-options#specifying-parser-options). +The options available and the expected syntax for `parserOptions` is the same as those used in [configuration](../user-guide/configuring/language-options.md#specifying-parser-options). ### Write Several Tests @@ -579,4 +574,4 @@ Runtime rules are written in the same format as all other rules. Create your rul 1. Place all of your runtime rules in the same directory (i.e., `eslint_rules`). 2. Create a [configuration file](../user-guide/configuring/) and specify your rule ID error level under the `rules` key. Your rule will not run unless it has a value of `1` or `2` in the configuration file. -3. Run the [command line interface](../user-guide/command-line-interface) using the `--rulesdir` option to specify the location of your runtime rules. +3. Run the [command line interface](../user-guide/command-line-interface.md) using the `--rulesdir` option to specify the location of your runtime rules. diff --git a/docs/src/developer-guide/working-with-rules.md b/docs/src/developer-guide/working-with-rules.md index f1330ac1296..697b7ed8bff 100644 --- a/docs/src/developer-guide/working-with-rules.md +++ b/docs/src/developer-guide/working-with-rules.md @@ -1,17 +1,12 @@ ---- -title: Working with Rules -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/working-with-rules.md +# Working with Rules ---- - -**Note:** This page covers the most recent rule format for ESLint >= 3.0.0. There is also a [deprecated rule format](./working-with-rules-deprecated). +**Note:** This page covers the most recent rule format for ESLint >= 3.0.0. There is also a [deprecated rule format](./working-with-rules-deprecated.md). Each rule in ESLint has three files named with its identifier (for example, `no-extra-semi`). * in the `lib/rules` directory: a source file (for example, `no-extra-semi.js`) * in the `tests/lib/rules` directory: a test file (for example, `no-extra-semi.js`) -* in the `docs/rules` directory: a Markdown documentation file (for example, `no-extra-semi`) +* in the `docs/rules` directory: a Markdown documentation file (for example, `no-extra-semi.md`) **Important:** If you submit a **core** rule to the ESLint repository, you **must** follow some conventions explained below. @@ -66,12 +61,12 @@ The source file for a rule exports an object with the following properties. * `description` (string) provides the short description of the rule in the [rules index](../rules/) * `category` (string) specifies the heading under which the rule is listed in the [rules index](../rules/) - * `recommended` (boolean) is whether the `"extends": "eslint:recommended"` property in a [configuration file](../user-guide/configuring/configuration-files#extending-configuration-files) enables the rule + * `recommended` (boolean) is whether the `"extends": "eslint:recommended"` property in a [configuration file](../user-guide/configuring/configuration-files.md#extending-configuration-files) enables the rule * `url` (string) specifies the URL at which the full documentation can be accessed (enabling code editors to provide a helpful link on highlighted rule violations) In a custom rule or plugin, you can omit `docs` or include any properties that you need in it. -* `fixable` (string) is either `"code"` or `"whitespace"` if the `--fix` option on the [command line](../user-guide/command-line-interface#--fix) automatically fixes problems reported by the rule +* `fixable` (string) is either `"code"` or `"whitespace"` if the `--fix` option on the [command line](../user-guide/command-line-interface.md#--fix) automatically fixes problems reported by the rule **Important:** the `fixable` property is mandatory for fixable rules. If this property isn't specified, ESLint will throw an error whenever the rule attempts to produce a fix. Omit the `fixable` property if the rule is not fixable. @@ -79,7 +74,7 @@ The source file for a rule exports an object with the following properties. **Important:** the `hasSuggestions` property is mandatory for rules that provide suggestions. If this property isn't set to `true`, ESLint will throw an error whenever the rule attempts to produce a suggestion. Omit the `hasSuggestions` property if the rule does not provide suggestions. -* `schema` (array) specifies the [options](#options-schemas) so ESLint can prevent invalid [rule configurations](../user-guide/configuring/rules#configuring-rules) +* `schema` (array) specifies the [options](#options-schemas) so ESLint can prevent invalid [rule configurations](../user-guide/configuring/rules.md#configuring-rules) * `deprecated` (boolean) indicates whether the rule has been deprecated. You may omit the `deprecated` property if the rule has not been deprecated. @@ -87,13 +82,13 @@ The source file for a rule exports an object with the following properties. `create` (function) returns an object with methods that ESLint calls to "visit" nodes while traversing the abstract syntax tree (AST as defined by [ESTree](https://github.com/estree/estree)) of JavaScript code: -* if a key is a node type or a [selector](./selectors), ESLint calls that **visitor** function while going **down** the tree -* if a key is a node type or a [selector](./selectors) plus `:exit`, ESLint calls that **visitor** function while going **up** the tree -* if a key is an event name, ESLint calls that **handler** function for [code path analysis](./code-path-analysis) +* if a key is a node type or a [selector](./selectors.md), ESLint calls that **visitor** function while going **down** the tree +* if a key is a node type or a [selector](./selectors.md) plus `:exit`, ESLint calls that **visitor** function while going **up** the tree +* if a key is an event name, ESLint calls that **handler** function for [code path analysis](./code-path-analysis.md) A rule can use the current node and its surrounding tree to report or fix problems. -Here are methods for the [array-callback-return](../rules/array-callback-return) rule: +Here are methods for the [array-callback-return](../rules/array-callback-return.md) rule: ```js function checkLastSegment (node) { @@ -126,18 +121,18 @@ module.exports = { The `context` object contains additional functionality that is helpful for rules to do their jobs. As the name implies, the `context` object contains information that is relevant to the context of the rule. The `context` object has the following properties: -* `parserOptions` - the parser options configured for this run (more details [here](../user-guide/configuring/language-options#specifying-parser-options)). +* `parserOptions` - the parser options configured for this run (more details [here](../user-guide/configuring/language-options.md#specifying-parser-options)). * `id` - the rule ID. -* `options` - an array of the [configured options](/docs/user-guide/configuring/rules#configuring-rules) for this rule. This array does not include the rule severity. For more information, see [here](#contextoptions). -* `settings` - the [shared settings](/docs/user-guide/configuring/configuration-files#adding-shared-settings) from configuration. +* `options` - an array of the [configured options](/docs/user-guide/configuring/rules.md#configuring-rules) for this rule. This array does not include the rule severity. For more information, see [here](#contextoptions). +* `settings` - the [shared settings](/docs/user-guide/configuring/configuration-files.md#adding-shared-settings) from configuration. * `parserPath` - the name of the `parser` from configuration. * `parserServices` - an object containing parser-provided services for rules. The default parser does not provide any services. However, if a rule is intended to be used with a custom parser, it could use `parserServices` to access anything provided by that parser. (For example, a TypeScript parser could provide the ability to get the computed type of a given node.) Additionally, the `context` object has the following methods: * `getAncestors()` - returns an array of the ancestors of the currently-traversed node, starting at the root of the AST and continuing through the direct parent of the current node. This array does not include the currently-traversed node itself. -* `getCwd()` - returns the `cwd` passed to [Linter](./nodejs-api#linter). It is a path to a directory that should be considered as the current working directory. -* `getDeclaredVariables(node)` - returns a list of [variables](./scope-manager-interface#variable-interface) declared by the given node. This information can be used to track references to variables. +* `getCwd()` - returns the `cwd` passed to [Linter](./nodejs-api.md#linter). It is a path to a directory that should be considered as the current working directory. +* `getDeclaredVariables(node)` - returns a list of [variables](./scope-manager-interface.md#variable-interface) declared by the given node. This information can be used to track references to variables. * If the node is a `VariableDeclaration`, all variables declared in the declaration are returned. * If the node is a `VariableDeclarator`, all variables declared in the declarator are returned. * If the node is a `FunctionDeclaration` or `FunctionExpression`, the variable for the function name is returned, in addition to variables for the function parameters. @@ -149,9 +144,9 @@ Additionally, the `context` object has the following methods: * Otherwise, if the node does not declare any variables, an empty array is returned. * `getFilename()` - returns the filename associated with the source. * `getPhysicalFilename()` - when linting a file, it returns the full path of the file on disk without any code block information. When linting text, it returns the value passed to `—stdin-filename` or `` if not specified. -* `getScope()` - returns the [scope](./scope-manager-interface#scope-interface) of the currently-traversed node. This information can be used to track references to variables. +* `getScope()` - returns the [scope](./scope-manager-interface.md#scope-interface) of the currently-traversed node. This information can be used to track references to variables. * `getSourceCode()` - returns a [`SourceCode`](#contextgetsourcecode) object that you can use to work with the source that was passed to ESLint. -* `markVariableAsUsed(name)` - marks a variable with the given name in the current scope as used. This affects the [no-unused-vars](../rules/no-unused-vars) rule. Returns `true` if a variable with the given name was found and marked as used, otherwise `false`. +* `markVariableAsUsed(name)` - marks a variable with the given name in the current scope as used. This affects the [no-unused-vars](../rules/no-unused-vars.md) rule. Returns `true` if a variable with the given name was found and marked as used, otherwise `false`. * `report(descriptor)` - reports a problem in the code (see the [dedicated section](#contextreport)). **Note:** Earlier versions of ESLint supported additional methods on the `context` object. Those methods were removed in the new format and should not be relied upon. @@ -181,7 +176,7 @@ This method returns the scope which has the following types: **※2** Only if the `for` statement defines the iteration variable as a block-scoped variable (E.g., `for (let i = 0;;) {}`).
**※3** The scope of the closest ancestor node which has own scope. If the closest ancestor node has multiple scopes then it chooses the innermost scope (E.g., the `Program` node has a `global` scope and a `module` scope if `Program#sourceType` is `"module"`. The innermost scope is the `module` scope.). -The returned value is a [`Scope` object](scope-manager-interface) defined by the `eslint-scope` package. The `Variable` objects of global variables have some additional properties. +The returned value is a [`Scope` object](scope-manager-interface.md) defined by the `eslint-scope` package. The `Variable` objects of global variables have some additional properties. * `variable.writeable` (`boolean | undefined`) ... If `true`, this global variable can be assigned arbitrary value. If `false`, this global variable is read-only. * `variable.eslintExplicitGlobal` (`boolean | undefined`) ... If `true`, this global variable was defined by a `/* globals */` directive comment in the source code file. @@ -355,7 +350,7 @@ Best practices for fixes: ({ "foo": 1 }) ``` - * This fixer can just select a quote type arbitrarily. If it guesses wrong, the resulting code will be automatically reported and fixed by the [`quotes`](/docs/rules/quotes) rule. + * This fixer can just select a quote type arbitrarily. If it guesses wrong, the resulting code will be automatically reported and fixed by the [`quotes`](/docs/rules/quotes.md) rule. Note: Making fixes as small as possible is a best practice, but in some cases it may be correct to extend the range of the fix in order to intentionally prevent other rules from making fixes in a surrounding range in the same pass. For instance, if replacement text declares a new variable, it can be useful to prevent other changes in the scope of the variable as they might cause name collisions. @@ -584,7 +579,7 @@ There are also some properties you can access: * `hasBOM` - the flag to indicate whether or not the source code has Unicode BOM. * `text` - the full text of the code being linted. Unicode BOM has been stripped from this text. * `ast` - the `Program` node of the AST for the code being linted. -* `scopeManager` - the [ScopeManager](./scope-manager-interface#scopemanager-interface) object of the code. +* `scopeManager` - the [ScopeManager](./scope-manager-interface.md#scopemanager-interface) object of the code. * `visitorKeys` - the visitor keys to traverse this AST. * `lines` - an array of lines, split according to the specification's definition of line breaks. @@ -683,13 +678,13 @@ Shebangs are represented by tokens of type `"Shebang"`. They are treated as comm ESLint analyzes code paths while traversing AST. You can access that code path objects with five events related to code paths. -[details here](./code-path-analysis) +[details here](./code-path-analysis.md) ## Rule Unit Tests Each bundled rule for ESLint core must have a set of unit tests submitted with it to be accepted. The test file is named the same as the source file but lives in `tests/lib/`. For example, if the rule source file is `lib/rules/foo.js` then the test file should be `tests/lib/rules/foo.js`. -ESLint provides the [`RuleTester`](/docs/developer-guide/nodejs-api#ruletester) utility to make it easy to write tests for rules. +ESLint provides the [`RuleTester`](/docs/developer-guide/nodejs-api.md#ruletester) utility to make it easy to write tests for rules. ## Performance Testing @@ -772,4 +767,4 @@ Runtime rules are written in the same format as all other rules. Create your rul 1. Place all of your runtime rules in the same directory (e.g., `eslint_rules`). 2. Create a [configuration file](../user-guide/configuring/) and specify your rule ID error level under the `rules` key. Your rule will not run unless it has a value of `"warn"` or `"error"` in the configuration file. -3. Run the [command line interface](../user-guide/command-line-interface) using the `--rulesdir` option to specify the location of your runtime rules. +3. Run the [command line interface](../user-guide/command-line-interface.md) using the `--rulesdir` option to specify the location of your runtime rules. diff --git a/docs/src/maintainer-guide/README.md b/docs/src/maintainer-guide/README.md index 52ed8a9e5c4..941ad55994b 100644 --- a/docs/src/maintainer-guide/README.md +++ b/docs/src/maintainer-guide/README.md @@ -1,28 +1,23 @@ ---- -title: Maintainer Guide -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/README.md - ---- +# Maintainer Guide This guide is intended for those who work as part of the ESLint project team. -## [Managing Issues](issues) +## [Managing Issues](issues.md) Describes how to deal with issues when they're opened, when interacting with users, and how to close them effectively. -## [Reviewing Pull Requests](pullrequests) +## [Reviewing Pull Requests](pullrequests.md) Describes how to review incoming pull requests. -## [Managing Releases](releases) +## [Managing Releases](releases.md) Describes how to do an ESLint project release. -## [Governance](governance) +## [Governance](governance.md) Describes the governance policy for ESLint, including the rights and privileges of individuals inside the project. -## [Working Groups](working-groups) +## [Working Groups](working-groups.md) Describes how working groups are created and how they function within the ESLint project. diff --git a/docs/src/maintainer-guide/governance.md b/docs/src/maintainer-guide/governance.md index 5ce0c3fa57a..2c754113739 100644 --- a/docs/src/maintainer-guide/governance.md +++ b/docs/src/maintainer-guide/governance.md @@ -1,9 +1,4 @@ ---- -title: Governance -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/governance.md - ---- +# Governance ESLint is an open source project that depends on contributions from the community. Anyone may contribute to the project at any time by submitting code, participating in discussions, making suggestions, or any other contribution they see fit. This document describes how various types of contributors work within the ESLint project. diff --git a/docs/src/maintainer-guide/issues.md b/docs/src/maintainer-guide/issues.md index 17d072cb27b..2624a4bda08 100644 --- a/docs/src/maintainer-guide/issues.md +++ b/docs/src/maintainer-guide/issues.md @@ -1,9 +1,4 @@ ---- -title: Managing Issues -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/issues.md - ---- +# Managing Issues New issues are filed frequently, and how we respond to those issues directly affects the success of the project. Being part of the project team means helping to triage and address issues as they come in so the project can continue to run smoothly. diff --git a/docs/src/maintainer-guide/pullrequests.md b/docs/src/maintainer-guide/pullrequests.md index 719c8dc013c..2d3b13bf0d9 100644 --- a/docs/src/maintainer-guide/pullrequests.md +++ b/docs/src/maintainer-guide/pullrequests.md @@ -1,9 +1,4 @@ ---- -title: Reviewing Pull Requests -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/pullrequests.md - ---- +# Reviewing Pull Requests Pull requests are submitted frequently and represent our best opportunity to interact with the community. As such, it's important that pull requests are well-reviewed before being merged and that interactions on pull requests are positive. diff --git a/docs/src/maintainer-guide/releases.md b/docs/src/maintainer-guide/releases.md index 5b8cdfbb4f0..d406475bed3 100644 --- a/docs/src/maintainer-guide/releases.md +++ b/docs/src/maintainer-guide/releases.md @@ -1,9 +1,4 @@ ---- -title: Managing Releases -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/releases.md - ---- +# Managing Releases Releases are when a project formally publishes a new version so the community can use it. There are two types of releases: diff --git a/docs/src/maintainer-guide/working-groups.md b/docs/src/maintainer-guide/working-groups.md index 1f6d43a675d..d6d22fb6c20 100644 --- a/docs/src/maintainer-guide/working-groups.md +++ b/docs/src/maintainer-guide/working-groups.md @@ -1,9 +1,4 @@ ---- -title: Working Groups -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/maintainer-guide/working-groups.md - ---- +# Working Groups The ESLint TSC may form working groups to focus on a specific area of the project. diff --git a/docs/src/pages/index.md b/docs/src/pages/index.md index fa9f617f177..8f5223a74d8 100644 --- a/docs/src/pages/index.md +++ b/docs/src/pages/index.md @@ -1,8 +1,4 @@ ---- -title: Documentation -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/pages/index.md ---- +# Documentation Welcome to our documentation pages! What would you like to view? diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index b5d5ece3d13..03adbd58e74 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -1,9 +1,4 @@ ---- -title: accessor-pairs -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/accessor-pairs.md -rule_type: suggestion ---- +# accessor-pairs Enforces getter/setter pairs in objects and classes. @@ -280,9 +275,9 @@ var o = { The code above creates an object with just a setter for the property `"a"`. -See [no-dupe-keys](no-dupe-keys) if you also want to disallow duplicate keys in object literals. +See [no-dupe-keys](no-dupe-keys.md) 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. +See [no-dupe-class-members](no-dupe-class-members.md) if you also want to disallow duplicate names in class definitions. ## When Not To Use It @@ -290,8 +285,8 @@ You can turn this rule off if you are not concerned with the simultaneous presen ## Related Rules -* [no-dupe-keys](no-dupe-keys) -* [no-dupe-class-members](no-dupe-class-members) +* [no-dupe-keys](no-dupe-keys.md) +* [no-dupe-class-members](no-dupe-class-members.md) ## Further Reading diff --git a/docs/src/rules/array-bracket-newline.md b/docs/src/rules/array-bracket-newline.md index 54be1569819..cdcc07b12a1 100644 --- a/docs/src/rules/array-bracket-newline.md +++ b/docs/src/rules/array-bracket-newline.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# array-bracket-newline Enforces line breaks after opening and before closing array brackets. @@ -282,7 +275,7 @@ If you don't want to enforce line breaks after opening and before closing array ## Related Rules -* [array-bracket-spacing](array-bracket-spacing) +* [array-bracket-spacing](array-bracket-spacing.md) ## Compatibility diff --git a/docs/src/rules/array-bracket-spacing.md b/docs/src/rules/array-bracket-spacing.md index 825557f070a..0c2659d716c 100644 --- a/docs/src/rules/array-bracket-spacing.md +++ b/docs/src/rules/array-bracket-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# array-bracket-spacing Disallows or enforce spaces inside of brackets. @@ -227,6 +220,6 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [space-in-parens](space-in-parens) -* [object-curly-spacing](object-curly-spacing) -* [computed-property-spacing](computed-property-spacing) +* [space-in-parens](space-in-parens.md) +* [object-curly-spacing](object-curly-spacing.md) +* [computed-property-spacing](computed-property-spacing.md) diff --git a/docs/src/rules/array-callback-return.md b/docs/src/rules/array-callback-return.md index a269a53b5f3..264d16be1b5 100644 --- a/docs/src/rules/array-callback-return.md +++ b/docs/src/rules/array-callback-return.md @@ -1,9 +1,4 @@ ---- -title: array-callback-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/array-callback-return.md -rule_type: problem ---- +# array-callback-return Enforces return statements in callbacks of array's methods. diff --git a/docs/src/rules/array-element-newline.md b/docs/src/rules/array-element-newline.md index 66db0024834..9c99fb7881d 100644 --- a/docs/src/rules/array-element-newline.md +++ b/docs/src/rules/array-element-newline.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# array-element-newline Enforces line breaks between array elements. @@ -385,14 +378,14 @@ If you don't want to enforce linebreaks between array elements, don't enable thi ## 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) +* [array-bracket-spacing](array-bracket-spacing.md) +* [array-bracket-newline](array-bracket-newline.md) +* [object-property-newline](object-property-newline.md) +* [object-curly-spacing](object-curly-spacing.md) +* [object-curly-newline](object-curly-newline.md) +* [max-statements-per-line](max-statements-per-line.md) +* [block-spacing](block-spacing.md) +* [brace-style](brace-style.md) ## Compatibility diff --git a/docs/src/rules/arrow-body-style.md b/docs/src/rules/arrow-body-style.md index 68876696fce..f257ccaec1d 100644 --- a/docs/src/rules/arrow-body-style.md +++ b/docs/src/rules/arrow-body-style.md @@ -1,11 +1,4 @@ ---- -title: arrow-body-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/arrow-body-style.md -rule_type: suggestion ---- - - +# arrow-body-style Requires braces in arrow function bodies. diff --git a/docs/src/rules/arrow-parens.md b/docs/src/rules/arrow-parens.md index 856bcb8f8ee..c8068742939 100644 --- a/docs/src/rules/arrow-parens.md +++ b/docs/src/rules/arrow-parens.md @@ -1,11 +1,4 @@ ---- -title: arrow-parens -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/arrow-parens.md -rule_type: layout ---- - - +# arrow-parens Requires parens in arrow function arguments. diff --git a/docs/src/rules/arrow-spacing.md b/docs/src/rules/arrow-spacing.md index c6453d11e6d..27f49397539 100644 --- a/docs/src/rules/arrow-spacing.md +++ b/docs/src/rules/arrow-spacing.md @@ -1,11 +1,4 @@ ---- -title: arrow-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/arrow-spacing.md -rule_type: layout ---- - - +# arrow-spacing Requires space before/after arrow function's arrow. diff --git a/docs/src/rules/block-scoped-var.md b/docs/src/rules/block-scoped-var.md index e23310547d0..412da19ea6a 100644 --- a/docs/src/rules/block-scoped-var.md +++ b/docs/src/rules/block-scoped-var.md @@ -1,9 +1,4 @@ ---- -title: block-scoped-var -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/block-scoped-var.md -rule_type: suggestion ---- +# block-scoped-var Enforces treating `var` as block scoped. diff --git a/docs/src/rules/block-spacing.md b/docs/src/rules/block-spacing.md index e07b7652dcb..663a99d5427 100644 --- a/docs/src/rules/block-spacing.md +++ b/docs/src/rules/block-spacing.md @@ -1,11 +1,4 @@ ---- -title: block-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/block-spacing.md -rule_type: layout ---- - - +# block-spacing Disallows or enforces spaces inside of blocks after opening blocks and before closing blocks. @@ -85,5 +78,5 @@ If you don't want to be notified about spacing style inside of blocks, you can s ## Related Rules -* [space-before-blocks](space-before-blocks) -* [brace-style](brace-style) +* [space-before-blocks](space-before-blocks.md) +* [brace-style](brace-style.md) diff --git a/docs/src/rules/brace-style.md b/docs/src/rules/brace-style.md index 6b69184fd19..0c5502abb5c 100644 --- a/docs/src/rules/brace-style.md +++ b/docs/src/rules/brace-style.md @@ -1,11 +1,4 @@ ---- -title: brace-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/brace-style.md -rule_type: layout ---- - - +# brace-style Enforces consistent brace style for blocks. @@ -395,8 +388,8 @@ 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) +* [block-spacing](block-spacing.md) +* [space-before-blocks](space-before-blocks.md) ## Further Reading diff --git a/docs/src/rules/callback-return.md b/docs/src/rules/callback-return.md index 7acf5dc9c67..d375e37d39e 100644 --- a/docs/src/rules/callback-return.md +++ b/docs/src/rules/callback-return.md @@ -1,9 +1,4 @@ ---- -title: callback-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/callback-return.md -rule_type: suggestion ---- +# callback-return Enforces return after callback. @@ -174,7 +169,7 @@ There are some cases where you might want to call a callback function more than ## Related Rules -* [handle-callback-err](handle-callback-err) +* [handle-callback-err](handle-callback-err.md) ## Further Reading diff --git a/docs/src/rules/camelcase.md b/docs/src/rules/camelcase.md index 83843c34bd2..a79ef401261 100644 --- a/docs/src/rules/camelcase.md +++ b/docs/src/rules/camelcase.md @@ -1,9 +1,4 @@ ---- -title: camelcase -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/camelcase.md -rule_type: suggestion ---- +# camelcase Enforces camelcase naming convention. diff --git a/docs/src/rules/capitalized-comments.md b/docs/src/rules/capitalized-comments.md index 601de8864e2..4de1556f5fe 100644 --- a/docs/src/rules/capitalized-comments.md +++ b/docs/src/rules/capitalized-comments.md @@ -1,11 +1,4 @@ ---- -title: capitalized-comments -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/capitalized-comments.md -rule_type: suggestion ---- - - +# capitalized-comments Enforces or disallows capitalization of the first letter of a comment. diff --git a/docs/src/rules/class-methods-use-this.md b/docs/src/rules/class-methods-use-this.md index 350e0f7c3d0..663ed65bbea 100644 --- a/docs/src/rules/class-methods-use-this.md +++ b/docs/src/rules/class-methods-use-this.md @@ -1,9 +1,4 @@ ---- -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 ---- +# class-methods-use-this Enforces that class methods utilize `this`. diff --git a/docs/src/rules/comma-dangle.md b/docs/src/rules/comma-dangle.md index a40f1cb76ca..f215b70dbc0 100644 --- a/docs/src/rules/comma-dangle.md +++ b/docs/src/rules/comma-dangle.md @@ -1,11 +1,4 @@ ---- -title: comma-dangle -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/comma-dangle.md -rule_type: layout ---- - - +# comma-dangle Requires or disallows trailing commas. diff --git a/docs/src/rules/comma-spacing.md b/docs/src/rules/comma-spacing.md index 2463c9bb9e8..d7566aee431 100644 --- a/docs/src/rules/comma-spacing.md +++ b/docs/src/rules/comma-spacing.md @@ -1,11 +1,4 @@ ---- -title: comma-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/comma-spacing.md -rule_type: layout ---- - - +# comma-spacing Enforces spacing around commas. @@ -23,7 +16,7 @@ This rule enforces consistent spacing before and after commas in variable declar This rule does not apply in an `ArrayExpression` or `ArrayPattern` in either of the following cases: * adjacent null elements -* an initial null element, to avoid conflicts with the [`array-bracket-spacing`](array-bracket-spacing) rule +* an initial null element, to avoid conflicts with the [`array-bracket-spacing`](array-bracket-spacing.md) rule ## Options @@ -121,14 +114,14 @@ If your project will not be following a consistent comma-spacing pattern, turn t ## 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) +* [array-bracket-spacing](array-bracket-spacing.md) +* [comma-style](comma-style.md) +* [space-in-brackets](space-in-brackets.md) (deprecated) +* [space-in-parens](space-in-parens.md) +* [space-infix-ops](space-infix-ops.md) +* [space-after-keywords](space-after-keywords.md) +* [space-unary-ops](space-unary-ops.md) +* [space-return-throw-case](space-return-throw-case.md) ## Further Reading diff --git a/docs/src/rules/comma-style.md b/docs/src/rules/comma-style.md index 4ce1979c974..75419a3ac23 100644 --- a/docs/src/rules/comma-style.md +++ b/docs/src/rules/comma-style.md @@ -1,11 +1,4 @@ ---- -title: comma-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/comma-style.md -rule_type: layout ---- - - +# comma-style Enforces consistent comma styles. @@ -168,7 +161,7 @@ This rule can safely be turned off if your project does not care about enforcing ## Related Rules -* [operator-linebreak](operator-linebreak) +* [operator-linebreak](operator-linebreak.md) ## Further Reading diff --git a/docs/src/rules/complexity.md b/docs/src/rules/complexity.md index 16a2e05651b..a993aec00e8 100644 --- a/docs/src/rules/complexity.md +++ b/docs/src/rules/complexity.md @@ -1,9 +1,4 @@ ---- -title: complexity -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/complexity.md -rule_type: suggestion ---- +# complexity Enforces a maximum cyclomatic complexity. @@ -133,13 +128,13 @@ If you can't determine an appropriate complexity limit for your code, then it's ## 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) +* [max-depth](max-depth.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) ## Further Reading diff --git a/docs/src/rules/computed-property-spacing.md b/docs/src/rules/computed-property-spacing.md index f9f97f4993e..beae783941a 100644 --- a/docs/src/rules/computed-property-spacing.md +++ b/docs/src/rules/computed-property-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# computed-property-spacing Disallows or enforces spaces inside of computed properties. @@ -183,6 +176,6 @@ You can turn this rule off if you are not concerned with the consistency of comp ## Related Rules -* [array-bracket-spacing](array-bracket-spacing) -* [comma-spacing](comma-spacing) -* [space-in-parens](space-in-parens) +* [array-bracket-spacing](array-bracket-spacing.md) +* [comma-spacing](comma-spacing.md) +* [space-in-parens](space-in-parens.md) diff --git a/docs/src/rules/consistent-return.md b/docs/src/rules/consistent-return.md index 76cf86f0ba2..8028b7af001 100644 --- a/docs/src/rules/consistent-return.md +++ b/docs/src/rules/consistent-return.md @@ -1,9 +1,4 @@ ---- -title: consistent-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/consistent-return.md -rule_type: suggestion ---- +# consistent-return Requires `return` statements to either always or never specify values. diff --git a/docs/src/rules/consistent-this.md b/docs/src/rules/consistent-this.md index 18ff87ea1eb..46d5ecf2c7a 100644 --- a/docs/src/rules/consistent-this.md +++ b/docs/src/rules/consistent-this.md @@ -1,9 +1,4 @@ ---- -title: consistent-this -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/consistent-this.md -rule_type: suggestion ---- +# consistent-this Enforces consistent naming when capturing the current execution context. diff --git a/docs/src/rules/constructor-super.md b/docs/src/rules/constructor-super.md index c6510372b4f..80471e3dfc7 100644 --- a/docs/src/rules/constructor-super.md +++ b/docs/src/rules/constructor-super.md @@ -1,11 +1,4 @@ ---- -title: constructor-super -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/constructor-super.md -rule_type: problem ---- - - +# constructor-super Verifies calls of `super()` in constructors. diff --git a/docs/src/rules/curly.md b/docs/src/rules/curly.md index e7f7dd0b1a8..6eb76071f9b 100644 --- a/docs/src/rules/curly.md +++ b/docs/src/rules/curly.md @@ -1,11 +1,4 @@ ---- -title: curly -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/curly.md -rule_type: suggestion ---- - - +# curly Requires following curly brace conventions. diff --git a/docs/src/rules/default-case-last.md b/docs/src/rules/default-case-last.md index a75b1ebbb71..e626715854a 100644 --- a/docs/src/rules/default-case-last.md +++ b/docs/src/rules/default-case-last.md @@ -1,9 +1,4 @@ ---- -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 ---- +# default-case-last Enforces default clauses in switch statements to be last. @@ -21,7 +16,7 @@ This rule enforces `default` clauses in `switch` statements to be last. It applies only to `switch` statements that already have a `default` clause. -This rule does not enforce the existence of `default` clauses. See [default-case](default-case) if you also want to enforce the existence of `default` clauses in `switch` statements. +This rule does not enforce the existence of `default` clauses. See [default-case](default-case.md) if you also want to enforce the existence of `default` clauses in `switch` statements. Examples of **incorrect** code for this rule: @@ -125,7 +120,7 @@ doSomethingAnyway(); ## Related Rules -* [default-case](default-case) +* [default-case](default-case.md) ## Further Reading diff --git a/docs/src/rules/default-case.md b/docs/src/rules/default-case.md index 9e389ca2ffa..d6d2110f7f3 100644 --- a/docs/src/rules/default-case.md +++ b/docs/src/rules/default-case.md @@ -1,9 +1,4 @@ ---- -title: default-case -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/default-case.md -rule_type: suggestion ---- +# default-case Requires a `default` case in switch statements. @@ -76,6 +71,7 @@ switch (a) { break; } + switch (a) { case 1: /* code */ @@ -129,4 +125,4 @@ If you don't want to enforce a `default` case for `switch` statements, you can s ## Related Rules -* [no-fallthrough](no-fallthrough) +* [no-fallthrough](no-fallthrough.md) diff --git a/docs/src/rules/default-param-last.md b/docs/src/rules/default-param-last.md index a2eea8ea37a..3944d27bbb3 100644 --- a/docs/src/rules/default-param-last.md +++ b/docs/src/rules/default-param-last.md @@ -1,9 +1,4 @@ ---- -title: default-param-last -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/default-param-last.md -rule_type: suggestion ---- +# default-param-last Enforces default parameters to be last. diff --git a/docs/src/rules/dot-location.md b/docs/src/rules/dot-location.md index 2193e6745db..b8285664b26 100644 --- a/docs/src/rules/dot-location.md +++ b/docs/src/rules/dot-location.md @@ -1,11 +1,4 @@ ---- -title: dot-location -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/dot-location.md -rule_type: layout ---- - - +# dot-location Enforces newline before and after dots. @@ -90,5 +83,5 @@ You can turn this rule off if you are not concerned with the consistency of newl ## Related Rules -* [newline-after-var](newline-after-var) -* [dot-notation](dot-notation) +* [newline-after-var](newline-after-var.md) +* [dot-notation](dot-notation.md) diff --git a/docs/src/rules/dot-notation.md b/docs/src/rules/dot-notation.md index d386b4df4e6..3495b0a4dc0 100644 --- a/docs/src/rules/dot-notation.md +++ b/docs/src/rules/dot-notation.md @@ -1,11 +1,4 @@ ---- -title: dot-notation -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/dot-notation.md -rule_type: suggestion ---- - - +# dot-notation Enforces dot notation whenever possible. diff --git a/docs/src/rules/eol-last.md b/docs/src/rules/eol-last.md index 58d8955dd86..63fbee0a007 100644 --- a/docs/src/rules/eol-last.md +++ b/docs/src/rules/eol-last.md @@ -1,11 +1,4 @@ ---- -title: eol-last -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/eol-last.md -rule_type: layout ---- - - +# eol-last Requires or disallows newline at the end of files. @@ -20,8 +13,8 @@ of non-empty files. Prior to v0.16.0 this rule also enforced that there was only a single line at the end of the file. If you still want this behavior, consider enabling -[no-multiple-empty-lines](no-multiple-empty-lines) with `maxEOF` and/or -[no-trailing-spaces](no-trailing-spaces). +[no-multiple-empty-lines](no-multiple-empty-lines.md) with `maxEOF` and/or +[no-trailing-spaces](no-trailing-spaces.md). Examples of **incorrect** code for this rule: diff --git a/docs/src/rules/eqeqeq.md b/docs/src/rules/eqeqeq.md index 6874896ada0..ec6932957fe 100644 --- a/docs/src/rules/eqeqeq.md +++ b/docs/src/rules/eqeqeq.md @@ -1,11 +1,4 @@ ---- -title: eqeqeq -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/eqeqeq.md -rule_type: suggestion ---- - - +# eqeqeq Requires the use of `===` and `!==`. diff --git a/docs/src/rules/for-direction.md b/docs/src/rules/for-direction.md index f349d2662b8..6b0c68f4500 100644 --- a/docs/src/rules/for-direction.md +++ b/docs/src/rules/for-direction.md @@ -1,11 +1,4 @@ ---- -title: for-direction -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/for-direction.md -rule_type: problem ---- - - +# for-direction Enforces `for` loop update clause moving the counter in the right direction. diff --git a/docs/src/rules/func-call-spacing.md b/docs/src/rules/func-call-spacing.md index 775655aa957..a5b2db9c619 100644 --- a/docs/src/rules/func-call-spacing.md +++ b/docs/src/rules/func-call-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# func-call-spacing Requires or disallows spacing between function identifiers and their invocations. @@ -106,7 +99,7 @@ This rule can safely be turned off if your project does not care about enforcing ## Related Rules -* [no-spaced-func](no-spaced-func) (deprecated) +* [no-spaced-func](no-spaced-func.md) (deprecated) ## Compatibility diff --git a/docs/src/rules/func-name-matching.md b/docs/src/rules/func-name-matching.md index 21217c7140c..d1b85c926f6 100644 --- a/docs/src/rules/func-name-matching.md +++ b/docs/src/rules/func-name-matching.md @@ -1,9 +1,4 @@ ---- -title: func-name-matching -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-name-matching.md -rule_type: suggestion ---- +# func-name-matching Requires function names to match the name of the variable or property to which they are assigned. diff --git a/docs/src/rules/func-names.md b/docs/src/rules/func-names.md index 4c2e87caeae..48f3ba2e871 100644 --- a/docs/src/rules/func-names.md +++ b/docs/src/rules/func-names.md @@ -1,9 +1,4 @@ ---- -title: func-names -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-names.md -rule_type: suggestion ---- +# func-names Requires or disallows named `function` expressions. diff --git a/docs/src/rules/func-style.md b/docs/src/rules/func-style.md index f2babc4c94f..a157f499658 100644 --- a/docs/src/rules/func-style.md +++ b/docs/src/rules/func-style.md @@ -1,9 +1,4 @@ ---- -title: func-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/func-style.md -rule_type: suggestion ---- +# func-style Enforces the consistent use of either `function` declarations or expressions. diff --git a/docs/src/rules/function-call-argument-newline.md b/docs/src/rules/function-call-argument-newline.md index 834eebc12e6..8e5bb17dae9 100644 --- a/docs/src/rules/function-call-argument-newline.md +++ b/docs/src/rules/function-call-argument-newline.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# function-call-argument-newline Enforces line breaks between arguments of a function call. @@ -202,7 +195,7 @@ If you don't want to enforce line breaks between arguments, don't enable this ru ## 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) +* [function-paren-newline](function-paren-newline.md) +* [func-call-spacing](func-call-spacing.md) +* [object-property-newline](object-property-newline.md) +* [array-element-newline](array-element-newline.md) diff --git a/docs/src/rules/function-paren-newline.md b/docs/src/rules/function-paren-newline.md index 3c3f04d569e..9447e957dad 100644 --- a/docs/src/rules/function-paren-newline.md +++ b/docs/src/rules/function-paren-newline.md @@ -1,11 +1,4 @@ ---- -title: function-paren-newline -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/function-paren-newline.md -rule_type: layout ---- - - +# function-paren-newline Enforces consistent line breaks inside function parentheses. diff --git a/docs/src/rules/generator-star-spacing.md b/docs/src/rules/generator-star-spacing.md index f30cb587db9..e61ff04e824 100644 --- a/docs/src/rules/generator-star-spacing.md +++ b/docs/src/rules/generator-star-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# generator-star-spacing Enforces spacing around the `*` in generator functions. diff --git a/docs/src/rules/generator-star.md b/docs/src/rules/generator-star.md index 0cddfddd49e..fd0af59395b 100644 --- a/docs/src/rules/generator-star.md +++ b/docs/src/rules/generator-star.md @@ -1,12 +1,8 @@ ---- -title: generator-star -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/generator-star.md ---- +# generator-star Enforces consistent spacing around the asterisk in generator functions. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [generator-star-spacing](generator-star-spacing) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [generator-star-spacing](generator-star-spacing.md) rule. Generators are a new type of function in ECMAScript 6 that can return multiple values over time. These special functions are indicated by placing an `*` after the `function` keyword. diff --git a/docs/src/rules/getter-return.md b/docs/src/rules/getter-return.md index 55fc49cda3e..3d8d23594d1 100644 --- a/docs/src/rules/getter-return.md +++ b/docs/src/rules/getter-return.md @@ -1,11 +1,4 @@ ---- -title: getter-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/getter-return.md -rule_type: problem ---- - - +# getter-return Enforces that a `return` statement is present in property getters. diff --git a/docs/src/rules/global-require.md b/docs/src/rules/global-require.md index 0650cb07eaf..0312a91cb73 100644 --- a/docs/src/rules/global-require.md +++ b/docs/src/rules/global-require.md @@ -1,9 +1,4 @@ ---- -title: global-require -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/global-require.md -rule_type: suggestion ---- +# global-require Enforces `require()` on the top-level module scope. diff --git a/docs/src/rules/global-strict.md b/docs/src/rules/global-strict.md index 856b58d856d..4be8d7f960b 100644 --- a/docs/src/rules/global-strict.md +++ b/docs/src/rules/global-strict.md @@ -1,13 +1,8 @@ ---- -title: global-strict -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/global-strict.md - ---- +# global-strict Requires or disallows strict mode directives in the global scope. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict) rule. The `"global"` option in the new rule is most similar to the removed rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict.md) rule. The `"global"` option in the new rule is most similar to the removed rule. Strict mode is enabled by using the following pragma in your code: diff --git a/docs/src/rules/grouped-accessor-pairs.md b/docs/src/rules/grouped-accessor-pairs.md index 92dc21a2f84..c46c18f6ee1 100644 --- a/docs/src/rules/grouped-accessor-pairs.md +++ b/docs/src/rules/grouped-accessor-pairs.md @@ -1,9 +1,4 @@ ---- -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 ---- +# grouped-accessor-pairs Requires grouped accessor pairs in object literals and classes. @@ -43,7 +38,7 @@ This rule requires grouped definitions of accessor functions for the same proper Optionally, this rule can also enforce consistent order (`getBeforeSet` or `setBeforeGet`). -This rule does not enforce the existence of the pair for a getter or a setter. See [accessor-pairs](accessor-pairs) if you also want to enforce getter/setter pairs. +This rule does not enforce the existence of the pair for a getter or a setter. See [accessor-pairs](accessor-pairs.md) if you also want to enforce getter/setter pairs. Examples of **incorrect** code for this rule: @@ -316,15 +311,15 @@ var bar = { Also, this rule does not report any warnings for properties that have duplicate getters or setters. -See [no-dupe-keys](no-dupe-keys) if you also want to disallow duplicate keys in object literals. +See [no-dupe-keys](no-dupe-keys.md) 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. +See [no-dupe-class-members](no-dupe-class-members.md) 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) +* [accessor-pairs](accessor-pairs.md) +* [no-dupe-keys](no-dupe-keys.md) +* [no-dupe-class-members](no-dupe-class-members.md) ## Further Reading diff --git a/docs/src/rules/guard-for-in.md b/docs/src/rules/guard-for-in.md index 1a39d52214c..36287a522a3 100644 --- a/docs/src/rules/guard-for-in.md +++ b/docs/src/rules/guard-for-in.md @@ -1,9 +1,4 @@ ---- -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 ---- +# guard-for-in Requires `for in` loops to include an `if` statement. @@ -15,7 +10,7 @@ for (key in foo) { } ``` -Note that simply checking `foo.hasOwnProperty(key)` is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins). +Note that simply checking `foo.hasOwnProperty(key)` is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md). ## Rule Details @@ -51,7 +46,7 @@ for (key in foo) { ## Related Rules -* [no-prototype-builtins](no-prototype-builtins) +* [no-prototype-builtins](no-prototype-builtins.md) ## Further Reading diff --git a/docs/src/rules/handle-callback-err.md b/docs/src/rules/handle-callback-err.md index 64db6d074f2..d1346cb6e0e 100644 --- a/docs/src/rules/handle-callback-err.md +++ b/docs/src/rules/handle-callback-err.md @@ -1,9 +1,4 @@ ---- -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 ---- +# handle-callback-err Enforces callback error handling. diff --git a/docs/src/rules/id-blacklist.md b/docs/src/rules/id-blacklist.md index bfb44e22a55..12bac041c8c 100644 --- a/docs/src/rules/id-blacklist.md +++ b/docs/src/rules/id-blacklist.md @@ -1,10 +1,5 @@ ---- -title: id-blacklist -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/id-blacklist.md -rule_type: suggestion ---- +# id-blacklist Disallows specified identifiers. -This rule was **deprecated** in ESLint v7.5.0 and replaced by the [id-denylist](id-denylist) rule. +This rule was **deprecated** in ESLint v7.5.0 and replaced by the [id-denylist](id-denylist.md) rule. diff --git a/docs/src/rules/id-denylist.md b/docs/src/rules/id-denylist.md index c5678a50fd5..283efb6ffeb 100644 --- a/docs/src/rules/id-denylist.md +++ b/docs/src/rules/id-denylist.md @@ -1,9 +1,4 @@ ---- -title: id-denylist -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/id-denylist.md -rule_type: suggestion ---- +# id-denylist Disallows specified identifiers. diff --git a/docs/src/rules/id-length.md b/docs/src/rules/id-length.md index ba2051a584d..c3450db1f50 100644 --- a/docs/src/rules/id-length.md +++ b/docs/src/rules/id-length.md @@ -1,9 +1,4 @@ ---- -title: id-length -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/id-length.md -rule_type: suggestion ---- +# id-length Enforces minimum and maximum identifier lengths. @@ -256,7 +251,7 @@ const { a: z } = foo; ## Related Rules -* [max-len](max-len) -* [new-cap](new-cap) -* [func-names](func-names) -* [camelcase](camelcase) +* [max-len](max-len.md) +* [new-cap](new-cap.md) +* [func-names](func-names.md) +* [camelcase](camelcase.md) diff --git a/docs/src/rules/id-match.md b/docs/src/rules/id-match.md index 606a605d400..016466e4167 100644 --- a/docs/src/rules/id-match.md +++ b/docs/src/rules/id-match.md @@ -1,9 +1,4 @@ ---- -title: id-match -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/id-match.md -rule_type: suggestion ---- +# id-match Requires identifiers to match a specified regular expression. diff --git a/docs/src/rules/implicit-arrow-linebreak.md b/docs/src/rules/implicit-arrow-linebreak.md index 876f9696508..bc3fbf4dd6d 100644 --- a/docs/src/rules/implicit-arrow-linebreak.md +++ b/docs/src/rules/implicit-arrow-linebreak.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# implicit-arrow-linebreak Enforces the location of arrow function bodies with implicit returns. @@ -87,6 +80,7 @@ Examples of **correct** code for this rule with the `"below"` option: ```js /* eslint implicit-arrow-linebreak: ["error", "below"] */ + (foo) => bar; @@ -102,8 +96,8 @@ 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. +You can also disable this rule if you are using the `"always"` option for the [`arrow-body-style`](arrow-body-style.md), 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. +* [`brace-style`](brace-style.md) which enforces this behavior for arrow functions with block bodies. diff --git a/docs/src/rules/indent-legacy.md b/docs/src/rules/indent-legacy.md index d63b125a65b..053136bd0ad 100644 --- a/docs/src/rules/indent-legacy.md +++ b/docs/src/rules/indent-legacy.md @@ -1,11 +1,4 @@ ---- -title: indent-legacy -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/indent-legacy.md -rule_type: layout ---- - - +# indent-legacy Enforces consistent indentation. @@ -256,6 +249,7 @@ Examples of **incorrect** code for this rule with the options `2, { "outerIIFEBo })(); + if(y) { console.log('foo'); } @@ -274,6 +268,7 @@ function foo(x) { })(); + if(y) { console.log('foo'); } diff --git a/docs/src/rules/indent.md b/docs/src/rules/indent.md index 2b83a5d3d11..f8dc70aa22c 100644 --- a/docs/src/rules/indent.md +++ b/docs/src/rules/indent.md @@ -1,11 +1,4 @@ ---- -title: indent -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/indent.md -rule_type: layout ---- - - +# indent Enforces consistent indentation. @@ -77,7 +70,7 @@ if (a) { This rule has an object option: -* `"ignoredNodes"` can be used to disable indentation checking for any AST node. This accepts an array of [selectors](/docs/developer-guide/selectors). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. +* `"ignoredNodes"` can be used to disable indentation checking for any AST node. This accepts an array of [selectors](/docs/developer-guide/selectors.md). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. * `"SwitchCase"` (default: 0) enforces indentation level for `case` clauses in `switch` statements * `"VariableDeclarator"` (default: 1) enforces indentation level for `var` declarators; can also take an object to define separate rules for `var`, `let` and `const` declarations. It can also be `"first"`, indicating all the declarators should be aligned with the first declarator. * `"outerIIFEBody"` (default: 1) enforces indentation level for file-level IIFEs. This can also be set to `"off"` to disable checking for file-level IIFEs. @@ -326,6 +319,7 @@ Examples of **incorrect** code for this rule with the options `2, { "outerIIFEBo })(); + if (y) { console.log('foo'); } @@ -344,6 +338,7 @@ function foo(x) { })(); + if (y) { console.log('foo'); } diff --git a/docs/src/rules/init-declarations.md b/docs/src/rules/init-declarations.md index c5d5c88be34..b9031529c2e 100644 --- a/docs/src/rules/init-declarations.md +++ b/docs/src/rules/init-declarations.md @@ -1,9 +1,4 @@ ---- -title: init-declarations -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/init-declarations.md -rule_type: suggestion ---- +# init-declarations Requires or disallows initialization in variable declarations. diff --git a/docs/src/rules/jsx-quotes.md b/docs/src/rules/jsx-quotes.md index 91cc4501eeb..25e7bafd111 100644 --- a/docs/src/rules/jsx-quotes.md +++ b/docs/src/rules/jsx-quotes.md @@ -1,11 +1,4 @@ ---- -title: jsx-quotes -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/jsx-quotes.md -rule_type: layout ---- - - +# jsx-quotes Enforces the consistent use of either double or single quotes in JSX attributes. @@ -79,4 +72,4 @@ You can turn this rule off if you don’t use JSX or if you aren’t concerned w ## Related Rules -* [quotes](quotes) +* [quotes](quotes.md) diff --git a/docs/src/rules/key-spacing.md b/docs/src/rules/key-spacing.md index 59de8f0a296..f4668142c05 100644 --- a/docs/src/rules/key-spacing.md +++ b/docs/src/rules/key-spacing.md @@ -1,11 +1,4 @@ ---- -title: key-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/key-spacing.md -rule_type: layout ---- - - +# key-spacing Enforces consistent spacing between keys and values in object literal properties. diff --git a/docs/src/rules/keyword-spacing.md b/docs/src/rules/keyword-spacing.md index d48990c31e6..71d372b3596 100644 --- a/docs/src/rules/keyword-spacing.md +++ b/docs/src/rules/keyword-spacing.md @@ -1,11 +1,4 @@ ---- -title: keyword-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/keyword-spacing.md -rule_type: layout ---- - - +# keyword-spacing Enforces consistent spacing before and after keywords. @@ -24,7 +17,7 @@ if (foo) { Of course, you could also have a style guide that disallows spaces around keywords. -However, if you want to enforce the style of spacing between the `function` keyword and the following opening parenthesis, please refer to [space-before-function-paren](space-before-function-paren). +However, if you want to enforce the style of spacing between the `function` keyword and the following opening parenthesis, please refer to [space-before-function-paren](space-before-function-paren.md). ## Rule Details diff --git a/docs/src/rules/line-comment-position.md b/docs/src/rules/line-comment-position.md index 7c033e398b5..d18dc927ed9 100644 --- a/docs/src/rules/line-comment-position.md +++ b/docs/src/rules/line-comment-position.md @@ -1,9 +1,4 @@ ---- -title: line-comment-position -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/line-comment-position.md -rule_type: layout ---- +# line-comment-position Enforces position of line comments. diff --git a/docs/src/rules/linebreak-style.md b/docs/src/rules/linebreak-style.md index 0549f9510f4..2c823a5c75f 100644 --- a/docs/src/rules/linebreak-style.md +++ b/docs/src/rules/linebreak-style.md @@ -1,11 +1,4 @@ ---- -title: linebreak-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/linebreak-style.md -rule_type: layout ---- - - +# linebreak-style Enforces consistent linebreak style. diff --git a/docs/src/rules/lines-around-comment.md b/docs/src/rules/lines-around-comment.md index 2cb707e185e..759c50c382d 100644 --- a/docs/src/rules/lines-around-comment.md +++ b/docs/src/rules/lines-around-comment.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# lines-around-comment Requires empty lines around comments. @@ -536,6 +529,7 @@ foo(); /* eslint mentioned in this comment */, bar(); + /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */ foo(); @@ -580,5 +574,5 @@ Many people enjoy a terser code style and don't mind comments bumping up against ## Related Rules -* [space-before-blocks](space-before-blocks) -* [spaced-comment](spaced-comment) +* [space-before-blocks](space-before-blocks.md) +* [spaced-comment](spaced-comment.md) diff --git a/docs/src/rules/lines-around-directive.md b/docs/src/rules/lines-around-directive.md index 4f8b7fc1df0..e88e0707faa 100644 --- a/docs/src/rules/lines-around-directive.md +++ b/docs/src/rules/lines-around-directive.md @@ -1,15 +1,8 @@ ---- -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 ---- - - +# lines-around-directive Requires or disallow newlines around directives. -This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule. +This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements.md) rule. Directives are used in JavaScript to indicate to the execution environment that a script would like to opt into a feature such as `"strict mode"`. Directives are grouped together in a [directive prologue](https://www.ecma-international.org/ecma-262/7.0/#directive-prologue) at the top of either a file or function block and are applied to the scope in which they occur. @@ -37,7 +30,7 @@ function bar() { ## Rule Details -This rule requires or disallows blank newlines around directive prologues. This rule does not enforce any conventions about blank newlines between the individual directives. In addition, it does not require blank newlines before directive prologues unless they are preceded by a comment. Please use the [padded-blocks](padded-blocks) rule if this is a style you would like to enforce. +This rule requires or disallows blank newlines around directive prologues. This rule does not enforce any conventions about blank newlines between the individual directives. In addition, it does not require blank newlines before directive prologues unless they are preceded by a comment. Please use the [padded-blocks](padded-blocks.md) rule if this is a style you would like to enforce. ## Options @@ -134,6 +127,7 @@ Examples of **incorrect** code for this rule with the `"never"` option: var foo; + /* Top of file */ // comment @@ -142,6 +136,7 @@ var foo; var foo; + function foo() { "use strict"; "use asm"; @@ -149,6 +144,7 @@ function foo() { var bar; } + function foo() { // comment @@ -319,8 +315,8 @@ You can safely disable this rule if you do not have any strict conventions about ## Related Rules -* [lines-around-comment](lines-around-comment) -* [padded-blocks](padded-blocks) +* [lines-around-comment](lines-around-comment.md) +* [padded-blocks](padded-blocks.md) ## Compatibility diff --git a/docs/src/rules/lines-between-class-members.md b/docs/src/rules/lines-between-class-members.md index 05a2c90cedd..0654a3953b1 100644 --- a/docs/src/rules/lines-between-class-members.md +++ b/docs/src/rules/lines-between-class-members.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# lines-between-class-members Requires or disallows an empty line between class members. @@ -131,8 +124,8 @@ If you don't want to enforce empty lines between class members, you can disable ## Related Rules -* [padded-blocks](padded-blocks) -* [padding-line-between-statements](padding-line-between-statements) +* [padded-blocks](padded-blocks.md) +* [padding-line-between-statements](padding-line-between-statements.md) ## Compatibility diff --git a/docs/src/rules/max-classes-per-file.md b/docs/src/rules/max-classes-per-file.md index 5752d540ae9..dab6e77dbaa 100644 --- a/docs/src/rules/max-classes-per-file.md +++ b/docs/src/rules/max-classes-per-file.md @@ -1,9 +1,4 @@ ---- -title: max-classes-per-file -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-classes-per-file.md -rule_type: suggestion ---- +# max-classes-per-file Enforces a maximum number of classes per file. diff --git a/docs/src/rules/max-depth.md b/docs/src/rules/max-depth.md index fd2539b3f1e..85b7a63e438 100644 --- a/docs/src/rules/max-depth.md +++ b/docs/src/rules/max-depth.md @@ -1,9 +1,4 @@ ---- -title: max-depth -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-depth.md -rule_type: suggestion ---- +# max-depth Enforces a maximum depth that blocks can be nested. @@ -103,10 +98,10 @@ 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) +* [complexity](complexity.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) diff --git a/docs/src/rules/max-len.md b/docs/src/rules/max-len.md index 5b2ab80b102..61804d57057 100644 --- a/docs/src/rules/max-len.md +++ b/docs/src/rules/max-len.md @@ -1,9 +1,4 @@ ---- -title: max-len -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-len.md -rule_type: layout ---- +# max-len Enforces a maximum line length. @@ -161,8 +156,8 @@ var dep = require('really/really/really/really/really/really/really/really/long/ ## Related Rules -* [complexity](complexity) -* [max-depth](max-depth) -* [max-nested-callbacks](max-nested-callbacks) -* [max-params](max-params) -* [max-statements](max-statements) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) diff --git a/docs/src/rules/max-lines-per-function.md b/docs/src/rules/max-lines-per-function.md index f04ef80261d..21c49146818 100644 --- a/docs/src/rules/max-lines-per-function.md +++ b/docs/src/rules/max-lines-per-function.md @@ -1,9 +1,4 @@ ---- -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 ---- +# max-lines-per-function Enforces a maximum function length. @@ -197,10 +192,10 @@ You can turn this rule off if you are not concerned with the number of lines in ## 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) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-lines](max-lines.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) +* [max-statements-per-line](max-statements-per-line.md) diff --git a/docs/src/rules/max-lines.md b/docs/src/rules/max-lines.md index 31d232a6ddb..8ced25fceab 100644 --- a/docs/src/rules/max-lines.md +++ b/docs/src/rules/max-lines.md @@ -1,9 +1,4 @@ ---- -title: max-lines -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-lines.md -rule_type: suggestion ---- +# max-lines Enforces a maximum file length. @@ -118,12 +113,12 @@ You can turn this rule off if you are not concerned with the number of lines in ## 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) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) ## Compatibility diff --git a/docs/src/rules/max-nested-callbacks.md b/docs/src/rules/max-nested-callbacks.md index 61a2ca750ab..c7b85c783d8 100644 --- a/docs/src/rules/max-nested-callbacks.md +++ b/docs/src/rules/max-nested-callbacks.md @@ -1,9 +1,4 @@ ---- -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 ---- +# max-nested-callbacks Enforces a maximum depth that callbacks can be nested. @@ -77,13 +72,13 @@ function handleFoo4() { ## 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) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) ## Further Reading diff --git a/docs/src/rules/max-params.md b/docs/src/rules/max-params.md index ece9598811f..0f8c2d1b4e6 100644 --- a/docs/src/rules/max-params.md +++ b/docs/src/rules/max-params.md @@ -1,9 +1,4 @@ ---- -title: max-params -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-params.md -rule_type: suggestion ---- +# max-params Enforces a maximum number of parameters in function definitions. @@ -61,10 +56,10 @@ let foo = (bar, baz, qux) => { ## 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) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-statements](max-statements.md) diff --git a/docs/src/rules/max-statements-per-line.md b/docs/src/rules/max-statements-per-line.md index d2a17245060..ef17951a765 100644 --- a/docs/src/rules/max-statements-per-line.md +++ b/docs/src/rules/max-statements-per-line.md @@ -1,9 +1,4 @@ ---- -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 ---- +# max-statements-per-line Enforces a maximum number of statements allowed per line. @@ -85,10 +80,10 @@ You can turn this rule off if you are not concerned with the number of statement ## 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) +* [max-depth](max-depth.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) +* [max-statements](max-statements.md) diff --git a/docs/src/rules/max-statements.md b/docs/src/rules/max-statements.md index 9c1dfe0ffef..11ac27871c5 100644 --- a/docs/src/rules/max-statements.md +++ b/docs/src/rules/max-statements.md @@ -1,9 +1,4 @@ ---- -title: max-statements -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/max-statements.md -rule_type: suggestion ---- +# max-statements Enforces a maximum number of statements allowed in function blocks. @@ -167,10 +162,10 @@ function foo() { ## 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) +* [complexity](complexity.md) +* [max-depth](max-depth.md) +* [max-len](max-len.md) +* [max-lines](max-lines.md) +* [max-lines-per-function](max-lines-per-function.md) +* [max-nested-callbacks](max-nested-callbacks.md) +* [max-params](max-params.md) diff --git a/docs/src/rules/multiline-comment-style.md b/docs/src/rules/multiline-comment-style.md index fca714605aa..db7a01865d2 100644 --- a/docs/src/rules/multiline-comment-style.md +++ b/docs/src/rules/multiline-comment-style.md @@ -1,11 +1,4 @@ ---- -title: multiline-comment-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/multiline-comment-style.md -rule_type: suggestion ---- - - +# multiline-comment-style Enforces a particular style for multiline comments. @@ -124,6 +117,7 @@ Examples of **correct** code for this rule with the `"separate-lines"` option: // calls foo() foo(); + ``` ## When Not To Use It diff --git a/docs/src/rules/multiline-ternary.md b/docs/src/rules/multiline-ternary.md index d4c5e1e6d9a..a987b6a80fa 100644 --- a/docs/src/rules/multiline-ternary.md +++ b/docs/src/rules/multiline-ternary.md @@ -1,11 +1,4 @@ ---- -title: multiline-ternary -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/multiline-ternary.md -rule_type: layout ---- - - +# multiline-ternary Enforces or disallows newlines between operands of ternary expressions. @@ -28,7 +21,7 @@ var foo = bar > baz ? ## Rule Details This rule enforces or disallows newlines between operands of a ternary expression. -Note: The location of the operators is not enforced by this rule. Please see the [operator-linebreak](operator-linebreak) rule if you are interested in enforcing the location of the operators themselves. +Note: The location of the operators is not enforced by this rule. Please see the [operator-linebreak](operator-linebreak.md) rule if you are interested in enforcing the location of the operators themselves. ## Options @@ -155,7 +148,7 @@ You can safely disable this rule if you do not have any strict conventions about ## Related Rules -* [operator-linebreak](operator-linebreak) +* [operator-linebreak](operator-linebreak.md) ## Compatibility diff --git a/docs/src/rules/new-cap.md b/docs/src/rules/new-cap.md index 8bca67c9e73..eb7afc9405e 100644 --- a/docs/src/rules/new-cap.md +++ b/docs/src/rules/new-cap.md @@ -1,9 +1,4 @@ ---- -title: new-cap -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/new-cap.md -rule_type: suggestion ---- +# new-cap Requires constructor names to begin with a capital letter. diff --git a/docs/src/rules/new-parens.md b/docs/src/rules/new-parens.md index 0d7cefcd62b..88fe89ec19a 100644 --- a/docs/src/rules/new-parens.md +++ b/docs/src/rules/new-parens.md @@ -1,11 +1,4 @@ ---- -title: new-parens -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/new-parens.md -rule_type: layout ---- - - +# new-parens Requires parentheses when invoking a constructor with no arguments. diff --git a/docs/src/rules/newline-after-var.md b/docs/src/rules/newline-after-var.md index 9cb5c7a48b8..5e3b20444d1 100644 --- a/docs/src/rules/newline-after-var.md +++ b/docs/src/rules/newline-after-var.md @@ -1,15 +1,8 @@ ---- -title: newline-after-var -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/newline-after-var.md -rule_type: layout ---- - - +# newline-after-var Requires or disallows an empty line after variable declarations. -This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule. +This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements.md) rule. As of today there is no consistency in separating variable declarations from the rest of the code. Some developers leave an empty line between var statements and the rest of the code like: diff --git a/docs/src/rules/newline-before-return.md b/docs/src/rules/newline-before-return.md index 718ceb25365..378948ea3ad 100644 --- a/docs/src/rules/newline-before-return.md +++ b/docs/src/rules/newline-before-return.md @@ -1,15 +1,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 ---- - - +# newline-before-return Requires an empty line before `return` statements. -This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule. +This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements.md) rule. There is no hard and fast rule about whether empty lines should precede `return` statements in JavaScript. However, clearly delineating where a function is returning can greatly increase the readability and clarity of the code. For example: @@ -122,4 +115,4 @@ You can safely disable this rule if you do not have any strict conventions about ## Related Rules -* [newline-after-var](newline-after-var) +* [newline-after-var](newline-after-var.md) diff --git a/docs/src/rules/newline-per-chained-call.md b/docs/src/rules/newline-per-chained-call.md index 6aaab2ca9c5..9e3004f8e1e 100644 --- a/docs/src/rules/newline-per-chained-call.md +++ b/docs/src/rules/newline-per-chained-call.md @@ -1,11 +1,4 @@ ---- -title: newline-per-chained-call -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/newline-per-chained-call.md -rule_type: layout ---- - - +# newline-per-chained-call Requires a newline after each call in a method chain. diff --git a/docs/src/rules/no-alert.md b/docs/src/rules/no-alert.md index 48167bd1f8d..956aff81114 100644 --- a/docs/src/rules/no-alert.md +++ b/docs/src/rules/no-alert.md @@ -1,9 +1,4 @@ ---- -title: no-alert -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-alert.md -rule_type: suggestion ---- +# no-alert Disallows the use of `alert`, `confirm`, and `prompt`. @@ -48,5 +43,5 @@ function foo() { ## Related Rules -* [no-console](no-console) -* [no-debugger](no-debugger) +* [no-console](no-console.md) +* [no-debugger](no-debugger.md) diff --git a/docs/src/rules/no-array-constructor.md b/docs/src/rules/no-array-constructor.md index 746704b55b8..06a8276ecca 100644 --- a/docs/src/rules/no-array-constructor.md +++ b/docs/src/rules/no-array-constructor.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-array-constructor Disallows `Array` constructors. @@ -46,5 +41,5 @@ rule may be disabled if the constructor style is preferred. ## Related Rules -* [no-new-object](no-new-object) -* [no-new-wrappers](no-new-wrappers) +* [no-new-object](no-new-object.md) +* [no-new-wrappers](no-new-wrappers.md) diff --git a/docs/src/rules/no-arrow-condition.md b/docs/src/rules/no-arrow-condition.md index be451c87797..2052f02e3bd 100644 --- a/docs/src/rules/no-arrow-condition.md +++ b/docs/src/rules/no-arrow-condition.md @@ -1,13 +1,8 @@ ---- -title: no-arrow-condition -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-arrow-condition.md - ---- +# no-arrow-condition Disallows arrow functions where test conditions are expected. -(removed) This rule was **removed** in ESLint v2.0 and **replaced** by a combination of the [no-confusing-arrow](no-confusing-arrow) and [no-constant-condition](no-constant-condition) rules. +(removed) This rule was **removed** in ESLint v2.0 and **replaced** by a combination of the [no-confusing-arrow](no-confusing-arrow.md) and [no-constant-condition](no-constant-condition.md) rules. Arrow functions (`=>`) are similar in syntax to some comparison operators (`>`, `<`, `<=`, and `>=`). This rule warns against using the arrow function syntax in places where a condition is expected. Even if the arguments of the arrow function are wrapped with parens, this rule still warns about it. @@ -50,6 +45,6 @@ var x = (a) => 1 ? 2 : 3 ## Related Rules -* [arrow-parens](arrow-parens) -* [no-confusing-arrow](no-confusing-arrow) -* [no-constant-condition](no-constant-condition) +* [arrow-parens](arrow-parens.md) +* [no-confusing-arrow](no-confusing-arrow.md) +* [no-constant-condition](no-constant-condition.md) diff --git a/docs/src/rules/no-async-promise-executor.md b/docs/src/rules/no-async-promise-executor.md index 6627f5b8be7..3f9cf9627ad 100644 --- a/docs/src/rules/no-async-promise-executor.md +++ b/docs/src/rules/no-async-promise-executor.md @@ -1,11 +1,4 @@ ---- -title: no-async-promise-executor -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-async-promise-executor.md -rule_type: problem ---- - - +# no-async-promise-executor Disallows using an async function as a Promise executor. diff --git a/docs/src/rules/no-await-in-loop.md b/docs/src/rules/no-await-in-loop.md index 5e759e60cc2..2395956c357 100644 --- a/docs/src/rules/no-await-in-loop.md +++ b/docs/src/rules/no-await-in-loop.md @@ -1,9 +1,4 @@ ---- -title: no-await-in-loop -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-await-in-loop.md -rule_type: problem ---- +# no-await-in-loop Disallows `await` inside of loops. diff --git a/docs/src/rules/no-bitwise.md b/docs/src/rules/no-bitwise.md index b2721bac59f..b79a9dc7d9b 100644 --- a/docs/src/rules/no-bitwise.md +++ b/docs/src/rules/no-bitwise.md @@ -1,9 +1,4 @@ ---- -title: no-bitwise -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-bitwise.md -rule_type: suggestion ---- +# no-bitwise Disallows bitwise operators. diff --git a/docs/src/rules/no-buffer-constructor.md b/docs/src/rules/no-buffer-constructor.md index 64e7c1e1702..4e1e7728a8e 100644 --- a/docs/src/rules/no-buffer-constructor.md +++ b/docs/src/rules/no-buffer-constructor.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-buffer-constructor Disallows use of the `Buffer()` constructor. diff --git a/docs/src/rules/no-caller.md b/docs/src/rules/no-caller.md index f7be8267288..280d2f6fdac 100644 --- a/docs/src/rules/no-caller.md +++ b/docs/src/rules/no-caller.md @@ -1,9 +1,4 @@ ---- -title: no-caller -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-caller.md -rule_type: suggestion ---- +# no-caller Disallows use of `caller`/`callee`. diff --git a/docs/src/rules/no-case-declarations.md b/docs/src/rules/no-case-declarations.md index 4e0717e8d27..8a73e5136bb 100644 --- a/docs/src/rules/no-case-declarations.md +++ b/docs/src/rules/no-case-declarations.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-case-declarations Disallows lexical declarations in case/default clauses. @@ -81,4 +74,4 @@ If you depend on fall through behavior and want access to bindings introduced in ## Related Rules -* [no-fallthrough](no-fallthrough) +* [no-fallthrough](no-fallthrough.md) diff --git a/docs/src/rules/no-catch-shadow.md b/docs/src/rules/no-catch-shadow.md index 3ed3b038161..ebd18479198 100644 --- a/docs/src/rules/no-catch-shadow.md +++ b/docs/src/rules/no-catch-shadow.md @@ -1,9 +1,4 @@ ---- -title: no-catch-shadow -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-catch-shadow.md -rule_type: suggestion ---- +# no-catch-shadow Disallows shadowing of variables inside of catch. diff --git a/docs/src/rules/no-class-assign.md b/docs/src/rules/no-class-assign.md index 9666f8ce7aa..ca57fd95f82 100644 --- a/docs/src/rules/no-class-assign.md +++ b/docs/src/rules/no-class-assign.md @@ -1,11 +1,4 @@ ---- -title: no-class-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-class-assign.md -rule_type: problem ---- - - +# no-class-assign Disallows modifying variables of class declarations. diff --git a/docs/src/rules/no-comma-dangle.md b/docs/src/rules/no-comma-dangle.md index 6498c1045b3..64fa4fd62c7 100644 --- a/docs/src/rules/no-comma-dangle.md +++ b/docs/src/rules/no-comma-dangle.md @@ -1,13 +1,8 @@ ---- -title: no-comma-dangle -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-comma-dangle.md - ---- +# no-comma-dangle Disallows trailing commas in object and array literals. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [comma-dangle](comma-dangle) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [comma-dangle](comma-dangle.md) rule. Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec, however IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript. diff --git a/docs/src/rules/no-compare-neg-zero.md b/docs/src/rules/no-compare-neg-zero.md index bbfea3d8f60..ba34e1f025a 100644 --- a/docs/src/rules/no-compare-neg-zero.md +++ b/docs/src/rules/no-compare-neg-zero.md @@ -1,11 +1,4 @@ ---- -title: no-compare-neg-zero -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-compare-neg-zero.md -rule_type: problem ---- - - +# no-compare-neg-zero Disallows comparing against `-0`. diff --git a/docs/src/rules/no-cond-assign.md b/docs/src/rules/no-cond-assign.md index 318a9e8bf34..1ac17b85063 100644 --- a/docs/src/rules/no-cond-assign.md +++ b/docs/src/rules/no-cond-assign.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-cond-assign Disallows assignment operators in conditional statements. @@ -133,4 +126,4 @@ if (x === 0) { ## Related Rules -* [no-extra-parens](no-extra-parens) +* [no-extra-parens](no-extra-parens.md) diff --git a/docs/src/rules/no-confusing-arrow.md b/docs/src/rules/no-confusing-arrow.md index d5a3a0e40c1..f88af8e5d9a 100644 --- a/docs/src/rules/no-confusing-arrow.md +++ b/docs/src/rules/no-confusing-arrow.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-confusing-arrow Disallows arrow functions where they could be confused with comparisons. @@ -98,5 +91,5 @@ Examples of **correct** code for this rule with the `{"onlyOneSimpleParam": true ## Related Rules -* [no-constant-condition](no-constant-condition) -* [arrow-parens](arrow-parens) +* [no-constant-condition](no-constant-condition.md) +* [arrow-parens](arrow-parens.md) diff --git a/docs/src/rules/no-console.md b/docs/src/rules/no-console.md index 6bf0637aa86..39b52822b9c 100644 --- a/docs/src/rules/no-console.md +++ b/docs/src/rules/no-console.md @@ -1,9 +1,4 @@ ---- -title: no-console -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-console.md -rule_type: suggestion ---- +# no-console Disallows the use of `console`. @@ -100,5 +95,5 @@ However, you might not want to manually add `eslint-disable-next-line` or `eslin ## Related Rules -* [no-alert](no-alert) -* [no-debugger](no-debugger) +* [no-alert](no-alert.md) +* [no-debugger](no-debugger.md) diff --git a/docs/src/rules/no-const-assign.md b/docs/src/rules/no-const-assign.md index 74921f96919..422859fbc19 100644 --- a/docs/src/rules/no-const-assign.md +++ b/docs/src/rules/no-const-assign.md @@ -1,11 +1,4 @@ ---- -title: no-const-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-const-assign.md -rule_type: problem ---- - - +# no-const-assign Disallows modifying variables that are declared using `const`. diff --git a/docs/src/rules/no-constant-condition.md b/docs/src/rules/no-constant-condition.md index 8237ea856e3..810c17bead1 100644 --- a/docs/src/rules/no-constant-condition.md +++ b/docs/src/rules/no-constant-condition.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-constant-condition Disallows constant expressions in conditions. diff --git a/docs/src/rules/no-constructor-return.md b/docs/src/rules/no-constructor-return.md index 4be5f30bedd..c2f15fd20d6 100644 --- a/docs/src/rules/no-constructor-return.md +++ b/docs/src/rules/no-constructor-return.md @@ -1,9 +1,4 @@ ---- -title: no-constructor-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-constructor-return.md -rule_type: problem ---- +# no-constructor-return Disallows returning values in constructor. diff --git a/docs/src/rules/no-continue.md b/docs/src/rules/no-continue.md index fff6611a3e6..b2f8409b6d2 100644 --- a/docs/src/rules/no-continue.md +++ b/docs/src/rules/no-continue.md @@ -1,9 +1,4 @@ ---- -title: no-continue -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-continue.md -rule_type: suggestion ---- +# no-continue Disallows `continue` statements. diff --git a/docs/src/rules/no-control-regex.md b/docs/src/rules/no-control-regex.md index feebe466189..dcc7df4ca1c 100644 --- a/docs/src/rules/no-control-regex.md +++ b/docs/src/rules/no-control-regex.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-control-regex Disallows control characters in regular expressions. @@ -39,5 +32,5 @@ If you need to use control character pattern matching, then you should turn this ## Related Rules -* [no-div-regex](no-div-regex) -* [no-regex-spaces](no-regex-spaces) +* [no-div-regex](no-div-regex.md) +* [no-regex-spaces](no-regex-spaces.md) diff --git a/docs/src/rules/no-debugger.md b/docs/src/rules/no-debugger.md index 99188c8018a..b7d27b1a0da 100644 --- a/docs/src/rules/no-debugger.md +++ b/docs/src/rules/no-debugger.md @@ -1,11 +1,4 @@ ---- -title: no-debugger -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-debugger.md -rule_type: problem ---- - - +# no-debugger Disallows the use of `debugger`. @@ -42,8 +35,8 @@ If your code is still very much in development and don't want to worry about str ## Related Rules -* [no-alert](no-alert) -* [no-console](no-console) +* [no-alert](no-alert.md) +* [no-console](no-console.md) ## Further Reading diff --git a/docs/src/rules/no-delete-var.md b/docs/src/rules/no-delete-var.md index b14dd57f536..e1224a22506 100644 --- a/docs/src/rules/no-delete-var.md +++ b/docs/src/rules/no-delete-var.md @@ -1,11 +1,4 @@ ---- -title: no-delete-var -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-delete-var.md -rule_type: suggestion ---- - - +# no-delete-var Disallows deleting variables. diff --git a/docs/src/rules/no-div-regex.md b/docs/src/rules/no-div-regex.md index 26022d05840..dda12a725bf 100644 --- a/docs/src/rules/no-div-regex.md +++ b/docs/src/rules/no-div-regex.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-div-regex Disallows regular expressions that look like division. @@ -37,5 +30,5 @@ function bar() { return /[=]foo/; } ## Related Rules -* [no-control-regex](no-control-regex) -* [no-regex-spaces](no-regex-spaces) +* [no-control-regex](no-control-regex.md) +* [no-regex-spaces](no-regex-spaces.md) diff --git a/docs/src/rules/no-dupe-args.md b/docs/src/rules/no-dupe-args.md index c28f5cd5fd4..5c2dead0639 100644 --- a/docs/src/rules/no-dupe-args.md +++ b/docs/src/rules/no-dupe-args.md @@ -1,11 +1,4 @@ ---- -title: no-dupe-args -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-dupe-args.md -rule_type: problem ---- - - +# no-dupe-args Disallows duplicate arguments in `function` definitions. diff --git a/docs/src/rules/no-dupe-class-members.md b/docs/src/rules/no-dupe-class-members.md index f50088b0da8..c825634f07d 100644 --- a/docs/src/rules/no-dupe-class-members.md +++ b/docs/src/rules/no-dupe-class-members.md @@ -1,11 +1,4 @@ ---- -title: no-dupe-class-members -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-dupe-class-members.md -rule_type: problem ---- - - +# no-dupe-class-members Disallows duplicate name in class members. diff --git a/docs/src/rules/no-dupe-else-if.md b/docs/src/rules/no-dupe-else-if.md index 73c98f9d246..9c4138695b2 100644 --- a/docs/src/rules/no-dupe-else-if.md +++ b/docs/src/rules/no-dupe-else-if.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-dupe-else-if Disallows duplicate conditions in `if-else-if` chains. @@ -183,5 +176,5 @@ In rare cases where you really need identical test conditions in the same chain, ## Related Rules -* [no-duplicate-case](no-duplicate-case) -* [no-lonely-if](no-lonely-if) +* [no-duplicate-case](no-duplicate-case.md) +* [no-lonely-if](no-lonely-if.md) diff --git a/docs/src/rules/no-dupe-keys.md b/docs/src/rules/no-dupe-keys.md index a5bfda0ec1b..0698a7e286e 100644 --- a/docs/src/rules/no-dupe-keys.md +++ b/docs/src/rules/no-dupe-keys.md @@ -1,11 +1,4 @@ ---- -title: no-dupe-keys -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-dupe-keys.md -rule_type: problem ---- - - +# no-dupe-keys Disallows duplicate keys in object literals. diff --git a/docs/src/rules/no-duplicate-case.md b/docs/src/rules/no-duplicate-case.md index 455689f33d9..5ad1dfe0661 100644 --- a/docs/src/rules/no-duplicate-case.md +++ b/docs/src/rules/no-duplicate-case.md @@ -1,11 +1,4 @@ ---- -title: no-duplicate-case -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-duplicate-case.md -rule_type: problem ---- - - +# no-duplicate-case Disallows duplicate `case` labels. diff --git a/docs/src/rules/no-duplicate-imports.md b/docs/src/rules/no-duplicate-imports.md index 88d7a2d8706..7b6e6d53c1f 100644 --- a/docs/src/rules/no-duplicate-imports.md +++ b/docs/src/rules/no-duplicate-imports.md @@ -1,9 +1,4 @@ ---- -title: no-duplicate-imports -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-duplicate-imports.md -rule_type: problem ---- +# no-duplicate-imports Disallows duplicate imports. diff --git a/docs/src/rules/no-else-return.md b/docs/src/rules/no-else-return.md index 8903c4a6082..37f5db789ac 100644 --- a/docs/src/rules/no-else-return.md +++ b/docs/src/rules/no-else-return.md @@ -1,11 +1,4 @@ ---- -title: no-else-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-else-return.md -rule_type: suggestion ---- - - +# no-else-return Disallows `return` before `else`. diff --git a/docs/src/rules/no-empty-character-class.md b/docs/src/rules/no-empty-character-class.md index 146e0cdf876..7bbdc72b45e 100644 --- a/docs/src/rules/no-empty-character-class.md +++ b/docs/src/rules/no-empty-character-class.md @@ -1,11 +1,4 @@ ---- -title: no-empty-character-class -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-character-class.md -rule_type: problem ---- - - +# no-empty-character-class Disallows empty character classes in regular expressions. diff --git a/docs/src/rules/no-empty-class.md b/docs/src/rules/no-empty-class.md index 0673cd3f7ed..f39f1598329 100644 --- a/docs/src/rules/no-empty-class.md +++ b/docs/src/rules/no-empty-class.md @@ -1,13 +1,8 @@ ---- -title: no-empty-class -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-class.md - ---- +# no-empty-class Disallows empty character classes in regular expressions. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-empty-character-class](no-empty-character-class) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-empty-character-class](no-empty-character-class.md) rule. Empty character classes in regular expressions do not match anything and can result in code that may not work as intended. diff --git a/docs/src/rules/no-empty-function.md b/docs/src/rules/no-empty-function.md index bb97633610e..9d053950d55 100644 --- a/docs/src/rules/no-empty-function.md +++ b/docs/src/rules/no-empty-function.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-empty-function Disallows empty functions. @@ -351,4 +346,4 @@ If you don't want to be notified about empty functions, then it's safe to disabl ## Related Rules -* [no-empty](./no-empty) +* [no-empty](./no-empty.md) diff --git a/docs/src/rules/no-empty-label.md b/docs/src/rules/no-empty-label.md index f7a3fadebc3..ed9d64193db 100644 --- a/docs/src/rules/no-empty-label.md +++ b/docs/src/rules/no-empty-label.md @@ -1,13 +1,8 @@ ---- -title: no-empty-label -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-label.md - ---- +# no-empty-label Disallows labels for anything other than loops and switches. -(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [no-labels](no-labels) rule. +(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [no-labels](no-labels.md) rule. Labeled statements are only used in conjunction with labeled break and continue statements. ECMAScript has no goto statement. @@ -41,6 +36,6 @@ If you don't want to be notified about usage of labels, then it's safe to disabl ## Related Rules -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) +* [no-labels](./no-labels.md) +* [no-label-var](./no-label-var.md) +* [no-unused-labels](./no-unused-labels.md) diff --git a/docs/src/rules/no-empty-pattern.md b/docs/src/rules/no-empty-pattern.md index 93b0865b677..407b26d1698 100644 --- a/docs/src/rules/no-empty-pattern.md +++ b/docs/src/rules/no-empty-pattern.md @@ -1,11 +1,4 @@ ---- -title: no-empty-pattern -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty-pattern.md -rule_type: problem ---- - - +# no-empty-pattern Disallows empty destructuring patterns. diff --git a/docs/src/rules/no-empty.md b/docs/src/rules/no-empty.md index cf3ab39d1b9..50fd84d1672 100644 --- a/docs/src/rules/no-empty.md +++ b/docs/src/rules/no-empty.md @@ -1,11 +1,4 @@ ---- -title: no-empty -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-empty.md -rule_type: suggestion ---- - - +# no-empty Disallows empty block statements. @@ -95,4 +88,4 @@ If you intentionally use empty block statements then you can disable this rule. ## Related Rules -* [no-empty-function](./no-empty-function) +* [no-empty-function](./no-empty-function.md) diff --git a/docs/src/rules/no-eq-null.md b/docs/src/rules/no-eq-null.md index fdacac401ad..ef810798b32 100644 --- a/docs/src/rules/no-eq-null.md +++ b/docs/src/rules/no-eq-null.md @@ -1,9 +1,4 @@ ---- -title: no-eq-null -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-eq-null.md -rule_type: suggestion ---- +# no-eq-null Disallows `null` comparisons without type-checking operators, diff --git a/docs/src/rules/no-eval.md b/docs/src/rules/no-eval.md index 35cbc7ee193..9c00698f98d 100644 --- a/docs/src/rules/no-eval.md +++ b/docs/src/rules/no-eval.md @@ -1,9 +1,4 @@ ---- -title: no-eval -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-eval.md -rule_type: suggestion ---- +# no-eval Disallows eval(). @@ -154,7 +149,7 @@ global.eval("var a = 0"); ## Related Rules -* [no-implied-eval](no-implied-eval) +* [no-implied-eval](no-implied-eval.md) ## Further Reading diff --git a/docs/src/rules/no-ex-assign.md b/docs/src/rules/no-ex-assign.md index 233ec239010..1c697162baf 100644 --- a/docs/src/rules/no-ex-assign.md +++ b/docs/src/rules/no-ex-assign.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-ex-assign Disallows reassigning exceptions in `catch` clauses. diff --git a/docs/src/rules/no-extend-native.md b/docs/src/rules/no-extend-native.md index d0be66af56d..b562fdc3e0a 100644 --- a/docs/src/rules/no-extend-native.md +++ b/docs/src/rules/no-extend-native.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-extend-native Disallows extending of native objects. @@ -79,4 +74,4 @@ You may want to disable this rule when working with polyfills that try to patch ## Related Rules -* [no-global-assign](no-global-assign) +* [no-global-assign](no-global-assign.md) diff --git a/docs/src/rules/no-extra-bind.md b/docs/src/rules/no-extra-bind.md index 5a7d28f321f..90d95ab6831 100644 --- a/docs/src/rules/no-extra-bind.md +++ b/docs/src/rules/no-extra-bind.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-extra-bind Disallows unnecessary function binding. diff --git a/docs/src/rules/no-extra-boolean-cast.md b/docs/src/rules/no-extra-boolean-cast.md index 550f6985afd..67814ac2926 100644 --- a/docs/src/rules/no-extra-boolean-cast.md +++ b/docs/src/rules/no-extra-boolean-cast.md @@ -1,13 +1,4 @@ ---- -title: no-extra-boolean-cast -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-boolean-cast.md -rule_type: suggestion ---- - - - - +# no-extra-boolean-cast Disallows unnecessary boolean casts. diff --git a/docs/src/rules/no-extra-label.md b/docs/src/rules/no-extra-label.md index 82b98c1dce0..3a7068e5c65 100644 --- a/docs/src/rules/no-extra-label.md +++ b/docs/src/rules/no-extra-label.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-extra-label Disallows unnecessary labels. @@ -86,6 +79,6 @@ If you don't want to be notified about usage of labels, then it's safe to disabl ## Related Rules -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) +* [no-labels](./no-labels.md) +* [no-label-var](./no-label-var.md) +* [no-unused-labels](./no-unused-labels.md) diff --git a/docs/src/rules/no-extra-parens.md b/docs/src/rules/no-extra-parens.md index 858734e4374..ccebf2dbc98 100644 --- a/docs/src/rules/no-extra-parens.md +++ b/docs/src/rules/no-extra-parens.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-extra-parens Disallows unnecessary parentheses. @@ -15,9 +8,9 @@ This rule restricts the use of parentheses to only where they are necessary. This rule always ignores extra parentheses around the following: -* RegExp literals such as `(/abc/).test(var)` to avoid conflicts with the [wrap-regex](wrap-regex) rule -* immediately-invoked function expressions (also known as IIFEs) such as `var x = (function () {})();` and `var x = (function () {}());` to avoid conflicts with the [wrap-iife](wrap-iife) rule -* arrow function arguments to avoid conflicts with the [arrow-parens](arrow-parens) rule +* RegExp literals such as `(/abc/).test(var)` to avoid conflicts with the [wrap-regex](wrap-regex.md) rule +* immediately-invoked function expressions (also known as IIFEs) such as `var x = (function () {})();` and `var x = (function () {}());` to avoid conflicts with the [wrap-iife](wrap-iife.md) rule +* arrow function arguments to avoid conflicts with the [arrow-parens](arrow-parens.md) rule ## Options @@ -300,9 +293,9 @@ typeof (a); ## Related Rules -* [arrow-parens](arrow-parens) -* [no-cond-assign](no-cond-assign) -* [no-return-assign](no-return-assign) +* [arrow-parens](arrow-parens.md) +* [no-cond-assign](no-cond-assign.md) +* [no-return-assign](no-return-assign.md) ## Further Reading diff --git a/docs/src/rules/no-extra-semi.md b/docs/src/rules/no-extra-semi.md index 6aea002ebc9..c37ca03a054 100644 --- a/docs/src/rules/no-extra-semi.md +++ b/docs/src/rules/no-extra-semi.md @@ -1,13 +1,4 @@ ---- -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 ---- - - - - +# no-extra-semi Disallows unnecessary semicolons. @@ -75,5 +66,5 @@ If you intentionally use extra semicolons then you can disable this rule. ## Related Rules -* [semi](semi) -* [semi-spacing](semi-spacing) +* [semi](semi.md) +* [semi-spacing](semi-spacing.md) diff --git a/docs/src/rules/no-extra-strict.md b/docs/src/rules/no-extra-strict.md index f2627ebafda..f39848be3bd 100644 --- a/docs/src/rules/no-extra-strict.md +++ b/docs/src/rules/no-extra-strict.md @@ -1,13 +1,8 @@ ---- -title: no-extra-strict -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-extra-strict.md - ---- +# no-extra-strict Disallows strict mode directives when already in strict mode. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict) rule. The `"global"` or `"function"` options in the new rule are similar to the removed rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict.md) rule. The `"global"` or `"function"` options in the new rule are similar to the removed rule. The `"use strict";` directive applies to the scope in which it appears and all inner scopes contained within that scope. Therefore, using the `"use strict";` directive in one of these inner scopes is unnecessary. diff --git a/docs/src/rules/no-fallthrough.md b/docs/src/rules/no-fallthrough.md index bb7c618721b..8adb37629c1 100644 --- a/docs/src/rules/no-fallthrough.md +++ b/docs/src/rules/no-fallthrough.md @@ -1,11 +1,4 @@ ---- -title: no-fallthrough -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-fallthrough.md -rule_type: problem ---- - - +# no-fallthrough Disallows case statement fallthroughs. @@ -197,4 +190,4 @@ If you don't want to enforce that each `case` statement should end with a `throw ## Related Rules -* [default-case](default-case) +* [default-case](default-case.md) diff --git a/docs/src/rules/no-floating-decimal.md b/docs/src/rules/no-floating-decimal.md index da348a152ac..991cf65e772 100644 --- a/docs/src/rules/no-floating-decimal.md +++ b/docs/src/rules/no-floating-decimal.md @@ -1,11 +1,4 @@ ---- -title: no-floating-decimal -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-floating-decimal.md -rule_type: suggestion ---- - - +# no-floating-decimal Disallows leading or trailing decimal points in numeric literals. diff --git a/docs/src/rules/no-func-assign.md b/docs/src/rules/no-func-assign.md index cbd56279286..24ba713d12f 100644 --- a/docs/src/rules/no-func-assign.md +++ b/docs/src/rules/no-func-assign.md @@ -1,11 +1,4 @@ ---- -title: no-func-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-func-assign.md -rule_type: problem ---- - - +# no-func-assign Disallows reassigning `function` declarations. diff --git a/docs/src/rules/no-global-assign.md b/docs/src/rules/no-global-assign.md index b5be6d41e93..cd18f8a6d40 100644 --- a/docs/src/rules/no-global-assign.md +++ b/docs/src/rules/no-global-assign.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-global-assign Disallows assignment to native objects or read-only global variables. @@ -93,6 +86,6 @@ 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) +* [no-extend-native](no-extend-native.md) +* [no-redeclare](no-redeclare.md) +* [no-shadow](no-shadow.md) diff --git a/docs/src/rules/no-implicit-coercion.md b/docs/src/rules/no-implicit-coercion.md index cc1338c72fe..6c77b25fb23 100644 --- a/docs/src/rules/no-implicit-coercion.md +++ b/docs/src/rules/no-implicit-coercion.md @@ -1,11 +1,4 @@ ---- -title: no-implicit-coercion -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-implicit-coercion.md -rule_type: suggestion ---- - - +# no-implicit-coercion Disallows shorthand type conversions. diff --git a/docs/src/rules/no-implicit-globals.md b/docs/src/rules/no-implicit-globals.md index c8a0a542f68..efc3a6f28ff 100644 --- a/docs/src/rules/no-implicit-globals.md +++ b/docs/src/rules/no-implicit-globals.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-implicit-globals Disallows declarations in the global scope. @@ -223,8 +218,8 @@ In the case of an ES module, if you don't want this rule to warn you about the r ## Related Rules -* [no-undef](no-undef) -* [no-global-assign](no-global-assign) +* [no-undef](no-undef.md) +* [no-global-assign](no-global-assign.md) ## Further Reading diff --git a/docs/src/rules/no-implied-eval.md b/docs/src/rules/no-implied-eval.md index 48af9609054..59d1ac976b5 100644 --- a/docs/src/rules/no-implied-eval.md +++ b/docs/src/rules/no-implied-eval.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-implied-eval Disallows the use of `eval()`-like methods. @@ -66,4 +61,4 @@ If you want to allow `setTimeout()` and `setInterval()` with string arguments, t ## Related Rules -* [no-eval](no-eval) +* [no-eval](no-eval.md) diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index 56844f47727..9aa66b8efc1 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -1,11 +1,4 @@ ---- -title: no-import-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-import-assign.md -rule_type: problem ---- - - +# no-import-assign Disallows assigning to imported bindings. diff --git a/docs/src/rules/no-inline-comments.md b/docs/src/rules/no-inline-comments.md index 4ef95d8f154..504f77bc1c3 100644 --- a/docs/src/rules/no-inline-comments.md +++ b/docs/src/rules/no-inline-comments.md @@ -1,9 +1,4 @@ ---- -title: no-inline-comments -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-inline-comments.md -rule_type: suggestion ---- +# no-inline-comments Disallows inline comments after code. diff --git a/docs/src/rules/no-inner-declarations.md b/docs/src/rules/no-inner-declarations.md index 5753d4107f5..a6d1e899db3 100644 --- a/docs/src/rules/no-inner-declarations.md +++ b/docs/src/rules/no-inner-declarations.md @@ -1,11 +1,4 @@ ---- -title: no-inner-declarations -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-inner-declarations.md -rule_type: problem ---- - - +# no-inner-declarations Disallows variable or `function` declarations in nested blocks. @@ -185,4 +178,4 @@ class C { ## When Not To Use It -The function declaration portion rule will be rendered obsolete when [block-scoped functions](https://bugzilla.mozilla.org/show_bug.cgi?id=585536) land in ES6, but until then, it should be left on to enforce valid constructions. Disable checking variable declarations when using [block-scoped-var](block-scoped-var) or if declaring variables in nested blocks is acceptable despite hoisting. +The function declaration portion rule will be rendered obsolete when [block-scoped functions](https://bugzilla.mozilla.org/show_bug.cgi?id=585536) land in ES6, but until then, it should be left on to enforce valid constructions. Disable checking variable declarations when using [block-scoped-var](block-scoped-var.md) or if declaring variables in nested blocks is acceptable despite hoisting. diff --git a/docs/src/rules/no-invalid-regexp.md b/docs/src/rules/no-invalid-regexp.md index 724cf2118c7..1dccd68f593 100644 --- a/docs/src/rules/no-invalid-regexp.md +++ b/docs/src/rules/no-invalid-regexp.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-invalid-regexp Disallows invalid regular expression strings in `RegExp` constructors. diff --git a/docs/src/rules/no-invalid-this.md b/docs/src/rules/no-invalid-this.md index 4358deedeee..bbdc79cbcf5 100644 --- a/docs/src/rules/no-invalid-this.md +++ b/docs/src/rules/no-invalid-this.md @@ -1,9 +1,4 @@ ---- -title: no-invalid-this -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-invalid-this.md -rule_type: suggestion ---- +# no-invalid-this Disallows use of `this` in contexts where the value of `this` is `undefined`. diff --git a/docs/src/rules/no-irregular-whitespace.md b/docs/src/rules/no-irregular-whitespace.md index b99f1faf034..eb366915ade 100644 --- a/docs/src/rules/no-irregular-whitespace.md +++ b/docs/src/rules/no-irregular-whitespace.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-irregular-whitespace Disallows irregular whitespace characters. diff --git a/docs/src/rules/no-iterator.md b/docs/src/rules/no-iterator.md index 39116ee88c9..7405dd1295d 100644 --- a/docs/src/rules/no-iterator.md +++ b/docs/src/rules/no-iterator.md @@ -1,9 +1,4 @@ ---- -title: no-iterator -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-iterator.md -rule_type: suggestion ---- +# no-iterator Disallows the use of the `__iterator__` property. diff --git a/docs/src/rules/no-label-var.md b/docs/src/rules/no-label-var.md index 60f433d9421..a4a101f1a38 100644 --- a/docs/src/rules/no-label-var.md +++ b/docs/src/rules/no-label-var.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-label-var Disallows labels that are variable names. @@ -50,6 +45,6 @@ If you don't want to be notified about usage of labels, then it's safe to disabl ## Related Rules -* [no-extra-label](./no-extra-label) -* [no-labels](./no-labels) -* [no-unused-labels](./no-unused-labels) +* [no-extra-label](./no-extra-label.md) +* [no-labels](./no-labels.md) +* [no-unused-labels](./no-unused-labels.md) diff --git a/docs/src/rules/no-labels.md b/docs/src/rules/no-labels.md index fdf9231c597..6758a14329f 100644 --- a/docs/src/rules/no-labels.md +++ b/docs/src/rules/no-labels.md @@ -1,9 +1,4 @@ ---- -title: no-labels -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-labels.md -rule_type: suggestion ---- +# no-labels Disallows labeled statements. @@ -125,6 +120,6 @@ If you need to use labeled statements everywhere, then you can safely disable th ## Related Rules -* [no-extra-label](./no-extra-label) -* [no-label-var](./no-label-var) -* [no-unused-labels](./no-unused-labels) +* [no-extra-label](./no-extra-label.md) +* [no-label-var](./no-label-var.md) +* [no-unused-labels](./no-unused-labels.md) diff --git a/docs/src/rules/no-lone-blocks.md b/docs/src/rules/no-lone-blocks.md index c3ee3c3d69f..2856c92820f 100644 --- a/docs/src/rules/no-lone-blocks.md +++ b/docs/src/rules/no-lone-blocks.md @@ -1,9 +1,4 @@ ---- -title: no-lone-blocks -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-lone-blocks.md -rule_type: suggestion ---- +# no-lone-blocks Disallows unnecessary nested blocks. diff --git a/docs/src/rules/no-lonely-if.md b/docs/src/rules/no-lonely-if.md index 8f62be51694..25c8d39f9b1 100644 --- a/docs/src/rules/no-lonely-if.md +++ b/docs/src/rules/no-lonely-if.md @@ -1,11 +1,4 @@ ---- -title: no-lonely-if -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-lonely-if.md -rule_type: suggestion ---- - - +# no-lonely-if Disallows `if` statements as the only statement in `else` blocks. diff --git a/docs/src/rules/no-loop-func.md b/docs/src/rules/no-loop-func.md index 9ab8e60e480..05b3ad88ba2 100644 --- a/docs/src/rules/no-loop-func.md +++ b/docs/src/rules/no-loop-func.md @@ -1,9 +1,4 @@ ---- -title: no-loop-func -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-loop-func.md -rule_type: suggestion ---- +# no-loop-func Disallows functions in loops. diff --git a/docs/src/rules/no-loss-of-precision.md b/docs/src/rules/no-loss-of-precision.md index b8a4050c529..f2dcf99d717 100644 --- a/docs/src/rules/no-loss-of-precision.md +++ b/docs/src/rules/no-loss-of-precision.md @@ -1,11 +1,4 @@ ---- -title: no-loss-of-precision -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-loss-of-precision.md -rule_type: problem ---- - - +# no-loss-of-precision Disallows number literals that lose precision. diff --git a/docs/src/rules/no-magic-numbers.md b/docs/src/rules/no-magic-numbers.md index f53d2e433b0..9e59c736e79 100644 --- a/docs/src/rules/no-magic-numbers.md +++ b/docs/src/rules/no-magic-numbers.md @@ -1,9 +1,4 @@ ---- -title: no-magic-numbers -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-magic-numbers.md -rule_type: suggestion ---- +# no-magic-numbers Disallows magic numbers. diff --git a/docs/src/rules/no-misleading-character-class.md b/docs/src/rules/no-misleading-character-class.md index 005127abf48..18744bf8456 100644 --- a/docs/src/rules/no-misleading-character-class.md +++ b/docs/src/rules/no-misleading-character-class.md @@ -1,11 +1,4 @@ ---- -title: no-misleading-character-class -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-misleading-character-class.md -rule_type: problem ---- - - +# no-misleading-character-class Disallows characters which are made with multiple code points in character class syntax. diff --git a/docs/src/rules/no-mixed-operators.md b/docs/src/rules/no-mixed-operators.md index 48f8849a70b..a5df9f0e887 100644 --- a/docs/src/rules/no-mixed-operators.md +++ b/docs/src/rules/no-mixed-operators.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-mixed-operators Disallows mixes of different operators. @@ -47,8 +42,8 @@ will generate This rule checks `BinaryExpression`, `LogicalExpression` and `ConditionalExpression`. -This rule may conflict with [no-extra-parens](no-extra-parens) rule. -If you use both this and [no-extra-parens](no-extra-parens) rule together, you need to use the `nestedBinaryExpressions` option of [no-extra-parens](no-extra-parens) rule. +This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. +If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the `nestedBinaryExpressions` option of [no-extra-parens](no-extra-parens.md) rule. Examples of **incorrect** code for this rule: @@ -197,4 +192,4 @@ If you don't want to be notified about mixed operators, then it's safe to disabl ## Related Rules -* [no-extra-parens](no-extra-parens) +* [no-extra-parens](no-extra-parens.md) diff --git a/docs/src/rules/no-mixed-requires.md b/docs/src/rules/no-mixed-requires.md index 4137e9a66fb..9b22c18588a 100644 --- a/docs/src/rules/no-mixed-requires.md +++ b/docs/src/rules/no-mixed-requires.md @@ -1,9 +1,4 @@ ---- -title: no-mixed-requires -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-mixed-requires.md -rule_type: suggestion ---- +# no-mixed-requires Disallows `require` calls to be mixed with regular variable declarations. diff --git a/docs/src/rules/no-mixed-spaces-and-tabs.md b/docs/src/rules/no-mixed-spaces-and-tabs.md index d53fc786f35..4333a835c90 100644 --- a/docs/src/rules/no-mixed-spaces-and-tabs.md +++ b/docs/src/rules/no-mixed-spaces-and-tabs.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-mixed-spaces-and-tabs Disallows mixed spaces and tabs for indentation. diff --git a/docs/src/rules/no-multi-assign.md b/docs/src/rules/no-multi-assign.md index 8ebc10b38f0..8c49635d5d9 100644 --- a/docs/src/rules/no-multi-assign.md +++ b/docs/src/rules/no-multi-assign.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-multi-assign Disallows use of chained assignment expressions. @@ -103,4 +98,4 @@ class Foo { ## Related Rules -* [max-statements-per-line](max-statements-per-line) +* [max-statements-per-line](max-statements-per-line.md) diff --git a/docs/src/rules/no-multi-spaces.md b/docs/src/rules/no-multi-spaces.md index 2e93c4571ee..47fa143cc98 100644 --- a/docs/src/rules/no-multi-spaces.md +++ b/docs/src/rules/no-multi-spaces.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-multi-spaces Disallows multiple consecutive spaces. @@ -113,7 +106,7 @@ To avoid contradictions with other rules that require multiple spaces, this rule This option is an object that expects property names to be AST node types as defined by [ESTree](https://github.com/estree/estree). The easiest way to determine the node types for `exceptions` is to use [AST Explorer](https://astexplorer.net/) with the espree parser. -Only the `Property` node type is ignored by default, because for the [key-spacing](key-spacing) rule some alignment options require multiple spaces in properties of object literals. +Only the `Property` node type is ignored by default, because for the [key-spacing](key-spacing.md) rule some alignment options require multiple spaces in properties of object literals. Examples of **correct** code for the default `"exceptions": { "Property": true }` option: @@ -171,10 +164,10 @@ If you don't want to check and disallow multiple spaces, then you should turn th ## 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) +* [key-spacing](key-spacing.md) +* [space-infix-ops](space-infix-ops.md) +* [space-in-brackets](space-in-brackets.md) (deprecated) +* [space-in-parens](space-in-parens.md) +* [space-after-keywords](space-after-keywords.md) +* [space-unary-ops](space-unary-ops.md) +* [space-return-throw-case](space-return-throw-case.md) diff --git a/docs/src/rules/no-multi-str.md b/docs/src/rules/no-multi-str.md index caeb62defce..e520a824061 100644 --- a/docs/src/rules/no-multi-str.md +++ b/docs/src/rules/no-multi-str.md @@ -1,9 +1,4 @@ ---- -title: no-multi-str -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-multi-str.md -rule_type: suggestion ---- +# no-multi-str Disallows multiline strings. diff --git a/docs/src/rules/no-multiple-empty-lines.md b/docs/src/rules/no-multiple-empty-lines.md index 8da7a54dbce..3bb7a6dc2a4 100644 --- a/docs/src/rules/no-multiple-empty-lines.md +++ b/docs/src/rules/no-multiple-empty-lines.md @@ -1,11 +1,4 @@ ---- -title: no-multiple-empty-lines -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-multiple-empty-lines.md -rule_type: layout ---- - - +# no-multiple-empty-lines Disallows multiple empty lines. @@ -33,6 +26,7 @@ Examples of **incorrect** code for this rule with the default `{ "max": 2 }` opt var foo = 5; + var bar = 3; ``` @@ -43,6 +37,7 @@ Examples of **correct** code for this rule with the default `{ "max": 2 }` optio var foo = 5; + var bar = 3; ``` @@ -55,8 +50,10 @@ Examples of **incorrect** code for this rule with the `{ max: 2, maxEOF: 0 }` op var foo = 5; + var bar = 3; + ``` Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 0 }` options: @@ -66,6 +63,7 @@ Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 0 }` opti var foo = 5; + var bar = 3; ``` @@ -103,8 +101,10 @@ Examples of **incorrect** code for this rule with the `{ max: 2, maxBOF: 1 }` op ```js /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/ + var foo = 5; + var bar = 3; ``` @@ -115,6 +115,7 @@ Examples of **correct** code for this rule with the `{ max: 2, maxBOF: 1 }` opti var foo = 5; + var bar = 3; ``` diff --git a/docs/src/rules/no-native-reassign.md b/docs/src/rules/no-native-reassign.md index f66a09ca48d..ca668413818 100644 --- a/docs/src/rules/no-native-reassign.md +++ b/docs/src/rules/no-native-reassign.md @@ -1,13 +1,8 @@ ---- -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 ---- +# no-native-reassign Disallows reassignment of native objects. -This rule was **deprecated** in ESLint v3.3.0 and replaced by the [no-global-assign](no-global-assign) rule. +This rule was **deprecated** in ESLint v3.3.0 and replaced by the [no-global-assign](no-global-assign.md) rule. JavaScript environments contain a number of built-in global variables, such as `window` in browsers and `process` in Node.js. In almost all cases, you don't want to assign a value to these global variables as doing so could result in losing access to important functionality. For example, you probably don't want to do this in browser code: @@ -93,6 +88,6 @@ 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) +* [no-extend-native](no-extend-native.md) +* [no-redeclare](no-redeclare.md) +* [no-shadow](no-shadow.md) diff --git a/docs/src/rules/no-negated-condition.md b/docs/src/rules/no-negated-condition.md index c6f62f0f08c..cb2b3f66bcf 100644 --- a/docs/src/rules/no-negated-condition.md +++ b/docs/src/rules/no-negated-condition.md @@ -1,9 +1,4 @@ ---- -title: no-negated-condition -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-negated-condition.md -rule_type: suggestion ---- +# no-negated-condition Disallows negated conditions. diff --git a/docs/src/rules/no-negated-in-lhs.md b/docs/src/rules/no-negated-in-lhs.md index 052b863202d..16bdfd09288 100644 --- a/docs/src/rules/no-negated-in-lhs.md +++ b/docs/src/rules/no-negated-in-lhs.md @@ -1,13 +1,8 @@ ---- -title: no-negated-in-lhs -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-negated-in-lhs.md -rule_type: problem ---- +# no-negated-in-lhs Disallows negating the left operand in `in` expressions. -This rule was **deprecated** in ESLint v3.3.0 and replaced by the [no-unsafe-negation](no-unsafe-negation) rule. +This rule was **deprecated** in ESLint v3.3.0 and replaced by the [no-unsafe-negation](no-unsafe-negation.md) rule. Just as developers might type `-a + b` when they mean `-(a + b)` for the negative of a sum, they might type `!key in object` by mistake when they almost certainly mean `!(key in object)` to test that a key is not in an object. diff --git a/docs/src/rules/no-nested-ternary.md b/docs/src/rules/no-nested-ternary.md index a9194ff3064..9f359360db0 100644 --- a/docs/src/rules/no-nested-ternary.md +++ b/docs/src/rules/no-nested-ternary.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-nested-ternary Disallows nested ternary expressions. @@ -47,5 +42,5 @@ if (foo) { ## Related Rules -* [no-ternary](no-ternary) -* [no-unneeded-ternary](no-unneeded-ternary) +* [no-ternary](no-ternary.md) +* [no-unneeded-ternary](no-unneeded-ternary.md) diff --git a/docs/src/rules/no-new-func.md b/docs/src/rules/no-new-func.md index 28e663b4455..dd2b325aead 100644 --- a/docs/src/rules/no-new-func.md +++ b/docs/src/rules/no-new-func.md @@ -1,9 +1,4 @@ ---- -title: no-new-func -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new-func.md -rule_type: suggestion ---- +# no-new-func Disallows `new` operators with the `Function` object. diff --git a/docs/src/rules/no-new-object.md b/docs/src/rules/no-new-object.md index 96533e5f03d..7dd70053596 100644 --- a/docs/src/rules/no-new-object.md +++ b/docs/src/rules/no-new-object.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-new-object Disallows `new` operators with the `Object` object. @@ -56,5 +51,5 @@ If you wish to allow the use of the `Object` constructor, you can safely turn th ## Related Rules -* [no-array-constructor](no-array-constructor) -* [no-new-wrappers](no-new-wrappers) +* [no-array-constructor](no-array-constructor.md) +* [no-new-wrappers](no-new-wrappers.md) diff --git a/docs/src/rules/no-new-require.md b/docs/src/rules/no-new-require.md index 13500baec20..69001bc168b 100644 --- a/docs/src/rules/no-new-require.md +++ b/docs/src/rules/no-new-require.md @@ -1,9 +1,4 @@ ---- -title: no-new-require -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new-require.md -rule_type: suggestion ---- +# no-new-require Disallows `new` operators with calls to `require`. diff --git a/docs/src/rules/no-new-symbol.md b/docs/src/rules/no-new-symbol.md index 06e965d5d4e..e5684e7911e 100644 --- a/docs/src/rules/no-new-symbol.md +++ b/docs/src/rules/no-new-symbol.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-new-symbol Disallows `new` operators with the `Symbol` object. @@ -40,6 +33,7 @@ Examples of **correct** code for this rule: var foo = Symbol('foo'); + // Ignores shadowed Symbol. function bar(Symbol) { const baz = new Symbol("baz"); diff --git a/docs/src/rules/no-new-wrappers.md b/docs/src/rules/no-new-wrappers.md index 91f2d1821dd..04ef96117ac 100644 --- a/docs/src/rules/no-new-wrappers.md +++ b/docs/src/rules/no-new-wrappers.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-new-wrappers Disallows `new` operators with the `String`, `Number`, and `Boolean` objects. @@ -77,8 +72,8 @@ If you want to allow the use of primitive wrapper objects, then you can safely d ## Related Rules -* [no-array-constructor](no-array-constructor) -* [no-new-object](no-new-object) +* [no-array-constructor](no-array-constructor.md) +* [no-new-object](no-new-object.md) ## Further Reading diff --git a/docs/src/rules/no-new.md b/docs/src/rules/no-new.md index 41d46310df0..0e7020c87e6 100644 --- a/docs/src/rules/no-new.md +++ b/docs/src/rules/no-new.md @@ -1,9 +1,4 @@ ---- -title: no-new -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-new.md -rule_type: suggestion ---- +# no-new Disallows `new` operators outside of assignments or comparisons. diff --git a/docs/src/rules/no-nonoctal-decimal-escape.md b/docs/src/rules/no-nonoctal-decimal-escape.md index 22b08a254c9..db8bf55193f 100644 --- a/docs/src/rules/no-nonoctal-decimal-escape.md +++ b/docs/src/rules/no-nonoctal-decimal-escape.md @@ -1,13 +1,4 @@ ---- -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 ---- - - - - +# no-nonoctal-decimal-escape Disallows `\8` and `\9` escape sequences in string literals. @@ -66,7 +57,7 @@ var quux = "\0\u0038"; ## Related Rules -* [no-octal-escape](no-octal-escape) +* [no-octal-escape](no-octal-escape.md) ## Further Reading diff --git a/docs/src/rules/no-obj-calls.md b/docs/src/rules/no-obj-calls.md index f8a3941037a..0d0c1e8b146 100644 --- a/docs/src/rules/no-obj-calls.md +++ b/docs/src/rules/no-obj-calls.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-obj-calls Disallows calling global object properties as functions. diff --git a/docs/src/rules/no-octal-escape.md b/docs/src/rules/no-octal-escape.md index b6a06a4d7eb..3ff43f00c90 100644 --- a/docs/src/rules/no-octal-escape.md +++ b/docs/src/rules/no-octal-escape.md @@ -1,9 +1,4 @@ ---- -title: no-octal-escape -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-octal-escape.md -rule_type: suggestion ---- +# no-octal-escape Disallows octal escape sequences in string literals. diff --git a/docs/src/rules/no-octal.md b/docs/src/rules/no-octal.md index 513ac64781a..4757385c20d 100644 --- a/docs/src/rules/no-octal.md +++ b/docs/src/rules/no-octal.md @@ -1,11 +1,4 @@ ---- -title: no-octal -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-octal.md -rule_type: suggestion ---- - - +# no-octal Disallows octal literals. diff --git a/docs/src/rules/no-param-reassign.md b/docs/src/rules/no-param-reassign.md index 08200d83828..b5c86797769 100644 --- a/docs/src/rules/no-param-reassign.md +++ b/docs/src/rules/no-param-reassign.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-param-reassign Disallows reassignment of function parameters. diff --git a/docs/src/rules/no-path-concat.md b/docs/src/rules/no-path-concat.md index e419526769c..23ed0cd6e40 100644 --- a/docs/src/rules/no-path-concat.md +++ b/docs/src/rules/no-path-concat.md @@ -1,9 +1,4 @@ ---- -title: no-path-concat -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-path-concat.md -rule_type: suggestion ---- +# no-path-concat Disallows string concatenation when using `__dirname` and `__filename`. diff --git a/docs/src/rules/no-plusplus.md b/docs/src/rules/no-plusplus.md index 5f93853717f..f0c3b768440 100644 --- a/docs/src/rules/no-plusplus.md +++ b/docs/src/rules/no-plusplus.md @@ -1,9 +1,4 @@ ---- -title: no-plusplus -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-plusplus.md -rule_type: suggestion ---- +# no-plusplus Disallows the unary operators `++` and `--`. diff --git a/docs/src/rules/no-process-env.md b/docs/src/rules/no-process-env.md index 9bd325cf218..d7ce5a78165 100644 --- a/docs/src/rules/no-process-env.md +++ b/docs/src/rules/no-process-env.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-process-env Disallows the use of `process.env`. diff --git a/docs/src/rules/no-process-exit.md b/docs/src/rules/no-process-exit.md index 59913153395..53ddf1c4576 100644 --- a/docs/src/rules/no-process-exit.md +++ b/docs/src/rules/no-process-exit.md @@ -1,9 +1,4 @@ ---- -title: no-process-exit -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-process-exit.md -rule_type: suggestion ---- +# no-process-exit Disallows the use of `process.exit()`. diff --git a/docs/src/rules/no-promise-executor-return.md b/docs/src/rules/no-promise-executor-return.md index d57988512ae..59076b55f4b 100644 --- a/docs/src/rules/no-promise-executor-return.md +++ b/docs/src/rules/no-promise-executor-return.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-promise-executor-return Disallows returning values from Promise executor functions. @@ -96,7 +91,7 @@ Promise.resolve(1); ## Related Rules -* [no-async-promise-executor](no-async-promise-executor) +* [no-async-promise-executor](no-async-promise-executor.md) ## Further Reading diff --git a/docs/src/rules/no-proto.md b/docs/src/rules/no-proto.md index 77063d3112f..fbc6b46114a 100644 --- a/docs/src/rules/no-proto.md +++ b/docs/src/rules/no-proto.md @@ -1,9 +1,4 @@ ---- -title: no-proto -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-proto.md -rule_type: suggestion ---- +# no-proto Disallows the use of the `__proto__` property. diff --git a/docs/src/rules/no-prototype-builtins.md b/docs/src/rules/no-prototype-builtins.md index c2e9f1d8ecf..93423d90845 100644 --- a/docs/src/rules/no-prototype-builtins.md +++ b/docs/src/rules/no-prototype-builtins.md @@ -1,11 +1,4 @@ ---- -title: no-prototype-builtins -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-prototype-builtins.md -rule_type: problem ---- - - +# no-prototype-builtins Disallows calling some `Object.prototype` methods directly on objects. diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index e0e2e75634e..ed107f28c58 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -1,11 +1,4 @@ ---- -title: no-redeclare -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-redeclare.md -rule_type: suggestion ---- - - +# no-redeclare Disallows variable redeclarations. @@ -86,8 +79,8 @@ 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. +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.md) rule with the `"builtinGlobals"` option should be used. ## Related Rules -* [no-shadow](no-shadow) +* [no-shadow](no-shadow.md) diff --git a/docs/src/rules/no-regex-spaces.md b/docs/src/rules/no-regex-spaces.md index 2edf2e586f4..158ee9ce878 100644 --- a/docs/src/rules/no-regex-spaces.md +++ b/docs/src/rules/no-regex-spaces.md @@ -1,13 +1,4 @@ ---- -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 ---- - - - - +# no-regex-spaces Disallows multiple spaces in regular expression literals. @@ -53,5 +44,5 @@ If you want to allow multiple spaces in a regular expression, then you can safel ## Related Rules -* [no-div-regex](no-div-regex) -* [no-control-regex](no-control-regex) +* [no-div-regex](no-div-regex.md) +* [no-control-regex](no-control-regex.md) diff --git a/docs/src/rules/no-reserved-keys.md b/docs/src/rules/no-reserved-keys.md index 5644d0042cd..8eb2b56ed3d 100644 --- a/docs/src/rules/no-reserved-keys.md +++ b/docs/src/rules/no-reserved-keys.md @@ -1,13 +1,8 @@ ---- -title: no-reserved-keys -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-reserved-keys.md - ---- +# no-reserved-keys Disallows unquoted reserved words as property names in object literals. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [quote-props](quote-props) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [quote-props](quote-props.md) rule. ECMAScript 3 described as series of keywords and reserved words, such as `if` and `public`, that are used or intended to be used for a core language feature. The specification also indicated that these keywords and reserved words could not be used as object property names without being enclosed in strings. An error occurs in an ECMAScript 3 environment when you use a keyword or reserved word in an object literal. For example: diff --git a/docs/src/rules/no-restricted-exports.md b/docs/src/rules/no-restricted-exports.md index e168c1cdca4..9474e6eae29 100644 --- a/docs/src/rules/no-restricted-exports.md +++ b/docs/src/rules/no-restricted-exports.md @@ -1,9 +1,4 @@ ---- -title: no-restricted-exports -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-exports.md -rule_type: suggestion ---- +# no-restricted-exports Disallows specified names in exports. diff --git a/docs/src/rules/no-restricted-globals.md b/docs/src/rules/no-restricted-globals.md index 5164b9f15c7..4b7b9dfbb9b 100644 --- a/docs/src/rules/no-restricted-globals.md +++ b/docs/src/rules/no-restricted-globals.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-restricted-globals Disallows specific global variables. @@ -93,5 +88,5 @@ function onClick() { ## Related Rules -* [no-restricted-properties](no-restricted-properties) -* [no-restricted-syntax](no-restricted-syntax) +* [no-restricted-properties](no-restricted-properties.md) +* [no-restricted-syntax](no-restricted-syntax.md) diff --git a/docs/src/rules/no-restricted-imports.md b/docs/src/rules/no-restricted-imports.md index d4543c20e30..3337ab83217 100644 --- a/docs/src/rules/no-restricted-imports.md +++ b/docs/src/rules/no-restricted-imports.md @@ -1,9 +1,4 @@ ---- -title: no-restricted-imports -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-imports.md -rule_type: suggestion ---- +# no-restricted-imports Disallows specific imports. diff --git a/docs/src/rules/no-restricted-modules.md b/docs/src/rules/no-restricted-modules.md index a4ef2216cde..b82ebe40df7 100644 --- a/docs/src/rules/no-restricted-modules.md +++ b/docs/src/rules/no-restricted-modules.md @@ -1,9 +1,4 @@ ---- -title: no-restricted-modules -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-restricted-modules.md -rule_type: suggestion ---- +# no-restricted-modules Disallows Node.js modules. diff --git a/docs/src/rules/no-restricted-properties.md b/docs/src/rules/no-restricted-properties.md index a2781c9d773..b2b2f128a9b 100644 --- a/docs/src/rules/no-restricted-properties.md +++ b/docs/src/rules/no-restricted-properties.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-restricted-properties Disallows certain object properties. @@ -127,5 +122,5 @@ If you don't have any object/property combinations to restrict, you should not u ## Related Rules -* [no-restricted-globals](no-restricted-globals) -* [no-restricted-syntax](no-restricted-syntax) +* [no-restricted-globals](no-restricted-globals.md) +* [no-restricted-syntax](no-restricted-syntax.md) diff --git a/docs/src/rules/no-restricted-syntax.md b/docs/src/rules/no-restricted-syntax.md index e64d809639e..9b21aea5ba4 100644 --- a/docs/src/rules/no-restricted-syntax.md +++ b/docs/src/rules/no-restricted-syntax.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-restricted-syntax Disallows specified syntax. @@ -85,7 +80,7 @@ If you don't want to restrict your code from using any JavaScript features or sy ## Related Rules -* [no-alert](no-alert) -* [no-console](no-console) -* [no-debugger](no-debugger) -* [no-restricted-properties](no-restricted-properties) +* [no-alert](no-alert.md) +* [no-console](no-console.md) +* [no-debugger](no-debugger.md) +* [no-restricted-properties](no-restricted-properties.md) diff --git a/docs/src/rules/no-return-assign.md b/docs/src/rules/no-return-assign.md index 92f4cf715fc..60d18a0805f 100644 --- a/docs/src/rules/no-return-assign.md +++ b/docs/src/rules/no-return-assign.md @@ -1,9 +1,4 @@ ---- -title: no-return-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-return-assign.md -rule_type: suggestion ---- +# no-return-assign Disallows assignment operators in `return` statements. diff --git a/docs/src/rules/no-return-await.md b/docs/src/rules/no-return-await.md index 2ec7bbe02f6..1108ff1f146 100644 --- a/docs/src/rules/no-return-await.md +++ b/docs/src/rules/no-return-await.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-return-await Disallows unnecessary `return await`. diff --git a/docs/src/rules/no-script-url.md b/docs/src/rules/no-script-url.md index 582233cc0f8..82280bd9b38 100644 --- a/docs/src/rules/no-script-url.md +++ b/docs/src/rules/no-script-url.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-script-url Disallows `javascript:` URLs. diff --git a/docs/src/rules/no-self-assign.md b/docs/src/rules/no-self-assign.md index 1bc3e6c7d9e..e648f8fb895 100644 --- a/docs/src/rules/no-self-assign.md +++ b/docs/src/rules/no-self-assign.md @@ -1,11 +1,4 @@ ---- -title: no-self-assign -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-self-assign.md -rule_type: problem ---- - - +# no-self-assign Disallows assignments where both sides are exactly the same. diff --git a/docs/src/rules/no-self-compare.md b/docs/src/rules/no-self-compare.md index 744fbd8818c..00e09f8e3ae 100644 --- a/docs/src/rules/no-self-compare.md +++ b/docs/src/rules/no-self-compare.md @@ -1,9 +1,4 @@ ---- -title: no-self-compare -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-self-compare.md -rule_type: problem ---- +# no-self-compare Disallows comparisons where both sides are exactly the same. diff --git a/docs/src/rules/no-sequences.md b/docs/src/rules/no-sequences.md index cb17caa7ccf..b6dfaf7a006 100644 --- a/docs/src/rules/no-sequences.md +++ b/docs/src/rules/no-sequences.md @@ -1,9 +1,4 @@ ---- -title: no-sequences -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-sequences.md -rule_type: suggestion ---- +# no-sequences Disallows use of the comma operator. diff --git a/docs/src/rules/no-setter-return.md b/docs/src/rules/no-setter-return.md index 527411134b6..9c39199020f 100644 --- a/docs/src/rules/no-setter-return.md +++ b/docs/src/rules/no-setter-return.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-setter-return Disallows returning values from setters. @@ -103,7 +96,7 @@ Object.defineProperty(foo, "bar", { ## Related Rules -* [getter-return](getter-return) +* [getter-return](getter-return.md) ## Further Reading diff --git a/docs/src/rules/no-shadow-restricted-names.md b/docs/src/rules/no-shadow-restricted-names.md index e1c13853ac4..7b2328f3b90 100644 --- a/docs/src/rules/no-shadow-restricted-names.md +++ b/docs/src/rules/no-shadow-restricted-names.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-shadow-restricted-names Disallows identifiers from shadowing restricted names. @@ -48,7 +41,7 @@ var undefined; ## Related Rules -* [no-shadow](no-shadow) +* [no-shadow](no-shadow.md) ## Further Reading diff --git a/docs/src/rules/no-shadow.md b/docs/src/rules/no-shadow.md index de033113bfe..284b7a1b9a2 100644 --- a/docs/src/rules/no-shadow.md +++ b/docs/src/rules/no-shadow.md @@ -1,9 +1,4 @@ ---- -title: no-shadow -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-shadow.md -rule_type: suggestion ---- +# no-shadow Disallows variable declarations from shadowing variables declared in the outer scope. @@ -201,7 +196,7 @@ The rationale for callback functions is the assumption that they will be called ## Related Rules -* [no-shadow-restricted-names](no-shadow-restricted-names) +* [no-shadow-restricted-names](no-shadow-restricted-names.md) ## Further Reading diff --git a/docs/src/rules/no-space-before-semi.md b/docs/src/rules/no-space-before-semi.md index 60c2116fd8e..a309312c372 100644 --- a/docs/src/rules/no-space-before-semi.md +++ b/docs/src/rules/no-space-before-semi.md @@ -1,13 +1,8 @@ ---- -title: no-space-before-semi -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-space-before-semi.md - ---- +# no-space-before-semi Disallows spaces before semicolons. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [semi-spacing](semi-spacing) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [semi-spacing](semi-spacing.md) rule. JavaScript allows for placing unnecessary spaces between an expression and the closing semicolon. @@ -46,5 +41,5 @@ var foo = "bar"; ## Related Rules -* [semi](semi) -* [no-extra-semi](no-extra-semi) +* [semi](semi.md) +* [no-extra-semi](no-extra-semi.md) diff --git a/docs/src/rules/no-spaced-func.md b/docs/src/rules/no-spaced-func.md index b06d81ae426..e4bf0993989 100644 --- a/docs/src/rules/no-spaced-func.md +++ b/docs/src/rules/no-spaced-func.md @@ -1,15 +1,8 @@ ---- -title: no-spaced-func -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-spaced-func.md -rule_type: layout ---- - - +# no-spaced-func Disallows spacing between function identifiers and their applications. -This rule was **deprecated** in ESLint v3.3.0 and replaced by the [func-call-spacing](func-call-spacing) rule. +This rule was **deprecated** in ESLint v3.3.0 and replaced by the [func-call-spacing](func-call-spacing.md) rule. While it's possible to have whitespace between the name of a function and the parentheses that execute it, such patterns tend to look more like errors. diff --git a/docs/src/rules/no-sparse-arrays.md b/docs/src/rules/no-sparse-arrays.md index 4340619cb8d..6720c4b9c38 100644 --- a/docs/src/rules/no-sparse-arrays.md +++ b/docs/src/rules/no-sparse-arrays.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-sparse-arrays Disallows sparse arrays. diff --git a/docs/src/rules/no-sync.md b/docs/src/rules/no-sync.md index 2c839f42e64..57d33d93343 100644 --- a/docs/src/rules/no-sync.md +++ b/docs/src/rules/no-sync.md @@ -1,9 +1,4 @@ ---- -title: no-sync -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-sync.md -rule_type: suggestion ---- +# no-sync Disallows synchronous methods. diff --git a/docs/src/rules/no-tabs.md b/docs/src/rules/no-tabs.md index fa26235ffce..29d8f34cc6a 100644 --- a/docs/src/rules/no-tabs.md +++ b/docs/src/rules/no-tabs.md @@ -1,9 +1,4 @@ ---- -title: no-tabs -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-tabs.md -rule_type: layout ---- +# no-tabs Disallows all tabs. diff --git a/docs/src/rules/no-template-curly-in-string.md b/docs/src/rules/no-template-curly-in-string.md index 64b08187d94..e8e0d7349e8 100644 --- a/docs/src/rules/no-template-curly-in-string.md +++ b/docs/src/rules/no-template-curly-in-string.md @@ -1,9 +1,4 @@ ---- -title: no-template-curly-in-string -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-template-curly-in-string.md -rule_type: problem ---- +# no-template-curly-in-string Disallows template literal placeholder syntax in regular strings. diff --git a/docs/src/rules/no-ternary.md b/docs/src/rules/no-ternary.md index 280862070c6..357da016630 100644 --- a/docs/src/rules/no-ternary.md +++ b/docs/src/rules/no-ternary.md @@ -1,9 +1,4 @@ ---- -title: no-ternary -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-ternary.md -rule_type: suggestion ---- +# no-ternary Disallows ternary operators. @@ -53,5 +48,5 @@ function quux() { ## Related Rules -* [no-nested-ternary](no-nested-ternary) -* [no-unneeded-ternary](no-unneeded-ternary) +* [no-nested-ternary](no-nested-ternary.md) +* [no-unneeded-ternary](no-unneeded-ternary.md) diff --git a/docs/src/rules/no-this-before-super.md b/docs/src/rules/no-this-before-super.md index 7b679d85059..e783a876c33 100644 --- a/docs/src/rules/no-this-before-super.md +++ b/docs/src/rules/no-this-before-super.md @@ -1,11 +1,4 @@ ---- -title: no-this-before-super -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-this-before-super.md -rule_type: problem ---- - - +# no-this-before-super Disallows use of `this`/`super` before calling `super()` in constructors. diff --git a/docs/src/rules/no-throw-literal.md b/docs/src/rules/no-throw-literal.md index 52d5ad44236..452a8afb755 100644 --- a/docs/src/rules/no-throw-literal.md +++ b/docs/src/rules/no-throw-literal.md @@ -1,9 +1,4 @@ ---- -title: no-throw-literal -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-throw-literal.md -rule_type: suggestion ---- +# no-throw-literal Restricts what can be thrown as an exception. diff --git a/docs/src/rules/no-trailing-spaces.md b/docs/src/rules/no-trailing-spaces.md index 515e8ad6f8c..0a94173ed84 100644 --- a/docs/src/rules/no-trailing-spaces.md +++ b/docs/src/rules/no-trailing-spaces.md @@ -1,11 +1,4 @@ ---- -title: no-trailing-spaces -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-trailing-spaces.md -rule_type: layout ---- - - +# no-trailing-spaces Disallows trailing whitespace at the end of lines. diff --git a/docs/src/rules/no-undef-init.md b/docs/src/rules/no-undef-init.md index 830d219e8b1..f0dda6fab7a 100644 --- a/docs/src/rules/no-undef-init.md +++ b/docs/src/rules/no-undef-init.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-undef-init Disallows initializing variables to `undefined`. @@ -132,5 +125,5 @@ for (i = 0; i < 10; i++) { ## Related Rules -* [no-undefined](no-undefined) -* [no-void](no-void) +* [no-undefined](no-undefined.md) +* [no-void](no-void.md) diff --git a/docs/src/rules/no-undef.md b/docs/src/rules/no-undef.md index f3f99677911..71f6b03294d 100644 --- a/docs/src/rules/no-undef.md +++ b/docs/src/rules/no-undef.md @@ -1,11 +1,4 @@ ---- -title: no-undef -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-undef.md -rule_type: problem ---- - - +# no-undef Disallows the use of undeclared variables unless mentioned in `/*global */` comments. @@ -35,10 +28,10 @@ var bar = a + 1; ``` Note that this rule does not disallow assignments to read-only global variables. -See [no-global-assign](no-global-assign) if you also want to disallow those assignments. +See [no-global-assign](no-global-assign.md) if you also want to disallow those assignments. This rule also does not disallow redeclarations of global variables. -See [no-redeclare](no-redeclare) if you also want to disallow those redeclarations. +See [no-redeclare](no-redeclare.md) if you also want to disallow those redeclarations. ## Options @@ -77,7 +70,7 @@ if(typeof a === "string"){} ## Environments -For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in [Specifying Environments](../user-guide/configuring/language-options#specifying-environments). A few examples are given below. +For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in [Specifying Environments](../user-guide/configuring/language-options.md#specifying-environments). A few examples are given below. ### browser @@ -112,8 +105,8 @@ If explicit declaration of global variables is not to your taste. ## Related Rules -* [no-global-assign](no-global-assign) -* [no-redeclare](no-redeclare) +* [no-global-assign](no-global-assign.md) +* [no-redeclare](no-redeclare.md) ## Compatibility diff --git a/docs/src/rules/no-undefined.md b/docs/src/rules/no-undefined.md index 54da12de5ce..9313dfb23ba 100644 --- a/docs/src/rules/no-undefined.md +++ b/docs/src/rules/no-undefined.md @@ -1,9 +1,4 @@ ---- -title: no-undefined -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-undefined.md -rule_type: suggestion ---- +# no-undefined Disallows the use of `undefined` as an identifier. @@ -27,7 +22,7 @@ Because `undefined` can be overwritten or shadowed, reading `undefined` can give * Checking if a value is `undefined` should be done with `typeof`. * Using the `void` operator to generate the value of `undefined` if necessary. -As an alternative, you can use the [no-global-assign](no-global-assign) and [no-shadow-restricted-names](no-shadow-restricted-names) rules to prevent `undefined` from being shadowed or assigned a different value. This ensures that `undefined` will always hold its original, expected value. +As an alternative, you can use the [no-global-assign](no-global-assign.md) and [no-shadow-restricted-names](no-shadow-restricted-names.md) rules to prevent `undefined` from being shadowed or assigned a different value. This ensures that `undefined` will always hold its original, expected value. ## Rule Details @@ -73,10 +68,10 @@ If you want to allow the use of `undefined` in your code, then you can safely tu ## 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) +* [no-undef-init](no-undef-init.md) +* [no-void](no-void.md) +* [no-shadow-restricted-names](no-shadow-restricted-names.md) +* [no-global-assign](no-global-assign.md) ## Further Reading diff --git a/docs/src/rules/no-underscore-dangle.md b/docs/src/rules/no-underscore-dangle.md index 73b13244602..a4535d3f481 100644 --- a/docs/src/rules/no-underscore-dangle.md +++ b/docs/src/rules/no-underscore-dangle.md @@ -1,9 +1,4 @@ ---- -title: no-underscore-dangle -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-underscore-dangle.md -rule_type: suggestion ---- +# no-underscore-dangle Disallows dangling underscores in identifiers. diff --git a/docs/src/rules/no-unexpected-multiline.md b/docs/src/rules/no-unexpected-multiline.md index 18a0b828a38..65b18bf8389 100644 --- a/docs/src/rules/no-unexpected-multiline.md +++ b/docs/src/rules/no-unexpected-multiline.md @@ -1,15 +1,8 @@ ---- -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 ---- - - +# no-unexpected-multiline Disallows confusing multiline expressions. -Semicolons are usually optional in JavaScript, because of automatic semicolon insertion (ASI). You can require or disallow semicolons with the [semi](./semi) rule. +Semicolons are usually optional in JavaScript, because of automatic semicolon insertion (ASI). You can require or disallow semicolons with the [semi](./semi.md) rule. The rules for ASI are relatively straightforward: As once described by Isaac Schlueter, a newline character always ends a statement, just like a semicolon, **except** where one of the following is true: @@ -74,10 +67,10 @@ 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. +Note that the patterns considered problems are **not** flagged by the [semi](semi.md) rule. ## Related Rules -* [func-call-spacing](func-call-spacing) -* [semi](semi) -* [space-unary-ops](space-unary-ops) +* [func-call-spacing](func-call-spacing.md) +* [semi](semi.md) +* [space-unary-ops](space-unary-ops.md) diff --git a/docs/src/rules/no-unmodified-loop-condition.md b/docs/src/rules/no-unmodified-loop-condition.md index 154d7c05d0f..8a4c8cc9f5b 100644 --- a/docs/src/rules/no-unmodified-loop-condition.md +++ b/docs/src/rules/no-unmodified-loop-condition.md @@ -1,9 +1,4 @@ ---- -title: no-unmodified-loop-condition -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unmodified-loop-condition.md -rule_type: problem ---- +# no-unmodified-loop-condition Disallows unmodified conditions of loops. diff --git a/docs/src/rules/no-unneeded-ternary.md b/docs/src/rules/no-unneeded-ternary.md index e1550e9f252..5d8575f5888 100644 --- a/docs/src/rules/no-unneeded-ternary.md +++ b/docs/src/rules/no-unneeded-ternary.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-unneeded-ternary Disallows ternary operators when simpler alternatives exist. @@ -19,6 +12,7 @@ var isYes = answer === 1 ? true : false; // Good var isYes = answer === 1; + // Bad var isNo = answer === 1 ? false : true; @@ -96,5 +90,5 @@ You can turn this rule off if you are not concerned with unnecessary complexity ## Related Rules -* [no-ternary](no-ternary) -* [no-nested-ternary](no-nested-ternary) +* [no-ternary](no-ternary.md) +* [no-nested-ternary](no-nested-ternary.md) diff --git a/docs/src/rules/no-unreachable-loop.md b/docs/src/rules/no-unreachable-loop.md index c777d4807dd..24668e9760c 100644 --- a/docs/src/rules/no-unreachable-loop.md +++ b/docs/src/rules/no-unreachable-loop.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-unreachable-loop Disallows loops with a body that allows only one iteration. @@ -191,7 +186,7 @@ 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) +* [no-unreachable](no-unreachable.md) +* [no-constant-condition](no-constant-condition.md) +* [no-unmodified-loop-condition](no-unmodified-loop-condition.md) +* [for-direction](for-direction.md) diff --git a/docs/src/rules/no-unreachable.md b/docs/src/rules/no-unreachable.md index 2af7ae0407c..d4689c0b1ee 100644 --- a/docs/src/rules/no-unreachable.md +++ b/docs/src/rules/no-unreachable.md @@ -1,11 +1,4 @@ ---- -title: no-unreachable -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unreachable.md -rule_type: problem ---- - - +# no-unreachable Disallows unreachable code after `return`, `throw`, `continue`, and `break` statements. diff --git a/docs/src/rules/no-unsafe-finally.md b/docs/src/rules/no-unsafe-finally.md index 51b4afe2786..56325e2a9c7 100644 --- a/docs/src/rules/no-unsafe-finally.md +++ b/docs/src/rules/no-unsafe-finally.md @@ -1,11 +1,4 @@ ---- -title: no-unsafe-finally -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unsafe-finally.md -rule_type: problem ---- - - +# no-unsafe-finally Disallows control flow statements in `finally` blocks. diff --git a/docs/src/rules/no-unsafe-negation.md b/docs/src/rules/no-unsafe-negation.md index a9379d58bfd..066bb5df6ee 100644 --- a/docs/src/rules/no-unsafe-negation.md +++ b/docs/src/rules/no-unsafe-negation.md @@ -1,13 +1,4 @@ ---- -title: no-unsafe-negation -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unsafe-negation.md -rule_type: problem ---- - - - - +# no-unsafe-negation Disallows negating the left operand of relational operators. diff --git a/docs/src/rules/no-unsafe-optional-chaining.md b/docs/src/rules/no-unsafe-optional-chaining.md index 879662df4ea..e57d6cd28d7 100644 --- a/docs/src/rules/no-unsafe-optional-chaining.md +++ b/docs/src/rules/no-unsafe-optional-chaining.md @@ -1,11 +1,4 @@ ---- -title: no-unsafe-optional-chaining -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unsafe-optional-chaining.md -rule_type: problem ---- - - +# no-unsafe-optional-chaining Disallows use of optional chaining in contexts where the `undefined` value is not allowed. diff --git a/docs/src/rules/no-unused-expressions.md b/docs/src/rules/no-unused-expressions.md index fb69dbd4909..c6a3fab9af2 100644 --- a/docs/src/rules/no-unused-expressions.md +++ b/docs/src/rules/no-unused-expressions.md @@ -1,9 +1,4 @@ ---- -title: no-unused-expressions -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unused-expressions.md -rule_type: suggestion ---- +# no-unused-expressions Disallows unused expressions. diff --git a/docs/src/rules/no-unused-labels.md b/docs/src/rules/no-unused-labels.md index ecfeb3c36ac..f400697cf3b 100644 --- a/docs/src/rules/no-unused-labels.md +++ b/docs/src/rules/no-unused-labels.md @@ -1,13 +1,4 @@ ---- -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 ---- - - - - +# no-unused-labels Disallows unused labels. @@ -74,6 +65,6 @@ If you don't want to be notified about unused labels, then it's safe to disable ## Related Rules -* [no-extra-label](./no-extra-label) -* [no-labels](./no-labels) -* [no-label-var](./no-label-var) +* [no-extra-label](./no-extra-label.md) +* [no-labels](./no-labels.md) +* [no-label-var](./no-label-var.md) diff --git a/docs/src/rules/no-unused-private-class-members.md b/docs/src/rules/no-unused-private-class-members.md index c3852c5aab3..092f1fe61ad 100644 --- a/docs/src/rules/no-unused-private-class-members.md +++ b/docs/src/rules/no-unused-private-class-members.md @@ -1,9 +1,4 @@ ---- -title: no-unused-private-class-members -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unused-private-class-members.md -rule_type: problem ---- +# no-unused-private-class-members Disallows unused private class members. diff --git a/docs/src/rules/no-unused-vars.md b/docs/src/rules/no-unused-vars.md index cea0d7f1ccd..ddf74823e7a 100644 --- a/docs/src/rules/no-unused-vars.md +++ b/docs/src/rules/no-unused-vars.md @@ -1,11 +1,4 @@ ---- -title: no-unused-vars -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-unused-vars.md -rule_type: problem ---- - - +# no-unused-vars Disallows unused variables. diff --git a/docs/src/rules/no-use-before-define.md b/docs/src/rules/no-use-before-define.md index f388a469540..1fb9dfaf80b 100644 --- a/docs/src/rules/no-use-before-define.md +++ b/docs/src/rules/no-use-before-define.md @@ -1,9 +1,4 @@ ---- -title: no-use-before-define -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-use-before-define.md -rule_type: problem ---- +# no-use-before-define Disallows the use of variables before they are defined. diff --git a/docs/src/rules/no-useless-backreference.md b/docs/src/rules/no-useless-backreference.md index 4d31b3b31e3..c488f922fa3 100644 --- a/docs/src/rules/no-useless-backreference.md +++ b/docs/src/rules/no-useless-backreference.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-useless-backreference Disallows useless backreferences in regular expressions. @@ -130,9 +123,9 @@ Examples of additional **correct** code for this rule: ## Related Rules -* [no-control-regex](no-control-regex) -* [no-empty-character-class](no-empty-character-class) -* [no-invalid-regexp](no-invalid-regexp) +* [no-control-regex](no-control-regex.md) +* [no-empty-character-class](no-empty-character-class.md) +* [no-invalid-regexp](no-invalid-regexp.md) ## Further Reading diff --git a/docs/src/rules/no-useless-call.md b/docs/src/rules/no-useless-call.md index 36765cecba4..5f252cf1654 100644 --- a/docs/src/rules/no-useless-call.md +++ b/docs/src/rules/no-useless-call.md @@ -1,9 +1,4 @@ ---- -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 ---- +# no-useless-call Disallows unnecessary `.call()` and `.apply()`. @@ -77,4 +72,4 @@ If you don't want to be notified about unnecessary `.call()` and `.apply()`, you ## Related Rules -* [prefer-spread](prefer-spread) +* [prefer-spread](prefer-spread.md) diff --git a/docs/src/rules/no-useless-catch.md b/docs/src/rules/no-useless-catch.md index 0359f807c08..12c5bc30664 100644 --- a/docs/src/rules/no-useless-catch.md +++ b/docs/src/rules/no-useless-catch.md @@ -1,11 +1,4 @@ ---- -title: no-useless-catch -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-catch.md -rule_type: suggestion ---- - - +# no-useless-catch Disallows unnecessary catch clauses. diff --git a/docs/src/rules/no-useless-computed-key.md b/docs/src/rules/no-useless-computed-key.md index 0049d773570..ce31c51aa87 100644 --- a/docs/src/rules/no-useless-computed-key.md +++ b/docs/src/rules/no-useless-computed-key.md @@ -1,11 +1,4 @@ ---- -title: no-useless-computed-key -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-computed-key.md -rule_type: suggestion ---- - - +# no-useless-computed-key Disallows unnecessary computed property keys in objects and classes. diff --git a/docs/src/rules/no-useless-concat.md b/docs/src/rules/no-useless-concat.md index 5e21f9de32f..fcfca8329ac 100644 --- a/docs/src/rules/no-useless-concat.md +++ b/docs/src/rules/no-useless-concat.md @@ -1,9 +1,4 @@ ---- -title: no-useless-concat -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-concat.md -rule_type: suggestion ---- +# no-useless-concat Disallows unnecessary concatenation of strings. diff --git a/docs/src/rules/no-useless-constructor.md b/docs/src/rules/no-useless-constructor.md index 58557862bac..6a628759ca9 100644 --- a/docs/src/rules/no-useless-constructor.md +++ b/docs/src/rules/no-useless-constructor.md @@ -1,9 +1,4 @@ ---- -title: no-useless-constructor -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-constructor.md -rule_type: suggestion ---- +# no-useless-constructor Disallows unnecessary constructors. diff --git a/docs/src/rules/no-useless-escape.md b/docs/src/rules/no-useless-escape.md index 4d1af9988bc..ef093c39a0e 100644 --- a/docs/src/rules/no-useless-escape.md +++ b/docs/src/rules/no-useless-escape.md @@ -1,13 +1,4 @@ ---- -title: no-useless-escape -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-escape.md -rule_type: suggestion ---- - - - - +# no-useless-escape Disallows unnecessary escape characters. diff --git a/docs/src/rules/no-useless-rename.md b/docs/src/rules/no-useless-rename.md index 58f127c9625..dfdc914488c 100644 --- a/docs/src/rules/no-useless-rename.md +++ b/docs/src/rules/no-useless-rename.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# no-useless-rename Disallows renaming import, export, and destructured assignments to the same name. @@ -132,7 +125,7 @@ You can safely disable this rule if you do not care about redundantly renaming i ## Related Rules -* [`object-shorthand`](object-shorthand) which can enforce this behavior for properties in object literals. +* [`object-shorthand`](object-shorthand.md) which can enforce this behavior for properties in object literals. ## Compatibility diff --git a/docs/src/rules/no-useless-return.md b/docs/src/rules/no-useless-return.md index b207177d35b..67ad47541f0 100644 --- a/docs/src/rules/no-useless-return.md +++ b/docs/src/rules/no-useless-return.md @@ -1,11 +1,4 @@ ---- -title: no-useless-return -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-useless-return.md -rule_type: suggestion ---- - - +# no-useless-return Disallows redundant return statements. diff --git a/docs/src/rules/no-var.md b/docs/src/rules/no-var.md index 8d8b754797c..19a4cc2d737 100644 --- a/docs/src/rules/no-var.md +++ b/docs/src/rules/no-var.md @@ -1,11 +1,4 @@ ---- -title: no-var -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-var.md -rule_type: suggestion ---- - - +# no-var Requires `let` or `const` instead of `var`. diff --git a/docs/src/rules/no-void.md b/docs/src/rules/no-void.md index 1ff4709267d..a4897f45ede 100644 --- a/docs/src/rules/no-void.md +++ b/docs/src/rules/no-void.md @@ -1,9 +1,4 @@ ---- -title: no-void -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-void.md -rule_type: suggestion ---- +# no-void Disallows use of the void operator. @@ -105,8 +100,8 @@ 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) +* [no-undef-init](no-undef-init.md) +* [no-undefined](no-undefined.md) ## Further Reading diff --git a/docs/src/rules/no-warning-comments.md b/docs/src/rules/no-warning-comments.md index 6775c41e408..befb259fcb8 100644 --- a/docs/src/rules/no-warning-comments.md +++ b/docs/src/rules/no-warning-comments.md @@ -1,9 +1,4 @@ ---- -title: no-warning-comments -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-warning-comments.md -rule_type: suggestion ---- +# no-warning-comments Disallows specified warning terms in comments. diff --git a/docs/src/rules/no-whitespace-before-property.md b/docs/src/rules/no-whitespace-before-property.md index c90bbe8a575..d6aa32c8e3f 100644 --- a/docs/src/rules/no-whitespace-before-property.md +++ b/docs/src/rules/no-whitespace-before-property.md @@ -1,11 +1,4 @@ ---- -title: no-whitespace-before-property -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-whitespace-before-property.md -rule_type: layout ---- - - +# no-whitespace-before-property Disallows whitespace before properties. diff --git a/docs/src/rules/no-with.md b/docs/src/rules/no-with.md index b7fa4d7cb6f..b485838ba27 100644 --- a/docs/src/rules/no-with.md +++ b/docs/src/rules/no-with.md @@ -1,11 +1,4 @@ ---- -title: no-with -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-with.md -rule_type: suggestion ---- - - +# no-with Disallows `with` statements. diff --git a/docs/src/rules/no-wrap-func.md b/docs/src/rules/no-wrap-func.md index 0285338ed4b..6580ea4e26c 100644 --- a/docs/src/rules/no-wrap-func.md +++ b/docs/src/rules/no-wrap-func.md @@ -1,13 +1,8 @@ ---- -title: no-wrap-func -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/no-wrap-func.md - ---- +# no-wrap-func Disallows unnecessary parentheses around function expressions. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-extra-parens](no-extra-parens) rule. The `"functions"` option in the new rule is equivalent to the removed rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-extra-parens](no-extra-parens.md) rule. The `"functions"` option in the new rule is equivalent to the removed rule. Although it's possible to wrap functions in parentheses, this can be confusing when the code also contains immediately-invoked function expressions (IIFEs) since parentheses are often used to make this distinction. For example: diff --git a/docs/src/rules/nonblock-statement-body-position.md b/docs/src/rules/nonblock-statement-body-position.md index 7ae31b5c43f..6c0c545e195 100644 --- a/docs/src/rules/nonblock-statement-body-position.md +++ b/docs/src/rules/nonblock-statement-body-position.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# nonblock-statement-body-position Enforces the location of single-line statements. @@ -36,7 +29,7 @@ if (foo) bar(); This rule aims to enforce a consistent location for single-line statements. -Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the [`curly`](/docs/rules/curly) rule instead. +Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the [`curly`](/docs/rules/curly.md) rule instead. ### Options @@ -160,7 +153,7 @@ 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. +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.md) rule, because this will disallow single-line statements entirely. ## Further Reading diff --git a/docs/src/rules/object-curly-newline.md b/docs/src/rules/object-curly-newline.md index 156a39a5405..31f7810840f 100644 --- a/docs/src/rules/object-curly-newline.md +++ b/docs/src/rules/object-curly-newline.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# object-curly-newline Enforces consistent line breaks after opening and before closing braces. @@ -378,6 +371,7 @@ Examples of **correct** code for this rule with the default `{ "consistent": tru /*eslint object-curly-newline: ["error", { "consistent": true }]*/ /*eslint-env es6*/ + let empty1 = {}; let empty2 = { }; @@ -545,10 +539,10 @@ If you don't want to enforce consistent line breaks after opening and before clo ## Related Rules -* [comma-spacing](comma-spacing) -* [key-spacing](key-spacing) -* [object-curly-spacing](object-curly-spacing) -* [object-property-newline](object-property-newline) +* [comma-spacing](comma-spacing.md) +* [key-spacing](key-spacing.md) +* [object-curly-spacing](object-curly-spacing.md) +* [object-property-newline](object-property-newline.md) ## Compatibility diff --git a/docs/src/rules/object-curly-spacing.md b/docs/src/rules/object-curly-spacing.md index bf2dceeb57f..7b48bd19d31 100644 --- a/docs/src/rules/object-curly-spacing.md +++ b/docs/src/rules/object-curly-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# object-curly-spacing Enforces consistent spacing inside braces. @@ -159,7 +152,7 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [array-bracket-spacing](array-bracket-spacing) -* [comma-spacing](comma-spacing) -* [computed-property-spacing](computed-property-spacing) -* [space-in-parens](space-in-parens) +* [array-bracket-spacing](array-bracket-spacing.md) +* [comma-spacing](comma-spacing.md) +* [computed-property-spacing](computed-property-spacing.md) +* [space-in-parens](space-in-parens.md) diff --git a/docs/src/rules/object-property-newline.md b/docs/src/rules/object-property-newline.md index 43bc8bd8ec7..c1a1af6607e 100644 --- a/docs/src/rules/object-property-newline.md +++ b/docs/src/rules/object-property-newline.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# object-property-newline Enforces placing object properties on separate lines. @@ -269,10 +262,10 @@ You can turn this rule off if you want to decide, case-by-case, whether to place ## Related Rules -* [brace-style](brace-style) -* [comma-dangle](comma-dangle) -* [key-spacing](key-spacing) -* [object-curly-spacing](object-curly-spacing) +* [brace-style](brace-style.md) +* [comma-dangle](comma-dangle.md) +* [key-spacing](key-spacing.md) +* [object-curly-spacing](object-curly-spacing.md) ## Compatibility diff --git a/docs/src/rules/object-shorthand.md b/docs/src/rules/object-shorthand.md index 24e3dbda9fb..4f196bf1d96 100644 --- a/docs/src/rules/object-shorthand.md +++ b/docs/src/rules/object-shorthand.md @@ -1,11 +1,4 @@ ---- -title: object-shorthand -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/object-shorthand.md -rule_type: suggestion ---- - - +# object-shorthand Requires or disallows method and property shorthand syntax for object literals. @@ -253,7 +246,7 @@ 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. +* [`no-useless-rename`](no-useless-rename.md) which disallows renaming import, export, and destructured assignments to the same name. ## Further Reading diff --git a/docs/src/rules/one-var-declaration-per-line.md b/docs/src/rules/one-var-declaration-per-line.md index bb6e0d991a0..33069c5891c 100644 --- a/docs/src/rules/one-var-declaration-per-line.md +++ b/docs/src/rules/one-var-declaration-per-line.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# one-var-declaration-per-line Requires or disallows newlines around variable declarations. @@ -95,4 +88,4 @@ let a, ## Related Rules -* [one-var](one-var) +* [one-var](one-var.md) diff --git a/docs/src/rules/one-var.md b/docs/src/rules/one-var.md index c7631e2493e..aa971eaf8ba 100644 --- a/docs/src/rules/one-var.md +++ b/docs/src/rules/one-var.md @@ -1,11 +1,4 @@ ---- -title: one-var -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/one-var.md -rule_type: suggestion ---- - - +# one-var Enforces variables to be declared either together or separately in functions. diff --git a/docs/src/rules/operator-assignment.md b/docs/src/rules/operator-assignment.md index 3f535fad92a..84fbf1c6239 100644 --- a/docs/src/rules/operator-assignment.md +++ b/docs/src/rules/operator-assignment.md @@ -1,11 +1,4 @@ ---- -title: operator-assignment -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/operator-assignment.md -rule_type: suggestion ---- - - +# operator-assignment Requires or disallows assignment operator shorthand where possible. diff --git a/docs/src/rules/operator-linebreak.md b/docs/src/rules/operator-linebreak.md index 085bc352147..ab3b821196b 100644 --- a/docs/src/rules/operator-linebreak.md +++ b/docs/src/rules/operator-linebreak.md @@ -1,11 +1,4 @@ ---- -title: operator-linebreak -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/operator-linebreak.md -rule_type: layout ---- - - +# operator-linebreak Enforces consistent linebreak style for operators. @@ -342,4 +335,4 @@ If your project will not be using a common operator line break style, turn this ## Related Rules -* [comma-style](comma-style) +* [comma-style](comma-style.md) diff --git a/docs/src/rules/padded-blocks.md b/docs/src/rules/padded-blocks.md index 731cf49cf49..3361f7bf59f 100644 --- a/docs/src/rules/padded-blocks.md +++ b/docs/src/rules/padded-blocks.md @@ -1,11 +1,4 @@ ---- -title: padded-blocks -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/padded-blocks.md -rule_type: layout ---- - - +# padded-blocks Requires or disallows padding within blocks. @@ -485,5 +478,5 @@ You can turn this rule off if you are not concerned with the consistency of padd ## Related Rules -* [lines-between-class-members](lines-between-class-members) -* [padding-line-between-statements](padding-line-between-statements) +* [lines-between-class-members](lines-between-class-members.md) +* [padding-line-between-statements](padding-line-between-statements.md) diff --git a/docs/src/rules/padding-line-between-statements.md b/docs/src/rules/padding-line-between-statements.md index 3cd684236cf..8b10438a3b2 100644 --- a/docs/src/rules/padding-line-between-statements.md +++ b/docs/src/rules/padding-line-between-statements.md @@ -1,11 +1,4 @@ ---- -title: padding-line-between-statements -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/padding-line-between-statements.md -rule_type: layout ---- - - +# padding-line-between-statements Requires or disallows padding lines between statements. @@ -94,7 +87,7 @@ You can supply any number of configurations. If a statement pair matches multipl ## Examples -This configuration would require blank lines before all `return` statements, like the [newline-before-return](newline-before-return) rule. +This configuration would require blank lines before all `return` statements, like the [newline-before-return](newline-before-return.md) rule. Examples of **incorrect** code for the `[{ blankLine: "always", prev: "*", next: "return" }]` configuration: @@ -131,7 +124,7 @@ function foo() { ---- -This configuration would require blank lines after every sequence of variable declarations, like the [newline-after-var](newline-after-var) rule. +This configuration would require blank lines after every sequence of variable declarations, like the [newline-after-var](newline-after-var.md) rule. Examples of **incorrect** code for the `[{ blankLine: "always", prev: ["const", "let", "var"], next: "*"}, { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]}]` configuration: @@ -207,7 +200,7 @@ class C { ---- -This configuration would require blank lines after all directive prologues, like the [lines-around-directive](lines-around-directive) rule. +This configuration would require blank lines after all directive prologues, like the [lines-around-directive](lines-around-directive.md) rule. Examples of **incorrect** code for the `[{ blankLine: "always", prev: "directive", next: "*" }, { blankLine: "any", prev: "directive", next: "directive" }]` configuration: diff --git a/docs/src/rules/prefer-arrow-callback.md b/docs/src/rules/prefer-arrow-callback.md index e4222dc098f..dc395b82746 100644 --- a/docs/src/rules/prefer-arrow-callback.md +++ b/docs/src/rules/prefer-arrow-callback.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# prefer-arrow-callback Requires using arrow functions for callbacks. diff --git a/docs/src/rules/prefer-const.md b/docs/src/rules/prefer-const.md index 7d652b35a40..48cc3338d2f 100644 --- a/docs/src/rules/prefer-const.md +++ b/docs/src/rules/prefer-const.md @@ -1,11 +1,4 @@ ---- -title: prefer-const -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-const.md -rule_type: suggestion ---- - - +# prefer-const Requires `const` declarations for variables that are never reassigned after declared. @@ -225,5 +218,5 @@ If you don't want to be notified about variables that are never reassigned after ## Related Rules -* [no-var](no-var) -* [no-use-before-define](no-use-before-define) +* [no-var](no-var.md) +* [no-use-before-define](no-use-before-define.md) diff --git a/docs/src/rules/prefer-destructuring.md b/docs/src/rules/prefer-destructuring.md index e32be78b48c..252199adc93 100644 --- a/docs/src/rules/prefer-destructuring.md +++ b/docs/src/rules/prefer-destructuring.md @@ -1,11 +1,4 @@ ---- -title: prefer-destructuring -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-destructuring.md -rule_type: suggestion ---- - - +# prefer-destructuring Requires destructuring from arrays and/or objects. diff --git a/docs/src/rules/prefer-exponentiation-operator.md b/docs/src/rules/prefer-exponentiation-operator.md index 72b24a574c5..15f120c900b 100644 --- a/docs/src/rules/prefer-exponentiation-operator.md +++ b/docs/src/rules/prefer-exponentiation-operator.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# prefer-exponentiation-operator Disallows the use of `Math.pow` in favor of the `**` operator. diff --git a/docs/src/rules/prefer-named-capture-group.md b/docs/src/rules/prefer-named-capture-group.md index a947a05c2a3..5667dd0d7c1 100644 --- a/docs/src/rules/prefer-named-capture-group.md +++ b/docs/src/rules/prefer-named-capture-group.md @@ -1,9 +1,4 @@ ---- -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 ---- +# prefer-named-capture-group Suggest using named capture group in regular expression. @@ -53,4 +48,4 @@ If you are targeting ECMAScript 2017 and/or older environments, you should not u ## Related Rules -* [no-invalid-regexp](./no-invalid-regexp) +* [no-invalid-regexp](./no-invalid-regexp.md) diff --git a/docs/src/rules/prefer-numeric-literals.md b/docs/src/rules/prefer-numeric-literals.md index 379bbb7fe48..b5dc6448ec7 100644 --- a/docs/src/rules/prefer-numeric-literals.md +++ b/docs/src/rules/prefer-numeric-literals.md @@ -1,11 +1,4 @@ ---- -title: prefer-numeric-literals -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-numeric-literals.md -rule_type: suggestion ---- - - +# prefer-numeric-literals Disallows `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals. diff --git a/docs/src/rules/prefer-object-has-own.md b/docs/src/rules/prefer-object-has-own.md index 91fdc8e9541..a0bc201b7a9 100644 --- a/docs/src/rules/prefer-object-has-own.md +++ b/docs/src/rules/prefer-object-has-own.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# prefer-object-has-own Prefer `Object.hasOwn()` over `Object.prototype.hasOwnProperty.call()`. @@ -17,7 +10,7 @@ if (Object.prototype.hasOwnProperty.call(object, "foo")) { } ``` -This is a common practice because methods on `Object.prototype` can sometimes be unavailable or redefined (see the [no-prototype-builtins](no-prototype-builtins) rule). +This is a common practice because methods on `Object.prototype` can sometimes be unavailable or redefined (see the [no-prototype-builtins](no-prototype-builtins.md) rule). Introduced in ES2022, `Object.hasOwn()` is a shorter alternative to `Object.prototype.hasOwnProperty.call()`: diff --git a/docs/src/rules/prefer-object-spread.md b/docs/src/rules/prefer-object-spread.md index fe6bad8aab5..34a815c1bac 100644 --- a/docs/src/rules/prefer-object-spread.md +++ b/docs/src/rules/prefer-object-spread.md @@ -1,11 +1,4 @@ ---- -title: prefer-object-spread -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-object-spread.md -rule_type: suggestion ---- - - +# prefer-object-spread Prefer use of an object spread over `Object.assign`. diff --git a/docs/src/rules/prefer-promise-reject-errors.md b/docs/src/rules/prefer-promise-reject-errors.md index 5c5c566997c..d0993d43b4b 100644 --- a/docs/src/rules/prefer-promise-reject-errors.md +++ b/docs/src/rules/prefer-promise-reject-errors.md @@ -1,9 +1,4 @@ ---- -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 ---- +# prefer-promise-reject-errors Requires using Error objects as Promise rejection reasons. @@ -71,9 +66,9 @@ new Promise(function(resolve, reject) { ## Known Limitations -Due to the limits of static analysis, this rule cannot guarantee that you will only reject Promises with `Error` objects. While the rule will report cases where it can guarantee that the rejection reason is clearly not an `Error`, it will not report cases where there is uncertainty about whether a given reason is an `Error`. For more information on this caveat, see the [similar limitations](no-throw-literal#known-limitations) in the `no-throw-literal` rule. +Due to the limits of static analysis, this rule cannot guarantee that you will only reject Promises with `Error` objects. While the rule will report cases where it can guarantee that the rejection reason is clearly not an `Error`, it will not report cases where there is uncertainty about whether a given reason is an `Error`. For more information on this caveat, see the [similar limitations](no-throw-literal.md#known-limitations) in the `no-throw-literal` rule. -To avoid conflicts between rules, this rule does not report non-error values used in `throw` statements in async functions, even though these lead to Promise rejections. To lint for these cases, use the [`no-throw-literal`](no-throw-literal) rule. +To avoid conflicts between rules, this rule does not report non-error values used in `throw` statements in async functions, even though these lead to Promise rejections. To lint for these cases, use the [`no-throw-literal`](no-throw-literal.md) rule. ## When Not To Use It @@ -81,7 +76,7 @@ If you're using custom non-error values as Promise rejection reasons, you can tu ## Related Rules -* [`no-throw-literal`](no-throw-literal) +* [`no-throw-literal`](no-throw-literal.md) ## Further Reading diff --git a/docs/src/rules/prefer-reflect.md b/docs/src/rules/prefer-reflect.md index 2c25ddd8ef9..d332f371255 100644 --- a/docs/src/rules/prefer-reflect.md +++ b/docs/src/rules/prefer-reflect.md @@ -1,9 +1,4 @@ ---- -title: prefer-reflect -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-reflect.md -rule_type: suggestion ---- +# prefer-reflect Suggest using Reflect methods where applicable. @@ -321,7 +316,7 @@ delete bar; // deleting variable Reflect.deleteProperty(foo, 'bar'); ``` -Note: For a rule preventing deletion of variables, see [no-delete-var instead](no-delete-var) +Note: For a rule preventing deletion of variables, see [no-delete-var instead](no-delete-var.md) Examples of **correct** code for this rule with the `{ "exceptions": ["delete"] }` option: @@ -341,6 +336,6 @@ In ES2015 (ES6) or later, if you don't want to be notified about places where Re ## Related Rules -* [no-useless-call](no-useless-call) -* [prefer-spread](prefer-spread) -* [no-delete-var](no-delete-var) +* [no-useless-call](no-useless-call.md) +* [prefer-spread](prefer-spread.md) +* [no-delete-var](no-delete-var.md) diff --git a/docs/src/rules/prefer-regex-literals.md b/docs/src/rules/prefer-regex-literals.md index 7ca6b3275f0..7c01166b642 100644 --- a/docs/src/rules/prefer-regex-literals.md +++ b/docs/src/rules/prefer-regex-literals.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# prefer-regex-literals Disallows use of the `RegExp` constructor in favor of regular expression literals. diff --git a/docs/src/rules/prefer-rest-params.md b/docs/src/rules/prefer-rest-params.md index 5eb69ba9622..d36127caae7 100644 --- a/docs/src/rules/prefer-rest-params.md +++ b/docs/src/rules/prefer-rest-params.md @@ -1,9 +1,4 @@ ---- -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 ---- +# prefer-rest-params Suggests using rest parameters instead of `arguments`. @@ -69,4 +64,4 @@ In ES2015 (ES6) or later, if you don't want to be notified about `arguments` var ## Related Rules -* [prefer-spread](prefer-spread) +* [prefer-spread](prefer-spread.md) diff --git a/docs/src/rules/prefer-spread.md b/docs/src/rules/prefer-spread.md index 08c0eae7308..00adc3d9018 100644 --- a/docs/src/rules/prefer-spread.md +++ b/docs/src/rules/prefer-spread.md @@ -1,9 +1,4 @@ ---- -title: prefer-spread -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-spread.md -rule_type: suggestion ---- +# prefer-spread Suggests using spread syntax instead of `.apply()`. @@ -82,4 +77,4 @@ In ES2015 (ES6) or later, if you don't want to be notified about `Function.proto ## Related Rules -* [no-useless-call](no-useless-call) +* [no-useless-call](no-useless-call.md) diff --git a/docs/src/rules/prefer-template.md b/docs/src/rules/prefer-template.md index f2045ee2692..bfea4a26e47 100644 --- a/docs/src/rules/prefer-template.md +++ b/docs/src/rules/prefer-template.md @@ -1,11 +1,4 @@ ---- -title: prefer-template -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/prefer-template.md -rule_type: suggestion ---- - - +# prefer-template Suggests using template literals instead of string concatenation. @@ -58,5 +51,5 @@ In ES2015 (ES6) or later, if you don't want to be notified about string concaten ## Related Rules -* [no-useless-concat](no-useless-concat) -* [quotes](quotes) +* [no-useless-concat](no-useless-concat.md) +* [quotes](quotes.md) diff --git a/docs/src/rules/quote-props.md b/docs/src/rules/quote-props.md index 6761bc0a3f1..9e2a7fb602e 100644 --- a/docs/src/rules/quote-props.md +++ b/docs/src/rules/quote-props.md @@ -1,11 +1,4 @@ ---- -title: quote-props -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/quote-props.md -rule_type: suggestion ---- - - +# quote-props Requires quotes around object literal property names. diff --git a/docs/src/rules/quotes.md b/docs/src/rules/quotes.md index be42f89b717..545c5347f86 100644 --- a/docs/src/rules/quotes.md +++ b/docs/src/rules/quotes.md @@ -1,11 +1,4 @@ ---- -title: quotes -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/quotes.md -rule_type: layout ---- - - +# quotes Enforces the consistent use of either backticks, double, or single quotes. @@ -156,7 +149,7 @@ var single = 'single'; var single = `single`; ``` -`{ "allowTemplateLiterals": false }` will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use [no-restricted-syntax](no-restricted-syntax) and target the `TemplateLiteral` selector. +`{ "allowTemplateLiterals": false }` will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use [no-restricted-syntax](no-restricted-syntax.md) and target the `TemplateLiteral` selector. ## When Not To Use It diff --git a/docs/src/rules/radix.md b/docs/src/rules/radix.md index b1adcee93a2..a1033fe8502 100644 --- a/docs/src/rules/radix.md +++ b/docs/src/rules/radix.md @@ -1,11 +1,4 @@ ---- -title: radix -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/radix.md -rule_type: suggestion ---- - - +# radix Enforces the consistent use of the radix argument when using `parseInt()`. diff --git a/docs/src/rules/require-atomic-updates.md b/docs/src/rules/require-atomic-updates.md index ee58f8115b0..2b107d53646 100644 --- a/docs/src/rules/require-atomic-updates.md +++ b/docs/src/rules/require-atomic-updates.md @@ -1,9 +1,4 @@ ---- -title: require-atomic-updates -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-atomic-updates.md -rule_type: problem ---- +# require-atomic-updates Disallows assignments that can lead to race conditions due to usage of `await` or `yield`. diff --git a/docs/src/rules/require-await.md b/docs/src/rules/require-await.md index 0d9362d230d..250d0e673f3 100644 --- a/docs/src/rules/require-await.md +++ b/docs/src/rules/require-await.md @@ -1,9 +1,4 @@ ---- -title: require-await -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-await.md -rule_type: suggestion ---- +# require-await Disallows async functions which have no `await` expression. @@ -90,4 +85,4 @@ If you are throwing an error inside of an asynchronous function for this purpose ## Related Rules -* [require-yield](require-yield) +* [require-yield](require-yield.md) diff --git a/docs/src/rules/require-jsdoc.md b/docs/src/rules/require-jsdoc.md index 52256697891..14a3dda51c4 100644 --- a/docs/src/rules/require-jsdoc.md +++ b/docs/src/rules/require-jsdoc.md @@ -1,9 +1,4 @@ ---- -title: require-jsdoc -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-jsdoc.md -rule_type: suggestion ---- +# require-jsdoc Requires JSDoc comments. @@ -193,4 +188,4 @@ If you do not require JSDoc for your functions, then you can leave this rule off ## Related Rules -* [valid-jsdoc](valid-jsdoc) +* [valid-jsdoc](valid-jsdoc.md) diff --git a/docs/src/rules/require-unicode-regexp.md b/docs/src/rules/require-unicode-regexp.md index 96d03569eb8..f920764e605 100644 --- a/docs/src/rules/require-unicode-regexp.md +++ b/docs/src/rules/require-unicode-regexp.md @@ -1,9 +1,4 @@ ---- -title: require-unicode-regexp -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-unicode-regexp.md -rule_type: suggestion ---- +# require-unicode-regexp Enforces the use of `u` flag on RegExp. diff --git a/docs/src/rules/require-yield.md b/docs/src/rules/require-yield.md index 291f438df40..5c073194ff3 100644 --- a/docs/src/rules/require-yield.md +++ b/docs/src/rules/require-yield.md @@ -1,11 +1,4 @@ ---- -title: require-yield -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/require-yield.md -rule_type: suggestion ---- - - +# require-yield Disallows generator functions that do not have `yield`. @@ -51,4 +44,4 @@ If you don't want to notify generator functions that have no `yield` expression, ## Related Rules -* [require-await](require-await) +* [require-await](require-await.md) diff --git a/docs/src/rules/rest-spread-spacing.md b/docs/src/rules/rest-spread-spacing.md index 48c1a7a9923..33a1f51a8e3 100644 --- a/docs/src/rules/rest-spread-spacing.md +++ b/docs/src/rules/rest-spread-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# rest-spread-spacing Enforces spacing between rest and spread operators and their expressions. diff --git a/docs/src/rules/semi-spacing.md b/docs/src/rules/semi-spacing.md index b2d465d4a23..9b8d368740b 100644 --- a/docs/src/rules/semi-spacing.md +++ b/docs/src/rules/semi-spacing.md @@ -1,11 +1,4 @@ ---- -title: semi-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi-spacing.md -rule_type: layout ---- - - +# semi-spacing Enforces spacing before and after semicolons. @@ -111,8 +104,8 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [semi](semi) -* [no-extra-semi](no-extra-semi) -* [comma-spacing](comma-spacing) -* [block-spacing](block-spacing) -* [space-in-parens](space-in-parens) +* [semi](semi.md) +* [no-extra-semi](no-extra-semi.md) +* [comma-spacing](comma-spacing.md) +* [block-spacing](block-spacing.md) +* [space-in-parens](space-in-parens.md) diff --git a/docs/src/rules/semi-style.md b/docs/src/rules/semi-style.md index 1c44bd9ffcb..6f22daaae5b 100644 --- a/docs/src/rules/semi-style.md +++ b/docs/src/rules/semi-style.md @@ -1,11 +1,4 @@ ---- -title: semi-style -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi-style.md -rule_type: layout ---- - - +# semi-style Enforces location of semicolons. @@ -128,6 +121,6 @@ If you don't want to notify the location of semicolons, then it's safe to disabl ## Related Rules -* [no-extra-semi](./no-extra-semi) -* [semi](./semi) -* [semi-spacing](./semi-spacing) +* [no-extra-semi](./no-extra-semi.md) +* [semi](./semi.md) +* [semi-spacing](./semi-spacing.md) diff --git a/docs/src/rules/semi.md b/docs/src/rules/semi.md index 013b9675abe..3f6857cfd3f 100644 --- a/docs/src/rules/semi.md +++ b/docs/src/rules/semi.md @@ -1,11 +1,4 @@ ---- -title: semi -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/semi.md -rule_type: layout ---- - - +# semi Requires or disallows semicolons instead of ASI. @@ -38,7 +31,7 @@ return; } ``` -Effectively, a semicolon is inserted after the `return` statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable) rule will protect your code from such cases. +Effectively, a semicolon is inserted after the `return` statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases. On the other side of the argument are those who say that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code: @@ -53,7 +46,7 @@ var globalCounter = { } })() ``` -In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline) rule can protect your code from such cases. +In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases. Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a `\n` character always ends a statement (just like a semicolon) unless one of the following is true: @@ -221,9 +214,9 @@ If you do not want to enforce semicolon usage (or omission) in any particular wa ## Related Rules -* [no-extra-semi](no-extra-semi) -* [no-unexpected-multiline](no-unexpected-multiline) -* [semi-spacing](semi-spacing) +* [no-extra-semi](no-extra-semi.md) +* [no-unexpected-multiline](no-unexpected-multiline.md) +* [semi-spacing](semi-spacing.md) ## Further Reading diff --git a/docs/src/rules/sort-imports.md b/docs/src/rules/sort-imports.md index 40f7686c885..5ba4509a228 100644 --- a/docs/src/rules/sort-imports.md +++ b/docs/src/rules/sort-imports.md @@ -1,11 +1,4 @@ ---- -title: sort-imports -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-imports.md -rule_type: suggestion ---- - - +# sort-imports Enforces sorted import declarations within modules. @@ -295,5 +288,5 @@ This rule is a formatting preference and not following it won't negatively affec ## Related Rules -* [sort-keys](sort-keys) -* [sort-vars](sort-vars) +* [sort-keys](sort-keys.md) +* [sort-vars](sort-vars.md) diff --git a/docs/src/rules/sort-keys.md b/docs/src/rules/sort-keys.md index f01771336cb..27368412fd9 100644 --- a/docs/src/rules/sort-keys.md +++ b/docs/src/rules/sort-keys.md @@ -1,9 +1,4 @@ ---- -title: sort-keys -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-keys.md -rule_type: suggestion ---- +# sort-keys Requires object keys to be sorted. @@ -227,8 +222,8 @@ If you don't want to notify about properties' order, then it's safe to disable t ## Related Rules -* [sort-imports](sort-imports) -* [sort-vars](sort-vars) +* [sort-imports](sort-imports.md) +* [sort-vars](sort-vars.md) ## Compatibility diff --git a/docs/src/rules/sort-vars.md b/docs/src/rules/sort-vars.md index 2cd8f478d36..63c3df6e526 100644 --- a/docs/src/rules/sort-vars.md +++ b/docs/src/rules/sort-vars.md @@ -1,11 +1,4 @@ ---- -title: sort-vars -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/sort-vars.md -rule_type: suggestion ---- - - +# sort-vars Requires variables within the same declaration block to be sorted. @@ -83,5 +76,5 @@ This rule is a formatting preference and not following it won't negatively affec ## Related Rules -* [sort-keys](sort-keys) -* [sort-imports](sort-imports) +* [sort-keys](sort-keys.md) +* [sort-imports](sort-imports.md) diff --git a/docs/src/rules/space-after-function-name.md b/docs/src/rules/space-after-function-name.md index 390198fdd47..fee100a4b29 100644 --- a/docs/src/rules/space-after-function-name.md +++ b/docs/src/rules/space-after-function-name.md @@ -1,13 +1,8 @@ ---- -title: space-after-function-name -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-after-function-name.md - ---- +# space-after-function-name Enforces consistent spacing after name in function definitions. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren.md) rule. Whitespace between a function name and its parameter list is optional. diff --git a/docs/src/rules/space-after-keywords.md b/docs/src/rules/space-after-keywords.md index 36ff74aa194..7a061d815e3 100644 --- a/docs/src/rules/space-after-keywords.md +++ b/docs/src/rules/space-after-keywords.md @@ -1,13 +1,8 @@ ---- -title: space-after-keywords -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-after-keywords.md - ---- +# space-after-keywords Enforces consistent spacing after keywords. -(removed) This rule was **removed** in ESLint v2.0 and replaced by the [keyword-spacing](keyword-spacing) rule. +(removed) This rule was **removed** in ESLint v2.0 and replaced by the [keyword-spacing](keyword-spacing.md) rule. (fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#--fix) automatically fixed problems reported by this rule. diff --git a/docs/src/rules/space-before-blocks.md b/docs/src/rules/space-before-blocks.md index 755d057623b..1271a4e1b3f 100644 --- a/docs/src/rules/space-before-blocks.md +++ b/docs/src/rules/space-before-blocks.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# space-before-blocks Requires Or disallows space before blocks. @@ -221,8 +214,8 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [keyword-spacing](keyword-spacing) -* [arrow-spacing](arrow-spacing) -* [switch-colon-spacing](switch-colon-spacing) -* [block-spacing](block-spacing) -* [brace-style](brace-style) +* [keyword-spacing](keyword-spacing.md) +* [arrow-spacing](arrow-spacing.md) +* [switch-colon-spacing](switch-colon-spacing.md) +* [block-spacing](block-spacing.md) +* [brace-style](brace-style.md) diff --git a/docs/src/rules/space-before-function-paren.md b/docs/src/rules/space-before-function-paren.md index b16fc954887..547e26c0c06 100644 --- a/docs/src/rules/space-before-function-paren.md +++ b/docs/src/rules/space-before-function-paren.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# space-before-function-paren Requires or disallows a space before function parenthesis. @@ -373,5 +366,5 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [space-after-keywords](space-after-keywords) -* [space-return-throw-case](space-return-throw-case) +* [space-after-keywords](space-after-keywords.md) +* [space-return-throw-case](space-return-throw-case.md) diff --git a/docs/src/rules/space-before-function-parentheses.md b/docs/src/rules/space-before-function-parentheses.md index 376bd1cfeed..a5d869866ba 100644 --- a/docs/src/rules/space-before-function-parentheses.md +++ b/docs/src/rules/space-before-function-parentheses.md @@ -1,13 +1,8 @@ ---- -title: space-before-function-parentheses -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-function-parentheses.md - ---- +# space-before-function-parentheses Enforces consistent spacing before opening parenthesis in function definitions. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren) rule. The name of the rule changed from "parentheses" to "paren" for consistency with the names of other rules. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren.md) rule. The name of the rule changed from "parentheses" to "paren" for consistency with the names of other rules. When formatting a function, whitespace is allowed between the function name or `function` keyword and the opening paren. Named functions also require a space between the `function` keyword and the function name, but anonymous functions require no whitespace. For example: @@ -263,5 +258,5 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [space-after-keywords](space-after-keywords) -* [space-return-throw-case](space-return-throw-case) +* [space-after-keywords](space-after-keywords.md) +* [space-return-throw-case](space-return-throw-case.md) diff --git a/docs/src/rules/space-before-keywords.md b/docs/src/rules/space-before-keywords.md index 1d9384e03f8..2c77bc1d8af 100644 --- a/docs/src/rules/space-before-keywords.md +++ b/docs/src/rules/space-before-keywords.md @@ -1,13 +1,8 @@ ---- -title: space-before-keywords -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-before-keywords.md - ---- +# space-before-keywords Enforces consistent spacing before keywords. -(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing) rule. +(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing.md) rule. (fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#--fix) automatically fixed problems reported by this rule. @@ -35,7 +30,7 @@ must be preceded by at least one space. If `"never"` then no spaces will be allo the keywords `else`, `while` (do...while), `finally` and `catch`. The default value is `"always"`. This rule will allow keywords to be preceded by an opening curly brace (`{`). If you wish to alter -this behavior, consider using the [block-spacing](block-spacing) rule. +this behavior, consider using the [block-spacing](block-spacing.md) rule. Examples of **incorrect** code for this rule with the default `"always"` option: @@ -114,8 +109,8 @@ 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) +* [space-after-keywords](space-after-keywords.md) +* [block-spacing](block-spacing.md) +* [space-return-throw-case](space-return-throw-case.md) +* [space-unary-ops](space-unary-ops.md) +* [space-infix-ops](space-infix-ops.md) diff --git a/docs/src/rules/space-in-brackets.md b/docs/src/rules/space-in-brackets.md index d7de26eba12..363bd3053d2 100644 --- a/docs/src/rules/space-in-brackets.md +++ b/docs/src/rules/space-in-brackets.md @@ -1,13 +1,8 @@ ---- -title: space-in-brackets -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-in-brackets.md - ---- +# space-in-brackets Enforces consistent spacing inside braces of object literals and brackets of array literals. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [object-curly-spacing](object-curly-spacing) and [array-bracket-spacing](array-bracket-spacing) rules. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [object-curly-spacing](object-curly-spacing.md) and [array-bracket-spacing](array-bracket-spacing.md) rules. While formatting preferences are very personal, a number of style guides require or disallow spaces between brackets: @@ -308,7 +303,7 @@ You can turn this rule off if you are not concerned with the consistency of spac ## 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) +* [array-bracket-spacing](array-bracket-spacing.md) +* [object-curly-spacing](object-curly-spacing.md) +* [space-in-parens](space-in-parens.md) +* [computed-property-spacing](computed-property-spacing.md) diff --git a/docs/src/rules/space-in-parens.md b/docs/src/rules/space-in-parens.md index 7d6f4bc3ad7..f9be1bc1d0d 100644 --- a/docs/src/rules/space-in-parens.md +++ b/docs/src/rules/space-in-parens.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# space-in-parens Disallows or enforce spaces inside of parentheses. @@ -296,6 +289,6 @@ You can turn this rule off if you are not concerned with the consistency of spac ## Related Rules -* [array-bracket-spacing](array-bracket-spacing) -* [object-curly-spacing](object-curly-spacing) -* [computed-property-spacing](computed-property-spacing) +* [array-bracket-spacing](array-bracket-spacing.md) +* [object-curly-spacing](object-curly-spacing.md) +* [computed-property-spacing](computed-property-spacing.md) diff --git a/docs/src/rules/space-infix-ops.md b/docs/src/rules/space-infix-ops.md index aa079b51114..9453b7990c5 100644 --- a/docs/src/rules/space-infix-ops.md +++ b/docs/src/rules/space-infix-ops.md @@ -1,11 +1,4 @@ ---- -title: space-infix-ops -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-infix-ops.md -rule_type: layout ---- - - +# space-infix-ops Requires spacing around infix operators. diff --git a/docs/src/rules/space-return-throw-case.md b/docs/src/rules/space-return-throw-case.md index 6bf9ba199b2..9df4f681ee3 100644 --- a/docs/src/rules/space-return-throw-case.md +++ b/docs/src/rules/space-return-throw-case.md @@ -1,13 +1,8 @@ ---- -title: space-return-throw-case -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-return-throw-case.md - ---- +# space-return-throw-case Requires spaces after `return`, `throw`, and `case` keywords. -(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing) rule. +(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing.md) rule. (fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#--fix) automatically fixed problems reported by this rule. diff --git a/docs/src/rules/space-unary-ops.md b/docs/src/rules/space-unary-ops.md index d413ff68651..39eb9cbf050 100644 --- a/docs/src/rules/space-unary-ops.md +++ b/docs/src/rules/space-unary-ops.md @@ -1,11 +1,4 @@ ---- -title: space-unary-ops -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-unary-ops.md -rule_type: layout ---- - - +# space-unary-ops Requires or disallow spaces before/after unary operators. diff --git a/docs/src/rules/space-unary-word-ops.md b/docs/src/rules/space-unary-word-ops.md index eb5d3d95e0c..4d4fb85cd5f 100644 --- a/docs/src/rules/space-unary-word-ops.md +++ b/docs/src/rules/space-unary-word-ops.md @@ -1,13 +1,8 @@ ---- -title: space-unary-word-ops -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/space-unary-word-ops.md - ---- +# space-unary-word-ops Requires spaces after unary word operators. -(removed) This rule was **removed** in ESLint v0.10.0 and **replaced** by the [space-unary-ops](space-unary-ops) rule. +(removed) This rule was **removed** in ESLint v0.10.0 and **replaced** by the [space-unary-ops](space-unary-ops.md) rule. Require spaces following unary word operators. diff --git a/docs/src/rules/spaced-comment.md b/docs/src/rules/spaced-comment.md index c990773744b..965a274e276 100644 --- a/docs/src/rules/spaced-comment.md +++ b/docs/src/rules/spaced-comment.md @@ -1,11 +1,4 @@ ---- -title: spaced-comment -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/spaced-comment.md -rule_type: suggestion ---- - - +# spaced-comment Enforces consistent spacing after the `//` or `/*` in a comment. @@ -292,4 +285,4 @@ subsequent lines are ignored ## Related Rules -* [spaced-line-comment](spaced-line-comment) +* [spaced-line-comment](spaced-line-comment.md) diff --git a/docs/src/rules/spaced-line-comment.md b/docs/src/rules/spaced-line-comment.md index e032d05df96..b33124bf341 100644 --- a/docs/src/rules/spaced-line-comment.md +++ b/docs/src/rules/spaced-line-comment.md @@ -1,13 +1,8 @@ ---- -title: spaced-line-comment -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/spaced-line-comment.md - ---- +# spaced-line-comment Enforces consistent spacing after `//` in line comments. -(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [spaced-comment](spaced-comment) rule. +(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [spaced-comment](spaced-comment.md) rule. Some style guides require or disallow a whitespace immediately after the initial `//` of a line comment. Whitespace after the `//` makes it easier to read text in comments. @@ -76,4 +71,4 @@ var foo = 5; ## Related Rules -* [spaced-comment](spaced-comment) +* [spaced-comment](spaced-comment.md) diff --git a/docs/src/rules/strict.md b/docs/src/rules/strict.md index df14488edca..077ca95a87e 100644 --- a/docs/src/rules/strict.md +++ b/docs/src/rules/strict.md @@ -1,11 +1,4 @@ ---- -title: strict -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/strict.md -rule_type: suggestion ---- - - +# strict Requires or disallow strict mode directives. @@ -51,14 +44,14 @@ In **ECMAScript** modules, which always have strict mode semantics, the directiv This rule requires or disallows strict mode directives. -This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](/docs/user-guide/configuring/language-options#specifying-parser-options): +This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](/docs/user-guide/configuring/language-options.md#specifying-parser-options): * `"sourceType": "module"` that is, files are **ECMAScript** modules * `"impliedStrict": true` property in the `ecmaFeatures` object This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in **ECMAScript 2016** and later. See the examples of the [function](#function) option. -This rule does not apply to class static blocks, no matter which option is specified, because class static blocks do not have directives. Therefore, a `"use strict"` statement in a class static block is not a directive, and will be reported by the [no-unused-expressions](no-unused-expressions) rule. +This rule does not apply to class static blocks, no matter which option is specified, because class static blocks do not have directives. Therefore, a `"use strict"` statement in a class static block is not a directive, and will be reported by the [no-unused-expressions](no-unused-expressions.md) rule. The `--fix` option on the command line does not insert new `"use strict"` statements, but only removes unneeded statements. @@ -77,8 +70,8 @@ This rule has a string option: The `"safe"` option corresponds to the `"global"` option if ESLint considers a file to be a **Node.js** or **CommonJS** module because the configuration specifies either of the following: -* `node` or `commonjs` [environments](/docs/user-guide/configuring/language-options#specifying-environments) -* `"globalReturn": true` property in the `ecmaFeatures` object of [parser options](/docs/user-guide/configuring/language-options#specifying-parser-options) +* `node` or `commonjs` [environments](/docs/user-guide/configuring/language-options.md#specifying-environments) +* `"globalReturn": true` property in the `ecmaFeatures` object of [parser options](/docs/user-guide/configuring/language-options.md#specifying-parser-options) Otherwise the `"safe"` option corresponds to the `"function"` option. Note that if `"globalReturn": false` is explicitly specified in the configuration, the `"safe"` option will correspond to the `"function"` option regardless of the specified environment. @@ -280,4 +273,4 @@ function foo() { ## When Not To Use It -In a codebase that has both strict and non-strict code, either turn this rule off, or [selectively disable it](/docs/user-guide/configuring/rules#disabling-rules) where necessary. For example, functions referencing `arguments.callee` are invalid in strict mode. A [full list of strict mode differences](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode#Differences_from_non-strict_to_strict) is available on MDN. +In a codebase that has both strict and non-strict code, either turn this rule off, or [selectively disable it](/docs/user-guide/configuring/rules.md#disabling-rules) where necessary. For example, functions referencing `arguments.callee` are invalid in strict mode. A [full list of strict mode differences](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode#Differences_from_non-strict_to_strict) is available on MDN. diff --git a/docs/src/rules/switch-colon-spacing.md b/docs/src/rules/switch-colon-spacing.md index 1106bdb8026..5380ea59ca1 100644 --- a/docs/src/rules/switch-colon-spacing.md +++ b/docs/src/rules/switch-colon-spacing.md @@ -1,11 +1,4 @@ ---- -title: switch-colon-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/switch-colon-spacing.md -rule_type: layout ---- - - +# switch-colon-spacing Enforces spacing around colons of switch statements. diff --git a/docs/src/rules/symbol-description.md b/docs/src/rules/symbol-description.md index 88eabce8f15..625d5ab5377 100644 --- a/docs/src/rules/symbol-description.md +++ b/docs/src/rules/symbol-description.md @@ -1,9 +1,4 @@ ---- -title: symbol-description -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/symbol-description.md -rule_type: suggestion ---- +# symbol-description Requires symbol descriptions. diff --git a/docs/src/rules/template-curly-spacing.md b/docs/src/rules/template-curly-spacing.md index eff2aa98146..65f89f4ff9d 100644 --- a/docs/src/rules/template-curly-spacing.md +++ b/docs/src/rules/template-curly-spacing.md @@ -1,11 +1,4 @@ ---- -title: template-curly-spacing -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/template-curly-spacing.md -rule_type: layout ---- - - +# template-curly-spacing Enforces usage of spacing in template strings. diff --git a/docs/src/rules/template-tag-spacing.md b/docs/src/rules/template-tag-spacing.md index e6d6f189605..6bbf3e783d4 100644 --- a/docs/src/rules/template-tag-spacing.md +++ b/docs/src/rules/template-tag-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# template-tag-spacing Requires or disallow spacing between template tags and their literals. diff --git a/docs/src/rules/unicode-bom.md b/docs/src/rules/unicode-bom.md index 878dfacca4f..160440e5237 100644 --- a/docs/src/rules/unicode-bom.md +++ b/docs/src/rules/unicode-bom.md @@ -1,11 +1,4 @@ ---- -title: unicode-bom -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/unicode-bom.md -rule_type: layout ---- - - +# unicode-bom Requires or disallows the Unicode Byte Order Mark (BOM). diff --git a/docs/src/rules/use-isnan.md b/docs/src/rules/use-isnan.md index 60a4f055173..1560ee254ea 100644 --- a/docs/src/rules/use-isnan.md +++ b/docs/src/rules/use-isnan.md @@ -1,11 +1,4 @@ ---- -title: use-isnan -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/use-isnan.md -rule_type: problem ---- - - +# use-isnan Requires calls to `isNaN()` when checking for `NaN`. diff --git a/docs/src/rules/valid-jsdoc.md b/docs/src/rules/valid-jsdoc.md index 84eb32b0e4e..a57a3f65ff1 100644 --- a/docs/src/rules/valid-jsdoc.md +++ b/docs/src/rules/valid-jsdoc.md @@ -1,11 +1,4 @@ ---- -title: valid-jsdoc -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/valid-jsdoc.md -rule_type: suggestion ---- - - +# valid-jsdoc Enforces valid JSDoc comments. @@ -395,7 +388,7 @@ If you aren't using JSDoc, then you can safely turn this rule off. ## Related Rules -* [require-jsdoc](require-jsdoc) +* [require-jsdoc](require-jsdoc.md) ## Further Reading diff --git a/docs/src/rules/valid-typeof.md b/docs/src/rules/valid-typeof.md index a37def6f496..fcf60a97538 100644 --- a/docs/src/rules/valid-typeof.md +++ b/docs/src/rules/valid-typeof.md @@ -1,13 +1,4 @@ ---- -title: valid-typeof -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/valid-typeof.md -rule_type: problem ---- - - - - +# valid-typeof Enforces comparing `typeof` expressions against valid strings. diff --git a/docs/src/rules/vars-on-top.md b/docs/src/rules/vars-on-top.md index 858689e658b..216a16d9d7f 100644 --- a/docs/src/rules/vars-on-top.md +++ b/docs/src/rules/vars-on-top.md @@ -1,9 +1,4 @@ ---- -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 ---- +# vars-on-top Requires variable declarations to be at the top of their scope. diff --git a/docs/src/rules/wrap-iife.md b/docs/src/rules/wrap-iife.md index 0b9cd2d9748..4e5e252b04d 100644 --- a/docs/src/rules/wrap-iife.md +++ b/docs/src/rules/wrap-iife.md @@ -1,11 +1,4 @@ ---- -title: wrap-iife -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/wrap-iife.md -rule_type: layout ---- - - +# wrap-iife Requires IIFEs to be wrapped. diff --git a/docs/src/rules/wrap-regex.md b/docs/src/rules/wrap-regex.md index 9249d703ea2..e8b5e24b8f3 100644 --- a/docs/src/rules/wrap-regex.md +++ b/docs/src/rules/wrap-regex.md @@ -1,11 +1,4 @@ ---- -title: wrap-regex -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/wrap-regex.md -rule_type: layout ---- - - +# wrap-regex Requires regex literals to be wrapped. diff --git a/docs/src/rules/yield-star-spacing.md b/docs/src/rules/yield-star-spacing.md index dabe6b2a938..cc82ee3e63d 100644 --- a/docs/src/rules/yield-star-spacing.md +++ b/docs/src/rules/yield-star-spacing.md @@ -1,11 +1,4 @@ ---- -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 ---- - - +# yield-star-spacing Enforces spacing around the `*` in `yield*` expressions. diff --git a/docs/src/rules/yoda.md b/docs/src/rules/yoda.md index 65efff7ece1..2a22f11d0a2 100644 --- a/docs/src/rules/yoda.md +++ b/docs/src/rules/yoda.md @@ -1,11 +1,4 @@ ---- -title: yoda -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/rules/yoda.md -rule_type: suggestion ---- - - +# yoda Requires or disallows "Yoda" conditions. diff --git a/docs/src/user-guide/README.md b/docs/src/user-guide/README.md index fd935711dd4..63b7533f732 100644 --- a/docs/src/user-guide/README.md +++ b/docs/src/user-guide/README.md @@ -1,13 +1,8 @@ ---- -title: User Guide -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/README.md - ---- +# User Guide This guide is intended for those who wish to use ESLint as an end-user. If you're looking for how to extend ESLint or work with the ESLint source code, please see the [Developer Guide](../developer-guide). -## [Getting Started](getting-started) +## [Getting Started](getting-started.md) Want to skip ahead and just start using ESLint? This section gives a high-level overview of installation, setup, and configuration options. @@ -19,15 +14,15 @@ ESLint has a lot of rules that you can configure to fine-tune it to your project Once you've got ESLint running, you'll probably want to adjust the configuration to better suit your project. This section explains all the different ways you can configure ESLint. -## [Command Line Interface](command-line-interface) +## [Command Line Interface](command-line-interface.md) There are a lot of command line flags for ESLint and this section explains what they do. -## [Integrations](integrations) +## [Integrations](integrations.md) Wondering if ESLint will work with your favorite editor or build system? This section has a list of all known integrations (submitted by their authors). -## [Rule Deprecation](rule-deprecation) +## [Rule Deprecation](rule-deprecation.md) The ESLint team is committed to making upgrading as easy and painless as possible. This section outlines the guidelines the team has set in place for the deprecation of rules in future releases. @@ -35,10 +30,10 @@ The ESLint team is committed to making upgrading as easy and painless as possibl If you were using a prior version of ESLint, you can get help with the transition by reading: -* [migrating-to-1.0.0](migrating-to-1.0.0) -* [migrating-to-2.0.0](migrating-to-2.0.0) -* [migrating-to-3.0.0](migrating-to-3.0.0) -* [migrating-to-4.0.0](migrating-to-4.0.0) -* [migrating-to-5.0.0](migrating-to-5.0.0) -* [migrating-to-6.0.0](migrating-to-6.0.0) -* [migrating-to-7.0.0](migrating-to-7.0.0) +* [migrating-to-1.0.0](migrating-to-1.0.0.md) +* [migrating-to-2.0.0](migrating-to-2.0.0.md) +* [migrating-to-3.0.0](migrating-to-3.0.0.md) +* [migrating-to-4.0.0](migrating-to-4.0.0.md) +* [migrating-to-5.0.0](migrating-to-5.0.0.md) +* [migrating-to-6.0.0](migrating-to-6.0.0.md) +* [migrating-to-7.0.0](migrating-to-7.0.0.md) diff --git a/docs/src/user-guide/command-line-interface.md b/docs/src/user-guide/command-line-interface.md index e7c7b32f5ab..26600ef96b1 100644 --- a/docs/src/user-guide/command-line-interface.md +++ b/docs/src/user-guide/command-line-interface.md @@ -1,9 +1,4 @@ ---- -title: Command Line Interface -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/command-line-interface.md - ---- +# Command Line Interface ESLint requires Node.js for installation. Follow the instructions in the [Getting Started Guide](https://eslint.org/docs/user-guide/getting-started) to install ESLint. @@ -129,7 +124,7 @@ If `.eslintrc.*` and/or `package.json` files are also used for configuration (i. #### `--env` -This option enables specific environments. Details about the global variables defined by each environment are available on the [Specifying Environments](configuring/language-options#specifying-environments) documentation. This option only enables environments; it does not disable environments set in other configuration files. To specify multiple environments, separate them using commas, or use the option multiple times. +This option enables specific environments. Details about the global variables defined by each environment are available on the [Specifying Environments](configuring/language-options.md#specifying-environments) documentation. This option only enables environments; it does not disable environments set in other configuration files. To specify multiple environments, separate them using commas, or use the option multiple times. Examples: @@ -289,7 +284,7 @@ Example: #### `--ignore-pattern` -This option allows you to specify patterns of files to ignore (in addition to those in `.eslintignore`). You can repeat the option to provide multiple patterns. The supported syntax is the same as for `.eslintignore` [files](configuring/ignoring-code#the-eslintignore-file), which use the same patterns as the `.gitignore` [specification](https://git-scm.com/docs/gitignore). You should quote your patterns in order to avoid shell interpretation of glob patterns. +This option allows you to specify patterns of files to ignore (in addition to those in `.eslintignore`). You can repeat the option to provide multiple patterns. The supported syntax is the same as for `.eslintignore` [files](configuring/ignoring-code.md#the-eslintignore-file), which use the same patterns as the `.gitignore` [specification](https://git-scm.com/docs/gitignore). You should quote your patterns in order to avoid shell interpretation of glob patterns. Example: @@ -349,16 +344,16 @@ When specified, the given format is output into the provided file name. This option specifies the output format for the console. Possible formats are: -* [checkstyle](formatters/#checkstyle) -* [compact](formatters/#compact) -* [html](formatters/#html) -* [jslint-xml](formatters/#jslint-xml) -* [json](formatters/#json) -* [junit](formatters/#junit) -* [stylish](formatters/#stylish) (the default) -* [tap](formatters/#tap) -* [unix](formatters/#unix) -* [visualstudio](formatters/#visualstudio) +* [checkstyle](formatters.md/#checkstyle) +* [compact](formatters.md/#compact) +* [html](formatters.md/#html) +* [jslint-xml](formatters.md/#jslint-xml) +* [json](formatters.md/#json) +* [junit](formatters.md/#junit) +* [stylish](formatters.md/#stylish) (the default) +* [tap](formatters.md/#tap) +* [unix](formatters.md/#unix) +* [visualstudio](formatters.md/#visualstudio) Example: @@ -510,7 +505,7 @@ ESLint supports `.eslintignore` files to exclude files from the linting process temp.js **/vendor/*.js -A more detailed breakdown of supported patterns and directories ESLint ignores by default can be found in [Ignoring Code](configuring/ignoring-code). +A more detailed breakdown of supported patterns and directories ESLint ignores by default can be found in [Ignoring Code](configuring/ignoring-code.md). ## Exit codes diff --git a/docs/src/user-guide/configuring/README.md b/docs/src/user-guide/configuring/README.md index 0b491c4c99f..2d22421e0c3 100644 --- a/docs/src/user-guide/configuring/README.md +++ b/docs/src/user-guide/configuring/README.md @@ -1,56 +1,52 @@ ---- -title: Configuring ESLint -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/README.md ---- +# Configuring ESLint ESLint is designed to be flexible and configurable for your use case. You can turn off every rule and run only with basic syntax validation or mix and match the bundled rules and your custom rules to fit the needs of your project. There are two primary ways to configure ESLint: 1. **Configuration Comments** - use JavaScript comments to embed configuration information directly into a file. -1. **Configuration Files** - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories. This can be in the form of an [`.eslintrc.*`](./configuration-files#configuration-file-formats) file or an `eslintConfig` field in a [`package.json`](https://docs.npmjs.com/files/package.json) file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the [command line](https://eslint.org/docs/user-guide/command-line-interface). +1. **Configuration Files** - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories. This can be in the form of an [`.eslintrc.*`](./configuration-files.md#configuration-file-formats) file or an `eslintConfig` field in a [`package.json`](https://docs.npmjs.com/files/package.json) file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the [command line](https://eslint.org/docs/user-guide/command-line-interface). Here are some of the options that you can configure in ESLint: -* [**Environments**](./language-options#specifying-environments) - which environments your script is designed to run in. Each environment brings with it a certain set of predefined global variables. -* [**Globals**](./language-options#specifying-globals) - the additional global variables your script accesses during execution. -* [**Rules**](rules) - which rules are enabled and at what error level. -* [**Plugins**](plugins) - which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. +* [**Environments**](./language-options.md#specifying-environments) - which environments your script is designed to run in. Each environment brings with it a certain set of predefined global variables. +* [**Globals**](./language-options.md#specifying-globals) - the additional global variables your script accesses during execution. +* [**Rules**](rules.md) - which rules are enabled and at what error level. +* [**Plugins**](plugins.md) - which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. All of these options give you fine-grained control over how ESLint treats your code. ## Table of Contents -[**Configuration Files**](configuration-files) +[**Configuration Files**](configuration-files.md) -* [Configuration File Formats](./configuration-files#configuration-file-formats) -* [Using Configuration Files](./configuration-files#using-configuration-files) -* [Adding Shared Settings](./configuration-files#adding-shared-settings) -* [Cascading and Hierarchy](./configuration-files#cascading-and-hierarchy) -* [Extending Configuration Files](./configuration-files#extending-configuration-files) -* [Configuration Based on Glob Patterns](./configuration-files#configuration-based-on-glob-patterns) -* [Personal Configuration Files](./configuration-files#personal-configuration-files-deprecated) +* [Configuration File Formats](./configuration-files.md#configuration-file-formats) +* [Using Configuration Files](./configuration-files.md#using-configuration-files) +* [Adding Shared Settings](./configuration-files.md#adding-shared-settings) +* [Cascading and Hierarchy](./configuration-files.md#cascading-and-hierarchy) +* [Extending Configuration Files](./configuration-files.md#extending-configuration-files) +* [Configuration Based on Glob Patterns](./configuration-files.md#configuration-based-on-glob-patterns) +* [Personal Configuration Files](./configuration-files.md#personal-configuration-files-deprecated) -[**Language Options**](language-options) +[**Language Options**](language-options.md) -* [Specifying Environments](./language-options#specifying-environments) -* [Specifying Globals](./language-options#specifying-globals) -* [Specifying Parser Options](./language-options#specifying-parser-options) +* [Specifying Environments](./language-options.md#specifying-environments) +* [Specifying Globals](./language-options.md#specifying-globals) +* [Specifying Parser Options](./language-options.md#specifying-parser-options) -[**Rules**](rules) +[**Rules**](rules.md) -* [Configuring Rules](./rules#configuring-rules) -* [Disabling Rules](./rules#disabling-rules) +* [Configuring Rules](./rules.md#configuring-rules) +* [Disabling Rules](./rules.md#disabling-rules) -[**Plugins**](plugins) +[**Plugins**](plugins.md) -* [Specifying Parser](./plugins#specifying-parser) -* [Specifying Processor](./plugins#specifying-processor) -* [Configuring Plugins](./plugins#configuring-plugins) +* [Specifying Parser](./plugins.md#specifying-parser) +* [Specifying Processor](./plugins.md#specifying-processor) +* [Configuring Plugins](./plugins.md#configuring-plugins) -[**Ignoring Code**](ignoring-code) +[**Ignoring Code**](ignoring-code.md) -* [`ignorePatterns` in Config Files](./ignoring-code#ignorepatterns-in-config-files) -* [The `.eslintignore` File](./ignoring-code#the-eslintignore-file) -* [Using an Alternate File](./ignoring-code#using-an-alternate-file) -* [Using eslintIgnore in package.json](./ignoring-code#using-eslintignore-in-packagejson) -* [Ignored File Warnings](./ignoring-code#ignored-file-warnings) +* [`ignorePatterns` in Config Files](./ignoring-code.md#ignorepatterns-in-config-files) +* [The `.eslintignore` File](./ignoring-code.md#the-eslintignore-file) +* [Using an Alternate File](./ignoring-code.md#using-an-alternate-file) +* [Using eslintIgnore in package.json](./ignoring-code.md#using-eslintignore-in-packagejson) +* [Ignored File Warnings](./ignoring-code.md#ignored-file-warnings) diff --git a/docs/src/user-guide/configuring/configuration-files.md b/docs/src/user-guide/configuring/configuration-files.md index a21291a477d..d3368e767ac 100644 --- a/docs/src/user-guide/configuring/configuration-files.md +++ b/docs/src/user-guide/configuring/configuration-files.md @@ -1,9 +1,4 @@ ---- -title: Configuration Files -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/configuration-files.md - ---- +# Configuration Files * [Configuration File Formats](#configuration-file-formats) * [Using Configuration Files](#using-configuration-files) @@ -282,7 +277,7 @@ module.exports = { A [plugin](https://eslint.org/docs/developer-guide/working-with-plugins) is an npm package that can add various extensions to ESLint. A plugin can perform numerous functions, including but not limited to adding new rules and exporting [shareable configurations](https://eslint.org/docs/developer-guide/working-with-plugins#configs-in-plugins). Make sure the package has been installed in a directory where ESLint can require it. -The `plugins` [property value](./plugins#configuring-plugins) can omit the `eslint-plugin-` prefix of the package name. +The `plugins` [property value](./plugins.md#configuring-plugins) can omit the `eslint-plugin-` prefix of the package name. The `extends` property value can consist of: diff --git a/docs/src/user-guide/configuring/ignoring-code.md b/docs/src/user-guide/configuring/ignoring-code.md index 8aab1336b08..35c2d25dd3f 100644 --- a/docs/src/user-guide/configuring/ignoring-code.md +++ b/docs/src/user-guide/configuring/ignoring-code.md @@ -1,9 +1,4 @@ ---- -title: Ignoring Code -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/ignoring-code.md - ---- +# Ignoring Code * [`ignorePatterns` in Config Files](#ignorepatterns-in-config-files) * [The `.eslintignore` File](#the-eslintignore-file) @@ -13,7 +8,7 @@ edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/config ## `ignorePatterns` in Config Files -You can tell ESLint to ignore specific files and directories using `ignorePatterns` in your config files. `ignorePatterns` patterns follow the same rules as `.eslintignore`. Please see the [the `.eslintignore` file documentation](./ignoring-code#the-eslintignore-file) to learn more. +You can tell ESLint to ignore specific files and directories using `ignorePatterns` in your config files. `ignorePatterns` patterns follow the same rules as `.eslintignore`. Please see the [the `.eslintignore` file documentation](./ignoring-code.md#the-eslintignore-file) to learn more. ```json { diff --git a/docs/src/user-guide/configuring/language-options.md b/docs/src/user-guide/configuring/language-options.md index 5523fbab559..6ba406b827e 100644 --- a/docs/src/user-guide/configuring/language-options.md +++ b/docs/src/user-guide/configuring/language-options.md @@ -1,9 +1,4 @@ ---- -title: Language Options -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/language-options.md - ---- +# Language Options * [Specifying Environments](#specifying-environments) * [Specifying Globals](#specifying-globals) diff --git a/docs/src/user-guide/configuring/plugins.md b/docs/src/user-guide/configuring/plugins.md index f56da1e2f80..9d2c9294c4c 100644 --- a/docs/src/user-guide/configuring/plugins.md +++ b/docs/src/user-guide/configuring/plugins.md @@ -1,9 +1,4 @@ ---- -title: Plugins -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/plugins.md - ---- +# Plugins * [Specifying Parser](#specifying-parser) * [Specifying Processor](#specifying-processor) diff --git a/docs/src/user-guide/configuring/rules.md b/docs/src/user-guide/configuring/rules.md index 36540ea3a9e..205a5f11995 100644 --- a/docs/src/user-guide/configuring/rules.md +++ b/docs/src/user-guide/configuring/rules.md @@ -1,9 +1,4 @@ ---- -title: Rules -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/configuring/rules.md - ---- +# Rules * [Configuring Rules](#configuring-rules) * [Disabling Rules](#disabling-rules) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 3e9fcd2b5e0..ef80229766c 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -1,9 +1,4 @@ ---- -title: Getting Started with ESLint -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/getting-started.md - ---- +# Getting Started with ESLint ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs. In many ways, it is similar to JSLint and JSHint with a few exceptions: @@ -51,7 +46,7 @@ It is also possible to install ESLint globally rather than locally (using `npm i ## Configuration -**Note:** If you are coming from a version before 1.0.0 please see the [migration guide](migrating-to-1.0.0). +**Note:** If you are coming from a version before 1.0.0 please see the [migration guide](migrating-to-1.0.0.md). After running `npm init @eslint/config`, you'll have a `.eslintrc.{js,yml,json}` file in your directory. In it, you'll see some rules configured like this: @@ -87,7 +82,7 @@ Because of this line, all of the rules marked "(recommended)" on the [rules page ## Next Steps * Learn about [advanced configuration](configuring/) of ESLint. -* Get familiar with the [command line options](command-line-interface). -* Explore [ESLint integrations](integrations) into other tools like editors, build systems, and more. -* Can't find just the right rule? Make your own [custom rule](/docs/developer-guide/working-with-rules). +* Get familiar with the [command line options](command-line-interface.md). +* Explore [ESLint integrations](integrations.md) into other tools like editors, build systems, and more. +* Can't find just the right rule? Make your own [custom rule](/docs/developer-guide/working-with-rules.md). * Make ESLint even better by [contributing](/docs/developer-guide/contributing/). diff --git a/docs/src/user-guide/integrations.md b/docs/src/user-guide/integrations.md index 6f5c809c9a8..08181931e4a 100644 --- a/docs/src/user-guide/integrations.md +++ b/docs/src/user-guide/integrations.md @@ -1,9 +1,4 @@ ---- -title: Integrations -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/integrations.md - ---- +# Integrations ## Editors diff --git a/docs/src/user-guide/migrating-from-jscs.md b/docs/src/user-guide/migrating-from-jscs.md index c25af456656..66e4fe7a206 100644 --- a/docs/src/user-guide/migrating-from-jscs.md +++ b/docs/src/user-guide/migrating-from-jscs.md @@ -1,9 +1,4 @@ ---- -title: Migrating from JSCS -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-from-jscs.md - ---- +# Migrating from JSCS In April 2016, we [announced](https://eslint.org/blog/2016/04/welcoming-jscs-to-eslint) that the JSCS project was shutting down and the JSCS team would be joining the ESLint team. This guide is intended to help those who are using JSCS to migrate their settings and projects to use ESLint. We've tried to automate as much of the conversion as possible, but there are some manual changes that are needed. diff --git a/docs/src/user-guide/migrating-to-1.0.0.md b/docs/src/user-guide/migrating-to-1.0.0.md index f71b428ed7d..637e3059e6a 100644 --- a/docs/src/user-guide/migrating-to-1.0.0.md +++ b/docs/src/user-guide/migrating-to-1.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v1.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-1.0.0.md - ---- +# Migrating to v1.0.0 ESLint v1.0.0 is the first major version release. As a result, there are some significant changes between how ESLint worked during its life in 0.x and how it will work going forward. These changes are the direct result of feedback from the ESLint community of users and were not made without due consideration for the upgrade path. We believe that these changes make ESLint even better, and while some work is necessary to upgrade, we hope the pain of this upgrade is small enough that you will see the benefit of upgrading. diff --git a/docs/src/user-guide/migrating-to-2.0.0.md b/docs/src/user-guide/migrating-to-2.0.0.md index aa216aa3f49..4ca97cbe8a8 100644 --- a/docs/src/user-guide/migrating-to-2.0.0.md +++ b/docs/src/user-guide/migrating-to-2.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v2.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-2.0.0.md - ---- +# Migrating to v2.0.0 ESLint v2.0.0 is the second major version release. As a result, there are some significant changes between how ESLint worked during its life in 0.x and 1.x and how it will work going forward. These changes are the direct result of feedback from the ESLint community of users and were not made without due consideration for the upgrade path. We believe that these changes make ESLint even better, and while some work is necessary to upgrade, we hope the pain of this upgrade is small enough that you will see the benefit of upgrading. @@ -352,7 +347,7 @@ var sourceCode = new SourceCode(text, ast); ## Rule Changes -* [`strict`](../rules/strict) - defaults to `"safe"` (previous default was `"function"`) +* [`strict`](../rules/strict.md) - defaults to `"safe"` (previous default was `"function"`) ## Plugins No Longer Have Default Configurations diff --git a/docs/src/user-guide/migrating-to-3.0.0.md b/docs/src/user-guide/migrating-to-3.0.0.md index 8435e28ebb3..af19c769a56 100644 --- a/docs/src/user-guide/migrating-to-3.0.0.md +++ b/docs/src/user-guide/migrating-to-3.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v3.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-3.0.0.md - ---- +# Migrating to v3.0.0 ESLint v3.0.0 is the third major version release. We have made several breaking changes in this release, however, we believe the changes to be small enough that they should not require significant changes for ESLint users. This guide is intended to walk you through the changes. diff --git a/docs/src/user-guide/migrating-to-4.0.0.md b/docs/src/user-guide/migrating-to-4.0.0.md index cef90a3ddcc..8f78291d5cd 100644 --- a/docs/src/user-guide/migrating-to-4.0.0.md +++ b/docs/src/user-guide/migrating-to-4.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v4.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-4.0.0.md - ---- +# Migrating to v4.0.0 ESLint v4.0.0 is the fourth major version release. We have made several breaking changes in this release; however, we expect that most of the changes will only affect a very small percentage of users. This guide is intended to walk you through the changes. diff --git a/docs/src/user-guide/migrating-to-5.0.0.md b/docs/src/user-guide/migrating-to-5.0.0.md index 0bddbe1dcb1..01bd1e2a644 100644 --- a/docs/src/user-guide/migrating-to-5.0.0.md +++ b/docs/src/user-guide/migrating-to-5.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v5.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-5.0.0.md - ---- +# Migrating to v5.0.0 ESLint v5.0.0 is the fifth major version release. We have made a few breaking changes in this release, but we expect that most users will be able to upgrade without any modifications to their build. This guide is intended to walk you through the breaking changes. diff --git a/docs/src/user-guide/migrating-to-6.0.0.md b/docs/src/user-guide/migrating-to-6.0.0.md index 14cc7d868cf..225cc4c0e3b 100644 --- a/docs/src/user-guide/migrating-to-6.0.0.md +++ b/docs/src/user-guide/migrating-to-6.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v6.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-6.0.0.md - ---- +# Migrating to v6.0.0 ESLint v6.0.0 is a major release of ESLint. We have made a few breaking changes in this release. This guide is intended to walk you through the breaking changes. diff --git a/docs/src/user-guide/migrating-to-7.0.0.md b/docs/src/user-guide/migrating-to-7.0.0.md index b04b143f231..8b57df2444f 100644 --- a/docs/src/user-guide/migrating-to-7.0.0.md +++ b/docs/src/user-guide/migrating-to-7.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v7.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-7.0.0.md - ---- +# Migrating to v7.0.0 ESLint v7.0.0 is a major release of ESLint. We have made a few breaking changes in this release. This guide is intended to walk you through the breaking changes. diff --git a/docs/src/user-guide/migrating-to-8.0.0.md b/docs/src/user-guide/migrating-to-8.0.0.md index ea3457ff05c..86c2bc757fa 100644 --- a/docs/src/user-guide/migrating-to-8.0.0.md +++ b/docs/src/user-guide/migrating-to-8.0.0.md @@ -1,9 +1,4 @@ ---- -title: Migrating to v8.0.0 -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/migrating-to-8.0.0.md - ---- +# Migrating to v8.0.0 ESLint v8.0.0 is a major release of ESLint. We have made a few breaking changes in this release. This guide is intended to walk you through the breaking changes. diff --git a/docs/src/user-guide/rule-deprecation.md b/docs/src/user-guide/rule-deprecation.md index 2b929473187..e306916532d 100644 --- a/docs/src/user-guide/rule-deprecation.md +++ b/docs/src/user-guide/rule-deprecation.md @@ -1,9 +1,4 @@ ---- -title: Rule Deprecation -layout: doc -edit_link: https://github.com/eslint/eslint/edit/main/docs/src/user-guide/rule-deprecation.md - ---- +# Rule Deprecation Balancing the trade-offs of improving a tool and the frustration these changes can cause is a difficult task. One key area in which this affects our users is in the removal of rules.