From 8ca76eba73cf75a72cc008b09c2ae537fe6e6d0f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 9 Oct 2021 18:11:41 -0700 Subject: [PATCH] tools: update ESLint to 8.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/40394 Reviewed-By: Michaƫl Zasso Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca --- .../eslint-plugin-markdown/lib/processor.js | 7 + .../node_modules/@types/mdast/README.md | 2 +- .../node_modules/@types/mdast/package.json | 6 +- .../eslint-plugin-markdown/package.json | 2 +- tools/node_modules/eslint/LICENSE | 2 +- tools/node_modules/eslint/README.md | 10 +- tools/node_modules/eslint/bin/eslint.js | 2 +- .../eslint/conf/eslint-recommended.js | 6 +- ...category-list.json => rule-type-list.json} | 11 +- tools/node_modules/eslint/lib/api.js | 24 +- .../eslint/lib/cli-engine/cli-engine.js | 46 +- .../eslint/lib/cli-engine/file-enumerator.js | 7 +- .../lib/cli-engine/formatters/codeframe.js | 138 - .../eslint/lib/cli-engine/formatters/html.js | 2 +- .../eslint/lib/cli-engine/formatters/table.js | 159 - .../eslint/lib/cli-engine/formatters/tap.js | 2 +- .../eslint/lib/cli-engine/hash.js | 4 +- .../eslint/lib/cli-engine/xml-escape.js | 2 +- .../eslint/lib/config/flat-config-array.js | 4 +- .../eslint/lib/config/flat-config-schema.js | 2 +- .../eslint/lib/config/rule-validator.js | 35 +- .../node_modules/eslint/lib/eslint/eslint.js | 8 +- .../eslint/lib/init/autoconfig.js | 41 +- .../eslint/lib/init/config-file.js | 8 +- .../eslint/lib/init/config-initializer.js | 29 +- .../eslint/lib/init/config-rule.js | 31 +- .../node_modules/eslint/lib/init/npm-utils.js | 31 +- .../eslint/lib/init/source-code-utils.js | 11 +- .../lib/linter/apply-disable-directives.js | 215 +- .../code-path-analysis/code-path-analyzer.js | 151 +- .../code-path-analysis/code-path-segment.js | 1 - .../code-path-analysis/code-path-state.js | 5 +- .../linter/code-path-analysis/code-path.js | 19 +- .../code-path-analysis/debug-helpers.js | 4 +- .../linter/code-path-analysis/fork-context.js | 1 - .../linter/code-path-analysis/id-generator.js | 1 - .../lib/linter/config-comment-parser.js | 8 +- .../node_modules/eslint/lib/linter/linter.js | 103 +- .../eslint/lib/linter/node-event-generator.js | 5 +- .../eslint/lib/linter/report-translator.js | 24 +- tools/node_modules/eslint/lib/linter/rules.js | 3 + .../eslint/lib/linter/safe-emitter.js | 4 +- .../eslint/lib/linter/source-code-fixer.js | 4 +- .../node_modules/eslint/lib/linter/timing.js | 4 +- tools/node_modules/eslint/lib/options.js | 4 +- .../eslint/lib/rule-tester/rule-tester.js | 48 +- .../eslint/lib/rules/accessor-pairs.js | 1 - .../eslint/lib/rules/array-bracket-newline.js | 1 - .../eslint/lib/rules/array-bracket-spacing.js | 1 - .../eslint/lib/rules/array-callback-return.js | 1 - .../eslint/lib/rules/array-element-newline.js | 1 - .../eslint/lib/rules/arrow-body-style.js | 1 - .../eslint/lib/rules/arrow-parens.js | 1 - .../eslint/lib/rules/arrow-spacing.js | 1 - .../eslint/lib/rules/block-scoped-var.js | 1 - .../eslint/lib/rules/block-spacing.js | 1 - .../eslint/lib/rules/brace-style.js | 1 - .../eslint/lib/rules/callback-return.js | 2 +- .../eslint/lib/rules/camelcase.js | 436 +- .../eslint/lib/rules/capitalized-comments.js | 1 - .../lib/rules/class-methods-use-this.js | 66 +- .../eslint/lib/rules/comma-dangle.js | 4 +- .../eslint/lib/rules/comma-spacing.js | 1 - .../eslint/lib/rules/comma-style.js | 1 - .../eslint/lib/rules/complexity.js | 103 +- .../lib/rules/computed-property-spacing.js | 4 +- .../eslint/lib/rules/consistent-return.js | 1 - .../eslint/lib/rules/consistent-this.js | 3 +- .../eslint/lib/rules/constructor-super.js | 1 - tools/node_modules/eslint/lib/rules/curly.js | 1 - .../eslint/lib/rules/default-case-last.js | 1 - .../eslint/lib/rules/default-case.js | 5 +- .../eslint/lib/rules/default-param-last.js | 3 +- .../eslint/lib/rules/dot-location.js | 1 - .../eslint/lib/rules/dot-notation.js | 2 +- .../node_modules/eslint/lib/rules/eol-last.js | 8 +- tools/node_modules/eslint/lib/rules/eqeqeq.js | 3 +- .../eslint/lib/rules/for-direction.js | 1 - .../eslint/lib/rules/func-call-spacing.js | 1 - .../eslint/lib/rules/func-name-matching.js | 15 +- .../eslint/lib/rules/func-names.js | 2 +- .../eslint/lib/rules/func-style.js | 1 - .../rules/function-call-argument-newline.js | 1 - .../lib/rules/function-paren-newline.js | 2 +- .../lib/rules/generator-star-spacing.js | 1 - .../eslint/lib/rules/getter-return.js | 1 - .../eslint/lib/rules/global-require.js | 2 +- .../lib/rules/grouped-accessor-pairs.js | 1 - .../eslint/lib/rules/guard-for-in.js | 1 - .../eslint/lib/rules/handle-callback-err.js | 2 +- .../eslint/lib/rules/id-blacklist.js | 17 +- .../eslint/lib/rules/id-denylist.js | 58 +- .../eslint/lib/rules/id-length.js | 43 +- .../node_modules/eslint/lib/rules/id-match.js | 59 +- .../lib/rules/implicit-arrow-linebreak.js | 1 - .../eslint/lib/rules/indent-legacy.js | 2 +- tools/node_modules/eslint/lib/rules/indent.js | 58 +- tools/node_modules/eslint/lib/rules/index.js | 2 +- .../eslint/lib/rules/init-declarations.js | 1 - .../eslint/lib/rules/jsx-quotes.js | 1 - .../eslint/lib/rules/key-spacing.js | 9 +- .../eslint/lib/rules/keyword-spacing.js | 25 +- .../eslint/lib/rules/line-comment-position.js | 1 - .../eslint/lib/rules/linebreak-style.js | 1 - .../eslint/lib/rules/lines-around-comment.js | 1 - .../lib/rules/lines-around-directive.js | 3 +- .../lib/rules/lines-between-class-members.js | 53 +- .../eslint/lib/rules/max-classes-per-file.js | 39 +- .../eslint/lib/rules/max-depth.js | 1 - .../node_modules/eslint/lib/rules/max-len.js | 3 +- .../lib/rules/max-lines-per-function.js | 3 +- .../eslint/lib/rules/max-lines.js | 17 +- .../eslint/lib/rules/max-nested-callbacks.js | 1 - .../eslint/lib/rules/max-params.js | 1 - .../lib/rules/max-statements-per-line.js | 1 - .../eslint/lib/rules/max-statements.js | 1 - .../lib/rules/multiline-comment-style.js | 1 - .../eslint/lib/rules/multiline-ternary.js | 1 - .../node_modules/eslint/lib/rules/new-cap.js | 4 +- .../eslint/lib/rules/new-parens.js | 1 - .../eslint/lib/rules/newline-after-var.js | 9 +- .../eslint/lib/rules/newline-before-return.js | 3 +- .../lib/rules/newline-per-chained-call.js | 3 +- .../node_modules/eslint/lib/rules/no-alert.js | 1 - .../eslint/lib/rules/no-array-constructor.js | 1 - .../lib/rules/no-async-promise-executor.js | 1 - .../eslint/lib/rules/no-await-in-loop.js | 1 - .../eslint/lib/rules/no-bitwise.js | 11 +- .../eslint/lib/rules/no-buffer-constructor.js | 2 +- .../eslint/lib/rules/no-caller.js | 1 - .../eslint/lib/rules/no-case-declarations.js | 1 - .../eslint/lib/rules/no-catch-shadow.js | 1 - .../eslint/lib/rules/no-class-assign.js | 1 - .../eslint/lib/rules/no-compare-neg-zero.js | 1 - .../eslint/lib/rules/no-cond-assign.js | 1 - .../eslint/lib/rules/no-confusing-arrow.js | 1 - .../eslint/lib/rules/no-console.js | 1 - .../eslint/lib/rules/no-const-assign.js | 1 - .../eslint/lib/rules/no-constant-condition.js | 1 - .../eslint/lib/rules/no-constructor-return.js | 1 - .../eslint/lib/rules/no-continue.js | 1 - .../eslint/lib/rules/no-control-regex.js | 1 - .../eslint/lib/rules/no-debugger.js | 1 - .../eslint/lib/rules/no-delete-var.js | 1 - .../eslint/lib/rules/no-div-regex.js | 1 - .../eslint/lib/rules/no-dupe-args.js | 1 - .../eslint/lib/rules/no-dupe-class-members.js | 10 +- .../eslint/lib/rules/no-dupe-else-if.js | 1 - .../eslint/lib/rules/no-dupe-keys.js | 2 - .../eslint/lib/rules/no-duplicate-case.js | 1 - .../eslint/lib/rules/no-duplicate-imports.js | 1 - .../eslint/lib/rules/no-else-return.js | 1 - .../lib/rules/no-empty-character-class.js | 26 +- .../eslint/lib/rules/no-empty-function.js | 1 - .../eslint/lib/rules/no-empty-pattern.js | 1 - .../node_modules/eslint/lib/rules/no-empty.js | 1 - .../eslint/lib/rules/no-eq-null.js | 1 - .../node_modules/eslint/lib/rules/no-eval.js | 3 +- .../eslint/lib/rules/no-ex-assign.js | 1 - .../eslint/lib/rules/no-extend-native.js | 1 - .../eslint/lib/rules/no-extra-bind.js | 1 - .../eslint/lib/rules/no-extra-boolean-cast.js | 2 +- .../eslint/lib/rules/no-extra-label.js | 1 - .../eslint/lib/rules/no-extra-parens.js | 24 +- .../eslint/lib/rules/no-extra-semi.js | 3 +- .../eslint/lib/rules/no-fallthrough.js | 1 - .../eslint/lib/rules/no-floating-decimal.js | 1 - .../eslint/lib/rules/no-func-assign.js | 1 - .../eslint/lib/rules/no-global-assign.js | 1 - .../eslint/lib/rules/no-implicit-coercion.js | 1 - .../eslint/lib/rules/no-implicit-globals.js | 1 - .../eslint/lib/rules/no-implied-eval.js | 1 - .../eslint/lib/rules/no-import-assign.js | 1 - .../eslint/lib/rules/no-inline-comments.js | 1 - .../eslint/lib/rules/no-inner-declarations.js | 1 - .../eslint/lib/rules/no-invalid-regexp.js | 3 +- .../eslint/lib/rules/no-invalid-this.js | 5 +- .../lib/rules/no-irregular-whitespace.js | 1 - .../eslint/lib/rules/no-iterator.js | 1 - .../eslint/lib/rules/no-label-var.js | 1 - .../eslint/lib/rules/no-labels.js | 1 - .../eslint/lib/rules/no-lone-blocks.js | 1 - .../eslint/lib/rules/no-lonely-if.js | 1 - .../eslint/lib/rules/no-loop-func.js | 3 +- .../eslint/lib/rules/no-loss-of-precision.js | 3 +- .../eslint/lib/rules/no-magic-numbers.js | 1 - .../rules/no-misleading-character-class.js | 1 - .../eslint/lib/rules/no-mixed-operators.js | 3 +- .../eslint/lib/rules/no-mixed-requires.js | 2 +- .../lib/rules/no-mixed-spaces-and-tabs.js | 1 - .../eslint/lib/rules/no-multi-assign.js | 22 +- .../eslint/lib/rules/no-multi-spaces.js | 1 - .../eslint/lib/rules/no-multi-str.js | 1 - .../lib/rules/no-multiple-empty-lines.js | 1 - .../eslint/lib/rules/no-native-reassign.js | 1 - .../eslint/lib/rules/no-negated-condition.js | 1 - .../eslint/lib/rules/no-negated-in-lhs.js | 1 - .../eslint/lib/rules/no-nested-ternary.js | 1 - .../eslint/lib/rules/no-new-func.js | 41 +- .../eslint/lib/rules/no-new-object.js | 1 - .../eslint/lib/rules/no-new-require.js | 2 +- .../eslint/lib/rules/no-new-symbol.js | 1 - .../eslint/lib/rules/no-new-wrappers.js | 1 - tools/node_modules/eslint/lib/rules/no-new.js | 1 - .../lib/rules/no-nonoctal-decimal-escape.js | 8 +- .../eslint/lib/rules/no-obj-calls.js | 1 - .../eslint/lib/rules/no-octal-escape.js | 1 - .../node_modules/eslint/lib/rules/no-octal.js | 1 - .../eslint/lib/rules/no-param-reassign.js | 1 - .../eslint/lib/rules/no-path-concat.js | 2 +- .../eslint/lib/rules/no-plusplus.js | 1 - .../eslint/lib/rules/no-process-env.js | 2 +- .../eslint/lib/rules/no-process-exit.js | 2 +- .../lib/rules/no-promise-executor-return.js | 1 - .../node_modules/eslint/lib/rules/no-proto.js | 1 - .../eslint/lib/rules/no-prototype-builtins.js | 1 - .../eslint/lib/rules/no-redeclare.js | 1 - .../eslint/lib/rules/no-regex-spaces.js | 1 - .../eslint/lib/rules/no-restricted-exports.js | 1 - .../eslint/lib/rules/no-restricted-globals.js | 3 +- .../eslint/lib/rules/no-restricted-imports.js | 11 +- .../eslint/lib/rules/no-restricted-modules.js | 6 +- .../lib/rules/no-restricted-properties.js | 5 +- .../eslint/lib/rules/no-restricted-syntax.js | 3 +- .../eslint/lib/rules/no-return-assign.js | 1 - .../eslint/lib/rules/no-return-await.js | 1 - .../eslint/lib/rules/no-script-url.js | 4 +- .../eslint/lib/rules/no-self-assign.js | 1 - .../eslint/lib/rules/no-self-compare.js | 1 - .../eslint/lib/rules/no-sequences.js | 1 - .../eslint/lib/rules/no-setter-return.js | 2 +- .../lib/rules/no-shadow-restricted-names.js | 1 - .../eslint/lib/rules/no-shadow.js | 3 +- .../eslint/lib/rules/no-spaced-func.js | 1 - .../eslint/lib/rules/no-sparse-arrays.js | 1 - .../node_modules/eslint/lib/rules/no-sync.js | 4 +- .../node_modules/eslint/lib/rules/no-tabs.js | 1 - .../lib/rules/no-template-curly-in-string.js | 1 - .../eslint/lib/rules/no-ternary.js | 1 - .../eslint/lib/rules/no-this-before-super.js | 1 - .../eslint/lib/rules/no-throw-literal.js | 1 - .../eslint/lib/rules/no-trailing-spaces.js | 1 - .../eslint/lib/rules/no-undef-init.js | 1 - .../node_modules/eslint/lib/rules/no-undef.js | 1 - .../eslint/lib/rules/no-undefined.js | 1 - .../eslint/lib/rules/no-underscore-dangle.js | 6 +- .../lib/rules/no-unexpected-multiline.js | 1 - .../lib/rules/no-unmodified-loop-condition.js | 1 - .../eslint/lib/rules/no-unneeded-ternary.js | 1 - .../eslint/lib/rules/no-unreachable-loop.js | 1 - .../eslint/lib/rules/no-unreachable.js | 49 +- .../eslint/lib/rules/no-unsafe-finally.js | 1 - .../eslint/lib/rules/no-unsafe-negation.js | 6 +- .../lib/rules/no-unsafe-optional-chaining.js | 3 +- .../eslint/lib/rules/no-unused-expressions.js | 9 +- .../eslint/lib/rules/no-unused-labels.js | 1 - .../eslint/lib/rules/no-unused-vars.js | 54 +- .../eslint/lib/rules/no-use-before-define.js | 1 - .../lib/rules/no-useless-backreference.js | 3 +- .../eslint/lib/rules/no-useless-call.js | 1 - .../eslint/lib/rules/no-useless-catch.js | 1 - .../lib/rules/no-useless-computed-key.js | 92 +- .../eslint/lib/rules/no-useless-concat.js | 1 - .../lib/rules/no-useless-constructor.js | 1 - .../eslint/lib/rules/no-useless-escape.js | 23 +- .../eslint/lib/rules/no-useless-rename.js | 1 - .../eslint/lib/rules/no-useless-return.js | 1 - tools/node_modules/eslint/lib/rules/no-var.js | 1 - .../node_modules/eslint/lib/rules/no-void.js | 1 - .../eslint/lib/rules/no-warning-comments.js | 1 - .../rules/no-whitespace-before-property.js | 1 - .../node_modules/eslint/lib/rules/no-with.js | 1 - .../rules/nonblock-statement-body-position.js | 1 - .../eslint/lib/rules/object-curly-newline.js | 1 - .../eslint/lib/rules/object-curly-spacing.js | 1 - .../lib/rules/object-property-newline.js | 1 - .../eslint/lib/rules/object-shorthand.js | 11 +- .../lib/rules/one-var-declaration-per-line.js | 1 - .../node_modules/eslint/lib/rules/one-var.js | 3 +- .../eslint/lib/rules/operator-assignment.js | 13 +- .../eslint/lib/rules/operator-linebreak.js | 30 +- .../eslint/lib/rules/padded-blocks.js | 2 +- .../rules/padding-line-between-statements.js | 1 - .../eslint/lib/rules/prefer-arrow-callback.js | 2 +- .../eslint/lib/rules/prefer-const.js | 1 - .../eslint/lib/rules/prefer-destructuring.js | 9 +- .../rules/prefer-exponentiation-operator.js | 1 - .../lib/rules/prefer-named-capture-group.js | 1 - .../lib/rules/prefer-numeric-literals.js | 1 - .../eslint/lib/rules/prefer-object-spread.js | 1 - .../lib/rules/prefer-promise-reject-errors.js | 1 - .../eslint/lib/rules/prefer-reflect.js | 1 - .../eslint/lib/rules/prefer-regex-literals.js | 1 - .../eslint/lib/rules/prefer-rest-params.js | 1 - .../eslint/lib/rules/prefer-spread.js | 1 - .../eslint/lib/rules/prefer-template.js | 1 - .../eslint/lib/rules/quote-props.js | 17 +- tools/node_modules/eslint/lib/rules/quotes.js | 2 +- tools/node_modules/eslint/lib/rules/radix.js | 6 +- .../lib/rules/require-atomic-updates.js | 33 +- .../eslint/lib/rules/require-await.js | 1 - .../eslint/lib/rules/require-jsdoc.js | 2 +- .../lib/rules/require-unicode-regexp.js | 1 - .../eslint/lib/rules/require-yield.js | 1 - .../eslint/lib/rules/rest-spread-spacing.js | 1 - .../eslint/lib/rules/semi-spacing.js | 4 +- .../eslint/lib/rules/semi-style.js | 19 +- tools/node_modules/eslint/lib/rules/semi.js | 72 +- .../eslint/lib/rules/sort-imports.js | 1 - .../eslint/lib/rules/sort-keys.js | 1 - .../eslint/lib/rules/sort-vars.js | 1 - .../eslint/lib/rules/space-before-blocks.js | 17 +- .../lib/rules/space-before-function-paren.js | 1 - .../eslint/lib/rules/space-in-parens.js | 1 - .../eslint/lib/rules/space-infix-ops.js | 27 +- .../eslint/lib/rules/space-unary-ops.js | 1 - .../eslint/lib/rules/spaced-comment.js | 1 - tools/node_modules/eslint/lib/rules/strict.js | 1 - .../eslint/lib/rules/switch-colon-spacing.js | 15 +- .../eslint/lib/rules/symbol-description.js | 1 - .../lib/rules/template-curly-spacing.js | 1 - .../eslint/lib/rules/template-tag-spacing.js | 1 - .../eslint/lib/rules/unicode-bom.js | 1 - .../eslint/lib/rules/use-isnan.js | 1 - .../eslint/lib/rules/utils/ast-utils.js | 123 +- .../lib/rules/utils/lazy-loading-rule-map.js | 6 +- .../eslint/lib/rules/valid-jsdoc.js | 2 +- .../eslint/lib/rules/valid-typeof.js | 1 - .../eslint/lib/rules/vars-on-top.js | 3 +- .../eslint/lib/rules/wrap-iife.js | 1 - .../eslint/lib/rules/wrap-regex.js | 1 - .../eslint/lib/rules/yield-star-spacing.js | 1 - tools/node_modules/eslint/lib/rules/yoda.js | 1 - tools/node_modules/eslint/lib/shared/ajv.js | 2 +- .../eslint/lib/shared/config-validator.js | 23 +- .../node_modules/eslint/lib/shared/logging.js | 2 +- .../lib/shared/relative-module-resolver.js | 10 +- .../eslint/lib/shared/runtime-info.js | 3 + .../eslint/lib/shared/traverser.js | 4 +- tools/node_modules/eslint/lib/shared/types.js | 4 +- .../eslint/lib/source-code/source-code.js | 16 +- .../lib/source-code/token-store/cursor.js | 2 +- .../eslint/lib/unsupported-api.js | 23 + .../node_modules/@babel/code-frame/LICENSE | 22 - .../node_modules/@babel/code-frame/README.md | 19 - .../@babel/code-frame/lib/index.js | 167 - .../@babel/code-frame/package.json | 25 - .../helper-validator-identifier/LICENSE | 22 - .../helper-validator-identifier/README.md | 19 - .../lib/identifier.js | 84 - .../helper-validator-identifier/lib/index.js | 57 - .../lib/keyword.js | 38 - .../helper-validator-identifier/package.json | 26 - .../scripts/generate-identifier-regex.js | 75 - .../node_modules/@babel/highlight/LICENSE | 22 - .../node_modules/@babel/highlight/README.md | 19 - .../@babel/highlight/lib/index.js | 116 - .../node_modules/ansi-styles/index.js | 165 - .../node_modules/ansi-styles/license | 9 - .../node_modules/ansi-styles/package.json | 56 - .../node_modules/ansi-styles/readme.md | 147 - .../highlight/node_modules/chalk/index.js | 228 - .../node_modules/chalk/index.js.flow | 93 - .../highlight/node_modules/chalk/license | 9 - .../highlight/node_modules/chalk/package.json | 71 - .../highlight/node_modules/chalk/readme.md | 314 - .../highlight/node_modules/chalk/templates.js | 128 - .../node_modules/color-convert/LICENSE | 21 - .../node_modules/color-convert/README.md | 68 - .../node_modules/color-convert/conversions.js | 868 -- .../node_modules/color-convert/index.js | 78 - .../node_modules/color-convert/package.json | 46 - .../node_modules/color-convert/route.js | 97 - .../highlight/node_modules/color-name/LICENSE | 8 - .../node_modules/color-name/README.md | 11 - .../node_modules/color-name/index.js | 152 - .../node_modules/color-name/package.json | 25 - .../escape-string-regexp/index.js | 11 - .../escape-string-regexp/package.json | 41 - .../escape-string-regexp/readme.md | 27 - .../highlight/node_modules/has-flag/index.js | 8 - .../highlight/node_modules/has-flag/license | 9 - .../node_modules/has-flag/package.json | 44 - .../highlight/node_modules/has-flag/readme.md | 70 - .../node_modules/supports-color/browser.js | 5 - .../node_modules/supports-color/index.js | 131 - .../node_modules/supports-color/license | 9 - .../node_modules/supports-color/package.json | 53 - .../node_modules/supports-color/readme.md | 66 - .../@babel/highlight/package.json | 29 - .../@eslint/eslintrc/conf/config-schema.js | 4 +- .../@eslint/eslintrc/conf/environments.js | 5 +- .../conf/{eslint-all.js => eslint-all.cjs} | 0 ...-recommended.js => eslint-recommended.cjs} | 0 .../eslintrc/dist/eslintrc-universal.cjs | 1068 +++ .../@eslint/eslintrc/dist/eslintrc.cjs | 4236 ++++++++++ .../lib/cascading-config-array-factory.js | 19 +- .../eslintrc/lib/config-array-factory.js | 36 +- .../eslintrc/lib/config-array/config-array.js | 37 +- .../lib/config-array/config-dependency.js | 5 +- .../lib/config-array/extracted-config.js | 5 +- .../lib/config-array/ignore-pattern.js | 13 +- .../eslintrc/lib/config-array/index.js | 13 +- .../lib/config-array/override-tester.js | 14 +- .../@eslint/eslintrc/lib/flat-compat.js | 20 +- .../@eslint/eslintrc/lib/index-universal.js | 29 + .../@eslint/eslintrc/lib/index.js | 68 +- .../@eslint/eslintrc/lib/shared/ajv.js | 165 +- .../@eslint/eslintrc/lib/shared/config-ops.js | 217 +- .../eslintrc/lib/shared/config-validator.js | 21 +- .../lib/shared/deprecation-warnings.js | 5 +- .../@eslint/eslintrc/lib/shared/naming.js | 3 +- .../lib/shared/relative-module-resolver.js | 56 +- .../@eslint/eslintrc/lib/shared/types.js | 3 +- .../eslintrc/node_modules/argparse}/LICENSE | 4 +- .../eslintrc/node_modules/argparse/README.md | 257 + .../eslintrc/node_modules}/argparse/index.js | 0 .../node_modules}/argparse/lib/action.js | 0 .../argparse/lib/action/append.js | 0 .../argparse/lib/action/append/constant.js | 0 .../argparse/lib/action/count.js | 0 .../node_modules}/argparse/lib/action/help.js | 0 .../argparse/lib/action/store.js | 0 .../argparse/lib/action/store/constant.js | 0 .../argparse/lib/action/store/false.js | 0 .../argparse/lib/action/store/true.js | 0 .../argparse/lib/action/subparsers.js | 0 .../argparse/lib/action/version.js | 0 .../argparse/lib/action_container.js | 0 .../node_modules}/argparse/lib/argparse.js | 0 .../argparse/lib/argument/error.js | 0 .../argparse/lib/argument/exclusive.js | 0 .../argparse/lib/argument/group.js | 0 .../argparse/lib/argument_parser.js | 0 .../node_modules}/argparse/lib/const.js | 0 .../argparse/lib/help/added_formatters.js | 0 .../argparse/lib/help/formatter.js | 0 .../node_modules}/argparse/lib/namespace.js | 0 .../node_modules}/argparse/lib/utils.js | 0 .../node_modules/argparse/package.json | 34 + .../eslintrc/node_modules/js-yaml/LICENSE} | 4 +- .../eslintrc/node_modules/js-yaml/README.md | 299 + .../node_modules/js-yaml/bin/js-yaml.js | 132 + .../node_modules/js-yaml/dist/js-yaml.js | 3989 ++++++++++ .../node_modules/js-yaml/dist/js-yaml.min.js | 1 + .../eslintrc/node_modules/js-yaml/index.js | 7 + .../node_modules}/js-yaml/lib/js-yaml.js | 0 .../js-yaml/lib/js-yaml/common.js | 0 .../js-yaml/lib/js-yaml/dumper.js | 0 .../js-yaml/lib/js-yaml/exception.js | 0 .../js-yaml/lib/js-yaml/loader.js | 0 .../node_modules}/js-yaml/lib/js-yaml/mark.js | 0 .../js-yaml/lib/js-yaml/schema.js | 0 .../js-yaml/lib/js-yaml/schema/core.js | 0 .../lib/js-yaml/schema/default_full.js | 0 .../lib/js-yaml/schema/default_safe.js | 0 .../js-yaml/lib/js-yaml/schema/failsafe.js | 0 .../js-yaml/lib/js-yaml/schema/json.js | 0 .../node_modules}/js-yaml/lib/js-yaml/type.js | 0 .../js-yaml/lib/js-yaml/type/binary.js | 0 .../js-yaml/lib/js-yaml/type/bool.js | 0 .../js-yaml/lib/js-yaml/type/float.js | 0 .../js-yaml/lib/js-yaml/type/int.js | 0 .../js-yaml/lib/js-yaml/type/js/function.js | 0 .../js-yaml/lib/js-yaml/type/js/regexp.js | 0 .../js-yaml/lib/js-yaml/type/js/undefined.js | 0 .../js-yaml/lib/js-yaml/type/map.js | 0 .../js-yaml/lib/js-yaml/type/merge.js | 0 .../js-yaml/lib/js-yaml/type/null.js | 0 .../js-yaml/lib/js-yaml/type/omap.js | 0 .../js-yaml/lib/js-yaml/type/pairs.js | 0 .../js-yaml/lib/js-yaml/type/seq.js | 0 .../js-yaml/lib/js-yaml/type/set.js | 0 .../js-yaml/lib/js-yaml/type/str.js | 0 .../js-yaml/lib/js-yaml/type/timestamp.js | 0 .../node_modules/js-yaml/package.json | 49 + .../@eslint/eslintrc/package.json | 43 +- .../@humanwhocodes/config-array/README.md | 10 +- .../@humanwhocodes/config-array/api.js | 72 +- .../@humanwhocodes/config-array/package.json | 4 +- .../eslint/node_modules/acorn/LICENSE | 2 +- .../eslint/node_modules/acorn/README.md | 45 +- .../eslint/node_modules/acorn/dist/acorn.js | 1184 ++- .../eslint/node_modules/acorn/dist/acorn.mjs | 1184 ++- .../eslint/node_modules/acorn/dist/bin.js | 49 +- .../eslint/node_modules/acorn/package.json | 13 +- .../eslint/node_modules/ansi-regex/index.js | 2 +- .../node_modules/ansi-regex/package.json | 2 +- .../eslint/node_modules/ansi-regex/readme.md | 2 +- .../eslint/node_modules/argparse/LICENSE | 267 +- .../eslint/node_modules/argparse/README.md | 253 +- .../eslint/node_modules/argparse/argparse.js | 3707 +++++++++ .../eslint/node_modules/argparse/lib/sub.js | 67 + .../node_modules/argparse/lib/textwrap.js | 440 + .../eslint/node_modules/argparse/package.json | 29 +- .../eslint/node_modules/astral-regex/index.js | 6 - .../eslint/node_modules/astral-regex/license | 9 - .../node_modules/astral-regex/package.json | 33 - .../node_modules/astral-regex/readme.md | 46 - .../eslint/node_modules/deep-is/package.json | 7 +- .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 - .../eslint/node_modules/emoji-regex/README.md | 73 - .../node_modules/emoji-regex/es2015/index.js | 6 - .../node_modules/emoji-regex/es2015/text.js | 6 - .../eslint/node_modules/emoji-regex/index.js | 6 - .../node_modules/emoji-regex/package.json | 50 - .../eslint/node_modules/emoji-regex/text.js | 6 - .../node_modules/eslint-scope/README.md | 34 +- .../eslint-scope/dist/eslint-scope.cjs | 2213 ++++++ .../eslint-scope/lib/definition.js | 15 +- .../node_modules/eslint-scope/lib/index.js | 63 +- .../eslint-scope/lib/pattern-visitor.js | 11 +- .../eslint-scope/lib/reference.js | 17 +- .../eslint-scope/lib/referencer.js | 51 +- .../eslint-scope/lib/scope-manager.js | 57 +- .../node_modules/eslint-scope/lib/scope.js | 62 +- .../node_modules/eslint-scope/lib/variable.js | 7 +- .../node_modules/eslint-scope/lib/version.js | 3 + .../node_modules/eslint-scope/package.json | 52 +- .../eslint/node_modules/eslint-utils/index.js | 260 +- .../node_modules/eslint-utils/index.mjs | 260 +- .../eslint-visitor-keys/README.md | 2 +- .../eslint-visitor-keys/lib/visitor-keys.json | 5 + .../eslint-visitor-keys/package.json | 5 +- .../node_modules/eslint-utils/package.json | 29 +- .../eslint-visitor-keys/README.md | 8 + .../dist/eslint-visitor-keys.cjs | 364 + .../eslint-visitor-keys/lib/index.js | 86 +- .../{visitor-keys.json => visitor-keys.js} | 181 +- .../eslint-visitor-keys/package.json | 42 +- .../eslint/node_modules/espree/README.md | 37 +- .../node_modules/espree/dist/espree.cjs | 989 +++ .../eslint/node_modules/espree/espree.js | 32 +- .../node_modules/espree/lib/ast-node-types.js | 4 +- .../eslint/node_modules/espree/lib/espree.js | 87 +- .../node_modules/espree/lib/features.js | 4 +- .../eslint/node_modules/espree/lib/options.js | 72 +- .../espree/lib/token-translator.js | 8 +- .../eslint/node_modules/espree/lib/version.js | 3 + .../node_modules/espree/lib/visitor-keys.js | 123 - .../node_modules/eslint-visitor-keys/LICENSE | 201 - .../eslint-visitor-keys/README.md | 98 - .../eslint-visitor-keys/lib/index.js | 81 - .../eslint-visitor-keys/lib/visitor-keys.json | 284 - .../eslint-visitor-keys/package.json | 40 - .../eslint/node_modules/espree/package.json | 60 +- .../node_modules/estraverse/LICENSE.BSD | 19 - .../esquery/node_modules/estraverse/README.md | 153 - .../node_modules/estraverse/estraverse.js | 801 -- .../node_modules/estraverse/package.json | 40 - .../node_modules/estraverse/LICENSE.BSD | 19 - .../node_modules/estraverse/README.md | 153 - .../node_modules/estraverse/estraverse.js | 801 -- .../node_modules/estraverse/package.json | 40 - .../node_modules/estraverse/estraverse.js | 21 +- .../node_modules/estraverse/package.json | 2 +- .../eslint/node_modules/glob-parent/LICENSE | 2 +- .../eslint/node_modules/glob-parent/README.md | 49 +- .../eslint/node_modules/glob-parent/index.js | 45 +- .../node_modules/glob-parent/package.json | 30 +- .../eslint/node_modules/glob/README.md | 3 + .../eslint/node_modules/glob/changelog.md | 67 - .../eslint/node_modules/glob/common.js | 2 + .../eslint/node_modules/glob/glob.js | 9 +- .../eslint/node_modules/glob/package.json | 3 +- .../eslint/node_modules/glob/sync.js | 9 +- .../eslint/node_modules/globals/globals.json | 1 + .../eslint/node_modules/globals/package.json | 2 +- .../is-fullwidth-code-point/index.js | 50 - .../is-fullwidth-code-point/license | 9 - .../is-fullwidth-code-point/package.json | 42 - .../is-fullwidth-code-point/readme.md | 39 - .../eslint/node_modules/is-glob/README.md | 2 +- .../eslint/node_modules/is-glob/index.js | 150 +- .../eslint/node_modules/is-glob/package.json | 4 +- .../eslint/node_modules/js-tokens/README.md | 240 - .../eslint/node_modules/js-tokens/index.js | 23 - .../node_modules/js-tokens/package.json | 30 - .../eslint/node_modules/js-yaml/README.md | 107 +- .../node_modules/js-yaml/bin/js-yaml.js | 40 +- .../node_modules/js-yaml/dist/js-yaml.js | 7049 ++++++++--------- .../node_modules/js-yaml/dist/js-yaml.min.js | 3 +- .../node_modules/js-yaml/dist/js-yaml.mjs | 3851 +++++++++ .../eslint/node_modules/js-yaml/index.js | 44 +- .../eslint/node_modules/js-yaml/lib/common.js | 59 + .../eslint/node_modules/js-yaml/lib/dumper.js | 965 +++ .../node_modules/js-yaml/lib/exception.js | 55 + .../eslint/node_modules/js-yaml/lib/loader.js | 1727 ++++ .../eslint/node_modules/js-yaml/lib/schema.js | 121 + .../node_modules/js-yaml/lib/schema/core.js | 11 + .../js-yaml/lib/schema/default.js | 22 + .../js-yaml/lib/schema/failsafe.js | 17 + .../node_modules/js-yaml/lib/schema/json.js | 19 + .../node_modules/js-yaml/lib/snippet.js | 101 + .../eslint/node_modules/js-yaml/lib/type.js | 66 + .../node_modules/js-yaml/lib/type/binary.js | 125 + .../node_modules/js-yaml/lib/type/bool.js | 35 + .../node_modules/js-yaml/lib/type/float.js | 97 + .../node_modules/js-yaml/lib/type/int.js | 156 + .../node_modules/js-yaml/lib/type/map.js | 8 + .../node_modules/js-yaml/lib/type/merge.js | 12 + .../node_modules/js-yaml/lib/type/null.js | 35 + .../node_modules/js-yaml/lib/type/omap.js | 44 + .../node_modules/js-yaml/lib/type/pairs.js | 53 + .../node_modules/js-yaml/lib/type/seq.js | 8 + .../node_modules/js-yaml/lib/type/set.js | 29 + .../node_modules/js-yaml/lib/type/str.js | 8 + .../js-yaml/lib/type/timestamp.js | 88 + .../eslint/node_modules/js-yaml/package.json | 41 +- .../node_modules/lodash.clonedeep/LICENSE | 47 - .../node_modules/lodash.clonedeep/README.md | 18 - .../node_modules/lodash.clonedeep/index.js | 1748 ---- .../lodash.clonedeep/package.json | 17 - .../node_modules/lodash.truncate/LICENSE | 47 - .../node_modules/lodash.truncate/README.md | 18 - .../node_modules/lodash.truncate/index.js | 632 -- .../node_modules/lodash.truncate/package.json | 17 - .../node_modules/require-from-string/index.js | 34 - .../node_modules/require-from-string/license | 21 - .../require-from-string/package.json | 28 - .../require-from-string/readme.md | 56 - .../eslint/node_modules/slice-ansi/index.js | 103 - .../eslint/node_modules/slice-ansi/license | 10 - .../node_modules/slice-ansi/package.json | 52 - .../eslint/node_modules/slice-ansi/readme.md | 66 - .../eslint/node_modules/string-width/index.js | 47 - .../eslint/node_modules/string-width/license | 9 - .../node_modules/string-width/package.json | 56 - .../node_modules/string-width/readme.md | 50 - .../node_modules/strip-ansi/package.json | 4 +- .../eslint/node_modules/table/LICENSE | 24 - .../eslint/node_modules/table/README.md | 759 -- .../node_modules/table/dist/alignString.js | 59 - .../node_modules/table/dist/alignTableData.js | 13 - .../table/dist/calculateCellHeight.js | 11 - .../table/dist/calculateCellWidths.js | 16 - .../table/dist/calculateColumnWidths.js | 16 - .../table/dist/calculateRowHeights.js | 18 - .../node_modules/table/dist/createStream.js | 72 - .../node_modules/table/dist/drawBorder.js | 100 - .../node_modules/table/dist/drawContent.js | 26 - .../node_modules/table/dist/drawHeader.js | 29 - .../eslint/node_modules/table/dist/drawRow.js | 20 - .../node_modules/table/dist/drawTable.js | 38 - .../table/dist/generated/validators.js | 2170 ----- .../table/dist/getBorderCharacters.js | 88 - .../eslint/node_modules/table/dist/index.js | 20 - .../table/dist/makeStreamConfig.js | 47 - .../table/dist/makeTableConfig.js | 66 - .../table/dist/mapDataUsingRowHeights.js | 44 - .../node_modules/table/dist/padTableData.js | 16 - .../table/dist/stringifyTableData.js | 12 - .../eslint/node_modules/table/dist/table.js | 26 - .../table/dist/truncateTableData.js | 23 - .../node_modules/table/dist/types/api.js | 2 - .../node_modules/table/dist/types/internal.js | 2 - .../eslint/node_modules/table/dist/utils.js | 92 - .../node_modules/table/dist/validateConfig.js | 25 - .../table/dist/validateTableData.js | 31 - .../node_modules/table/dist/wrapCell.js | 32 - .../node_modules/table/dist/wrapString.js | 26 - .../node_modules/table/dist/wrapWord.js | 41 - .../table/node_modules/ajv/.runkit_example.js | 23 - .../table/node_modules/ajv/LICENSE | 22 - .../table/node_modules/ajv/README.md | 204 - .../table/node_modules/ajv/dist/2019.js | 55 - .../table/node_modules/ajv/dist/2020.js | 49 - .../table/node_modules/ajv/dist/ajv.js | 44 - .../ajv/dist/compile/codegen/code.js | 147 - .../ajv/dist/compile/codegen/index.js | 697 -- .../ajv/dist/compile/codegen/scope.js | 143 - .../node_modules/ajv/dist/compile/errors.js | 123 - .../node_modules/ajv/dist/compile/index.js | 242 - .../ajv/dist/compile/jtd/parse.js | 350 - .../ajv/dist/compile/jtd/serialize.js | 218 - .../ajv/dist/compile/jtd/types.js | 14 - .../node_modules/ajv/dist/compile/names.js | 28 - .../ajv/dist/compile/ref_error.js | 12 - .../node_modules/ajv/dist/compile/resolve.js | 153 - .../node_modules/ajv/dist/compile/rules.js | 26 - .../node_modules/ajv/dist/compile/util.js | 178 - .../dist/compile/validate/applicability.js | 19 - .../ajv/dist/compile/validate/boolSchema.js | 50 - .../ajv/dist/compile/validate/dataType.js | 202 - .../ajv/dist/compile/validate/defaults.js | 35 - .../ajv/dist/compile/validate/index.js | 510 -- .../ajv/dist/compile/validate/keyword.js | 124 - .../ajv/dist/compile/validate/subschema.js | 81 - .../table/node_modules/ajv/dist/core.js | 611 -- .../table/node_modules/ajv/dist/jtd.js | 66 - .../node_modules/ajv/dist/refs/data.json | 13 - .../dist/refs/json-schema-2019-09/index.js | 28 - .../json-schema-2019-09/meta/applicator.json | 53 - .../json-schema-2019-09/meta/content.json | 17 - .../refs/json-schema-2019-09/meta/core.json | 57 - .../refs/json-schema-2019-09/meta/format.json | 14 - .../json-schema-2019-09/meta/meta-data.json | 37 - .../json-schema-2019-09/meta/validation.json | 90 - .../dist/refs/json-schema-2019-09/schema.json | 39 - .../dist/refs/json-schema-2020-12/index.js | 30 - .../json-schema-2020-12/meta/applicator.json | 48 - .../json-schema-2020-12/meta/content.json | 17 - .../refs/json-schema-2020-12/meta/core.json | 51 - .../meta/format-annotation.json | 14 - .../json-schema-2020-12/meta/meta-data.json | 37 - .../json-schema-2020-12/meta/unevaluated.json | 15 - .../json-schema-2020-12/meta/validation.json | 90 - .../dist/refs/json-schema-2020-12/schema.json | 55 - .../ajv/dist/refs/json-schema-draft-06.json | 137 - .../ajv/dist/refs/json-schema-draft-07.json | 151 - .../ajv/dist/refs/json-schema-secure.json | 88 - .../node_modules/ajv/dist/refs/jtd-schema.js | 118 - .../node_modules/ajv/dist/runtime/equal.js | 7 - .../ajv/dist/runtime/parseJson.js | 182 - .../node_modules/ajv/dist/runtime/quote.js | 30 - .../ajv/dist/runtime/timestamp.js | 42 - .../ajv/dist/runtime/ucs2length.js | 24 - .../ajv/dist/runtime/validation_error.js | 11 - .../node_modules/ajv/dist/standalone/index.js | 81 - .../ajv/dist/standalone/instance.js | 35 - .../node_modules/ajv/dist/types/index.js | 3 - .../ajv/dist/types/json-schema.js | 3 - .../node_modules/ajv/dist/types/jtd-schema.js | 3 - .../applicator/additionalItems.js | 49 - .../applicator/additionalProperties.js | 106 - .../ajv/dist/vocabularies/applicator/allOf.js | 23 - .../ajv/dist/vocabularies/applicator/anyOf.js | 12 - .../dist/vocabularies/applicator/contains.js | 87 - .../vocabularies/applicator/dependencies.js | 85 - .../applicator/dependentSchemas.js | 11 - .../ajv/dist/vocabularies/applicator/if.js | 66 - .../ajv/dist/vocabularies/applicator/index.js | 44 - .../ajv/dist/vocabularies/applicator/items.js | 52 - .../dist/vocabularies/applicator/items2020.js | 30 - .../ajv/dist/vocabularies/applicator/not.js | 26 - .../ajv/dist/vocabularies/applicator/oneOf.js | 60 - .../applicator/patternProperties.js | 75 - .../vocabularies/applicator/prefixItems.js | 12 - .../vocabularies/applicator/properties.js | 54 - .../vocabularies/applicator/propertyNames.js | 38 - .../dist/vocabularies/applicator/thenElse.js | 13 - .../ajv/dist/vocabularies/code.js | 127 - .../ajv/dist/vocabularies/core/id.js | 10 - .../ajv/dist/vocabularies/core/index.js | 16 - .../ajv/dist/vocabularies/core/ref.js | 122 - .../dist/vocabularies/discriminator/index.js | 93 - .../dist/vocabularies/discriminator/types.js | 9 - .../ajv/dist/vocabularies/draft2020.js | 23 - .../ajv/dist/vocabularies/draft7.js | 17 - .../vocabularies/dynamic/dynamicAnchor.js | 30 - .../dist/vocabularies/dynamic/dynamicRef.js | 51 - .../ajv/dist/vocabularies/dynamic/index.js | 9 - .../vocabularies/dynamic/recursiveAnchor.js | 16 - .../dist/vocabularies/dynamic/recursiveRef.js | 10 - .../ajv/dist/vocabularies/errors.js | 3 - .../ajv/dist/vocabularies/format/format.js | 92 - .../ajv/dist/vocabularies/format/index.js | 6 - .../dist/vocabularies/jtd/discriminator.js | 71 - .../ajv/dist/vocabularies/jtd/elements.js | 24 - .../ajv/dist/vocabularies/jtd/enum.js | 43 - .../ajv/dist/vocabularies/jtd/error.js | 20 - .../ajv/dist/vocabularies/jtd/index.js | 29 - .../ajv/dist/vocabularies/jtd/metadata.js | 25 - .../ajv/dist/vocabularies/jtd/nullable.js | 22 - .../vocabularies/jtd/optionalProperties.js | 15 - .../ajv/dist/vocabularies/jtd/properties.js | 146 - .../ajv/dist/vocabularies/jtd/ref.js | 66 - .../ajv/dist/vocabularies/jtd/type.js | 69 - .../ajv/dist/vocabularies/jtd/union.js | 12 - .../ajv/dist/vocabularies/jtd/values.js | 48 - .../ajv/dist/vocabularies/metadata.js | 18 - .../ajv/dist/vocabularies/next.js | 8 - .../dist/vocabularies/unevaluated/index.js | 7 - .../unevaluated/unevaluatedItems.js | 40 - .../unevaluated/unevaluatedProperties.js | 65 - .../ajv/dist/vocabularies/validation/const.js | 25 - .../validation/dependentRequired.js | 12 - .../ajv/dist/vocabularies/validation/enum.js | 47 - .../ajv/dist/vocabularies/validation/index.js | 33 - .../vocabularies/validation/limitContains.js | 15 - .../vocabularies/validation/limitItems.js | 24 - .../vocabularies/validation/limitLength.js | 27 - .../vocabularies/validation/limitNumber.js | 27 - .../validation/limitProperties.js | 24 - .../vocabularies/validation/multipleOf.js | 26 - .../dist/vocabularies/validation/pattern.js | 24 - .../dist/vocabularies/validation/required.js | 79 - .../vocabularies/validation/uniqueItems.js | 64 - .../table/node_modules/ajv/lib/refs/data.json | 13 - .../json-schema-2019-09/meta/applicator.json | 53 - .../json-schema-2019-09/meta/content.json | 17 - .../refs/json-schema-2019-09/meta/core.json | 57 - .../refs/json-schema-2019-09/meta/format.json | 14 - .../json-schema-2019-09/meta/meta-data.json | 37 - .../json-schema-2019-09/meta/validation.json | 90 - .../lib/refs/json-schema-2019-09/schema.json | 39 - .../json-schema-2020-12/meta/applicator.json | 48 - .../json-schema-2020-12/meta/content.json | 17 - .../refs/json-schema-2020-12/meta/core.json | 51 - .../meta/format-annotation.json | 14 - .../json-schema-2020-12/meta/meta-data.json | 37 - .../json-schema-2020-12/meta/unevaluated.json | 15 - .../json-schema-2020-12/meta/validation.json | 90 - .../lib/refs/json-schema-2020-12/schema.json | 55 - .../ajv/lib/refs/json-schema-draft-06.json | 137 - .../ajv/lib/refs/json-schema-draft-07.json | 151 - .../ajv/lib/refs/json-schema-secure.json | 88 - .../table/node_modules/ajv/package.json | 123 - .../node_modules/json-schema-traverse/LICENSE | 21 - .../json-schema-traverse/README.md | 95 - .../json-schema-traverse/index.js | 93 - .../json-schema-traverse/package.json | 43 - .../eslint/node_modules/table/package.json | 94 - tools/node_modules/eslint/package.json | 53 +- 814 files changed, 34870 insertions(+), 31943 deletions(-) rename tools/node_modules/eslint/conf/{category-list.json => rule-type-list.json} (74%) delete mode 100644 tools/node_modules/eslint/lib/cli-engine/formatters/codeframe.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/formatters/table.js create mode 100644 tools/node_modules/eslint/lib/unsupported-api.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js.flow delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/templates.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/conversions.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-convert/route.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-name/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-name/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-name/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/color-name/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/escape-string-regexp/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/escape-string-regexp/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/has-flag/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/has-flag/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/has-flag/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/has-flag/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/supports-color/browser.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/supports-color/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/supports-color/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/supports-color/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/supports-color/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/highlight/package.json rename tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/{eslint-all.js => eslint-all.cjs} (100%) rename tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/{eslint-recommended.js => eslint-recommended.cjs} (100%) create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/index-universal.js rename tools/node_modules/eslint/node_modules/{js-tokens => @eslint/eslintrc/node_modules/argparse}/LICENSE (92%) create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/argparse/README.md rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/index.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/append.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/append/constant.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/count.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/help.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/store.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/store/constant.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/store/false.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/store/true.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/subparsers.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action/version.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/action_container.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/argparse.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/argument/error.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/argument/exclusive.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/argument/group.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/argument_parser.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/const.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/help/added_formatters.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/help/formatter.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/namespace.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/argparse/lib/utils.js (100%) create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/argparse/package.json rename tools/node_modules/eslint/node_modules/{@babel/highlight/node_modules/escape-string-regexp/license => @eslint/eslintrc/node_modules/js-yaml/LICENSE} (91%) create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/README.md create mode 100755 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/bin/js-yaml.js create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/dist/js-yaml.js create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/index.js rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/common.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/dumper.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/exception.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/loader.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/mark.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema/core.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema/default_full.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema/default_safe.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema/failsafe.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/schema/json.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/binary.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/bool.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/float.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/int.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/js/function.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/js/regexp.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/js/undefined.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/map.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/merge.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/null.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/omap.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/pairs.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/seq.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/set.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/str.js (100%) rename tools/node_modules/eslint/node_modules/{ => @eslint/eslintrc/node_modules}/js-yaml/lib/js-yaml/type/timestamp.js (100%) create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/js-yaml/package.json create mode 100644 tools/node_modules/eslint/node_modules/argparse/argparse.js create mode 100644 tools/node_modules/eslint/node_modules/argparse/lib/sub.js create mode 100644 tools/node_modules/eslint/node_modules/argparse/lib/textwrap.js delete mode 100644 tools/node_modules/eslint/node_modules/astral-regex/index.js delete mode 100644 tools/node_modules/eslint/node_modules/astral-regex/license delete mode 100644 tools/node_modules/eslint/node_modules/astral-regex/package.json delete mode 100644 tools/node_modules/eslint/node_modules/astral-regex/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/LICENSE-MIT.txt delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/README.md delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/es2015/index.js delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/es2015/text.js delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/index.js delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/package.json delete mode 100644 tools/node_modules/eslint/node_modules/emoji-regex/text.js create mode 100644 tools/node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs create mode 100644 tools/node_modules/eslint/node_modules/eslint-scope/lib/version.js create mode 100644 tools/node_modules/eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs rename tools/node_modules/eslint/node_modules/eslint-visitor-keys/lib/{visitor-keys.json => visitor-keys.js} (56%) create mode 100644 tools/node_modules/eslint/node_modules/espree/dist/espree.cjs create mode 100644 tools/node_modules/eslint/node_modules/espree/lib/version.js delete mode 100644 tools/node_modules/eslint/node_modules/espree/lib/visitor-keys.js delete mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/README.md delete mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/index.js delete mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/visitor-keys.json delete mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/package.json delete mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/LICENSE.BSD delete mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/README.md delete mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js delete mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json delete mode 100644 tools/node_modules/eslint/node_modules/esrecurse/node_modules/estraverse/LICENSE.BSD delete mode 100644 tools/node_modules/eslint/node_modules/esrecurse/node_modules/estraverse/README.md delete mode 100644 tools/node_modules/eslint/node_modules/esrecurse/node_modules/estraverse/estraverse.js delete mode 100644 tools/node_modules/eslint/node_modules/esrecurse/node_modules/estraverse/package.json delete mode 100644 tools/node_modules/eslint/node_modules/glob/changelog.md delete mode 100644 tools/node_modules/eslint/node_modules/is-fullwidth-code-point/index.js delete mode 100644 tools/node_modules/eslint/node_modules/is-fullwidth-code-point/license delete mode 100644 tools/node_modules/eslint/node_modules/is-fullwidth-code-point/package.json delete mode 100644 tools/node_modules/eslint/node_modules/is-fullwidth-code-point/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/js-tokens/README.md delete mode 100644 tools/node_modules/eslint/node_modules/js-tokens/index.js delete mode 100644 tools/node_modules/eslint/node_modules/js-tokens/package.json create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.mjs create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/common.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/dumper.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/exception.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/loader.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/schema.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/schema/core.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/schema/default.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/schema/failsafe.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/schema/json.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/snippet.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/binary.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/bool.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/float.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/int.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/map.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/merge.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/null.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/omap.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/pairs.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/seq.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/set.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/str.js create mode 100644 tools/node_modules/eslint/node_modules/js-yaml/lib/type/timestamp.js delete mode 100644 tools/node_modules/eslint/node_modules/lodash.clonedeep/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/lodash.clonedeep/README.md delete mode 100644 tools/node_modules/eslint/node_modules/lodash.clonedeep/index.js delete mode 100644 tools/node_modules/eslint/node_modules/lodash.clonedeep/package.json delete mode 100644 tools/node_modules/eslint/node_modules/lodash.truncate/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/lodash.truncate/README.md delete mode 100644 tools/node_modules/eslint/node_modules/lodash.truncate/index.js delete mode 100644 tools/node_modules/eslint/node_modules/lodash.truncate/package.json delete mode 100644 tools/node_modules/eslint/node_modules/require-from-string/index.js delete mode 100644 tools/node_modules/eslint/node_modules/require-from-string/license delete mode 100644 tools/node_modules/eslint/node_modules/require-from-string/package.json delete mode 100644 tools/node_modules/eslint/node_modules/require-from-string/readme.md delete mode 100755 tools/node_modules/eslint/node_modules/slice-ansi/index.js delete mode 100644 tools/node_modules/eslint/node_modules/slice-ansi/license delete mode 100644 tools/node_modules/eslint/node_modules/slice-ansi/package.json delete mode 100644 tools/node_modules/eslint/node_modules/slice-ansi/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/string-width/index.js delete mode 100644 tools/node_modules/eslint/node_modules/string-width/license delete mode 100644 tools/node_modules/eslint/node_modules/string-width/package.json delete mode 100644 tools/node_modules/eslint/node_modules/string-width/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/table/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/table/README.md delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/alignString.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/alignTableData.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/calculateCellWidths.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/calculateColumnWidths.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/calculateRowHeights.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/createStream.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/drawBorder.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/drawContent.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/drawHeader.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/drawRow.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/drawTable.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/generated/validators.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/makeTableConfig.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeights.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/padTableData.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/table.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/types/api.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/types/internal.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/utils.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/validateConfig.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/validateTableData.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/wrapCell.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/wrapString.js delete mode 100644 tools/node_modules/eslint/node_modules/table/dist/wrapWord.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/.runkit_example.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/2019.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/2020.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/ajv.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/errors.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/types.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/names.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/ref_error.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/resolve.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/rules.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/util.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/applicability.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/boolSchema.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/dataType.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/defaults.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/subschema.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/jtd.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-06.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-07.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-secure.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/jtd-schema.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/equal.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/parseJson.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/quote.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/timestamp.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/ucs2length.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/runtime/validation_error.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/instance.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/json-schema.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/jtd-schema.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/allOf.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/anyOf.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/contains.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependencies.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/if.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items2020.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/not.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/oneOf.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/properties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/thenElse.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/id.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/ref.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/discriminator/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/discriminator/types.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/draft2020.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/draft7.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/errors.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/format.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/discriminator.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/elements.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/enum.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/error.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/metadata.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/nullable.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/properties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/ref.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/union.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/values.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/metadata.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/next.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/const.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/enum.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitContains.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitItems.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitLength.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitNumber.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitProperties.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/multipleOf.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/required.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-06.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-07.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-secure.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/README.md delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/index.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/package.json delete mode 100644 tools/node_modules/eslint/node_modules/table/package.json diff --git a/tools/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/node_modules/eslint-plugin-markdown/lib/processor.js index a79f24356f..63aa915906 100644 --- a/tools/node_modules/eslint-plugin-markdown/lib/processor.js +++ b/tools/node_modules/eslint-plugin-markdown/lib/processor.js @@ -321,6 +321,13 @@ function adjustBlock(block) { * @returns {Message} The same message, but adjusted to the correct location. */ return function adjustMessage(message) { + if (!Number.isInteger(message.line)) { + return { + ...message, + line: blockStart, + column: block.position.start.column + }; + } const lineInCode = message.line - leadingCommentLines; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md index 120083c91f..45df54e56e 100755 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md @@ -8,7 +8,7 @@ This package contains type definitions for Mdast (https://github.com/syntax-tree Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast. ### Additional Details - * Last updated: Fri, 16 Jul 2021 17:31:26 GMT + * Last updated: Mon, 23 Aug 2021 20:18:29 GMT * Dependencies: [@types/unist](https://npmjs.com/package/@types/unist) * Global values: none diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json index cfd3ff28b0..a61222d2af 100755 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json @@ -1,6 +1,6 @@ { "name": "@types/mdast", - "version": "3.0.7", + "version": "3.0.10", "description": "TypeScript definitions for Mdast", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast", "license": "MIT", @@ -37,6 +37,6 @@ "dependencies": { "@types/unist": "*" }, - "typesPublisherContentHash": "666079441041567c5bdfa2b8ff46e900b18d544357be5b8cdcecfb412129e903", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "87d2054120bead1983528802563a50cbb2f2efd6677d446e5ec34071f50bddcc", + "typeScriptVersion": "3.7" } \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/package.json b/tools/node_modules/eslint-plugin-markdown/package.json index 2742d65e81..d1a5020872 100644 --- a/tools/node_modules/eslint-plugin-markdown/package.json +++ b/tools/node_modules/eslint-plugin-markdown/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-markdown", - "version": "2.2.0", + "version": "2.2.1", "description": "An ESLint plugin to lint JavaScript in Markdown code fences.", "license": "MIT", "author": { diff --git a/tools/node_modules/eslint/LICENSE b/tools/node_modules/eslint/LICENSE index 7fe552a866..b607bb36e9 100644 --- a/tools/node_modules/eslint/LICENSE +++ b/tools/node_modules/eslint/LICENSE @@ -1,4 +1,4 @@ -Copyright JS Foundation and other contributors, https://js.foundation +Copyright OpenJS Foundation and other contributors, Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 804310d8c1..43bcdaa3f2 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -43,7 +43,7 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J ## Installation and Usage -Prerequisites: [Node.js](https://nodejs.org/) (`^10.12.0`, or `>=12.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) +Prerequisites: [Node.js](https://nodejs.org/) (`^12.22.0`, `^14.17.0`, or `>=16.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) You can install ESLint using npm: @@ -123,7 +123,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi ### What ECMAScript versions does ESLint support? -ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, and 2020. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring). +ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring). ### What about experimental features? @@ -296,9 +296,9 @@ The following companies, organizations, and individuals support ESLint's ongoing

Platinum Sponsors

Automattic

Gold Sponsors

-

Nx (by Nrwl) Chrome's Web Framework & Tools Performance Fund Salesforce Airbnb Coinbase Substack

Silver Sponsors

-

Retool Liftoff

Bronze Sponsors

-

Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks Practice Ignition

+

Nx (by Nrwl) Chrome's Web Framework & Tools Performance Fund Salesforce Airbnb Coinbase American Express Substack

Silver Sponsors

+

Liftoff

Bronze Sponsors

+

launchdarkly TROYPOINT Mobilen Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks Practice Ignition

## Technology Sponsors diff --git a/tools/node_modules/eslint/bin/eslint.js b/tools/node_modules/eslint/bin/eslint.js index 5fa5766828..6b05356b9d 100755 --- a/tools/node_modules/eslint/bin/eslint.js +++ b/tools/node_modules/eslint/bin/eslint.js @@ -5,7 +5,7 @@ * @author Nicholas C. Zakas */ -/* eslint no-console:off */ +/* eslint no-console:off -- CLI */ "use strict"; diff --git a/tools/node_modules/eslint/conf/eslint-recommended.js b/tools/node_modules/eslint/conf/eslint-recommended.js index 2137685fb7..6f639855a9 100644 --- a/tools/node_modules/eslint/conf/eslint-recommended.js +++ b/tools/node_modules/eslint/conf/eslint-recommended.js @@ -6,7 +6,7 @@ "use strict"; -/* eslint sort-keys: ["error", "asc"] */ +/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */ /** @type {import("../lib/shared/types").ConfigData} */ module.exports = { @@ -42,9 +42,11 @@ module.exports = { "no-inner-declarations": "error", "no-invalid-regexp": "error", "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", "no-misleading-character-class": "error", "no-mixed-spaces-and-tabs": "error", "no-new-symbol": "error", + "no-nonoctal-decimal-escape": "error", "no-obj-calls": "error", "no-octal": "error", "no-prototype-builtins": "error", @@ -60,8 +62,10 @@ module.exports = { "no-unreachable": "error", "no-unsafe-finally": "error", "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", "no-unused-labels": "error", "no-unused-vars": "error", + "no-useless-backreference": "error", "no-useless-catch": "error", "no-useless-escape": "error", "no-with": "error", diff --git a/tools/node_modules/eslint/conf/category-list.json b/tools/node_modules/eslint/conf/rule-type-list.json similarity index 74% rename from tools/node_modules/eslint/conf/category-list.json rename to tools/node_modules/eslint/conf/rule-type-list.json index cd3b816b65..f362aa412f 100644 --- a/tools/node_modules/eslint/conf/category-list.json +++ b/tools/node_modules/eslint/conf/rule-type-list.json @@ -1,11 +1,8 @@ { - "categories": [ - { "name": "Possible Errors", "description": "These rules relate to possible syntax or logic errors in JavaScript code:" }, - { "name": "Best Practices", "description": "These rules relate to better ways of doing things to help you avoid problems:" }, - { "name": "Strict Mode", "description": "These rules relate to strict mode directives:" }, - { "name": "Variables", "description": "These rules relate to variable declarations:" }, - { "name": "Stylistic Issues", "description": "These rules relate to style guidelines, and are therefore quite subjective:" }, - { "name": "ECMAScript 6", "description": "These rules relate to ES6, also known as ES2015:" } + "types": [ + { "name": "problem", "displayName": "Possible Problems", "description": "These rules relate to possible logic errors in code:" }, + { "name": "suggestion", "displayName": "Suggestions", "description": "These rules suggest alternate ways of doing things:" }, + { "name": "layout", "displayName": "Layout & Formatting", "description": "These rules care about how the code looks rather than how it executes:" } ], "deprecated": { "name": "Deprecated", diff --git a/tools/node_modules/eslint/lib/api.js b/tools/node_modules/eslint/lib/api.js index e4b6643b44..3dde098550 100644 --- a/tools/node_modules/eslint/lib/api.js +++ b/tools/node_modules/eslint/lib/api.js @@ -5,30 +5,22 @@ "use strict"; -const { CLIEngine } = require("./cli-engine"); +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + const { ESLint } = require("./eslint"); const { Linter } = require("./linter"); const { RuleTester } = require("./rule-tester"); const { SourceCode } = require("./source-code"); +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + module.exports = { Linter, - CLIEngine, ESLint, RuleTester, SourceCode }; - -// DOTO: remove deprecated API. -let deprecatedLinterInstance = null; - -Object.defineProperty(module.exports, "linter", { - enumerable: false, - get() { - if (!deprecatedLinterInstance) { - deprecatedLinterInstance = new Linter(); - } - - return deprecatedLinterInstance; - } -}); diff --git a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js index 24f6a10d14..aae71607d2 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -41,7 +41,7 @@ const hash = require("./hash"); const LintResultCache = require("./lint-result-cache"); const debug = require("debug")("eslint:cli-engine"); -const validFixTypes = new Set(["problem", "suggestion", "layout"]); +const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]); //------------------------------------------------------------------------------ // Typedefs @@ -55,8 +55,8 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]); /** @typedef {import("../shared/types").Plugin} Plugin */ /** @typedef {import("../shared/types").RuleConf} RuleConf */ /** @typedef {import("../shared/types").Rule} Rule */ -/** @typedef {ReturnType} ConfigArray */ -/** @typedef {ReturnType} ExtractedConfig */ +/** @typedef {ReturnType} ConfigArray */ +/** @typedef {ReturnType} ExtractedConfig */ /** * The options to configure a CLI engine with. @@ -280,7 +280,7 @@ function verifyText({ /** * Returns result with warning by ignore settings * @param {string} filePath File path of checked code - * @param {string} baseDir Absolute path of base directory + * @param {string} baseDir Absolute path of base directory * @returns {LintResult} Result with single warning * @private */ @@ -331,6 +331,23 @@ function getRule(ruleId, configArrays) { return builtInRules.get(ruleId) || null; } +/** + * Checks whether a message's rule type should be fixed. + * @param {LintMessage} message The message to check. + * @param {ConfigArray[]} lastConfigArrays The list of config arrays that the last `executeOnFiles` or `executeOnText` used. + * @param {string[]} fixTypes An array of fix types to check. + * @returns {boolean} Whether the message should be fixed. + */ +function shouldMessageBeFixed(message, lastConfigArrays, fixTypes) { + if (!message.ruleId) { + return fixTypes.has("directive"); + } + + const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays); + + return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type)); +} + /** * Collect used deprecated rules. * @param {ConfigArray[]} usedConfigArrays The config arrays which were used. @@ -463,6 +480,7 @@ function getCacheFile(cacheFile, cwd) { * @param {string[]|null} keys The keys to assign true. * @param {boolean} defaultValue The default value for each property. * @param {string} displayName The property name which is used in error message. + * @throws {Error} Requires array. * @returns {Record} The boolean map. */ function toBooleanMap(keys, defaultValue, displayName) { @@ -526,6 +544,7 @@ function createConfigDataFromOptions(options) { /** * Checks whether a directory exists at the given location * @param {string} resolvedPath A path from the CWD + * @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`. * @returns {boolean} `true` if a directory exists */ function directoryExists(resolvedPath) { @@ -543,6 +562,9 @@ function directoryExists(resolvedPath) { // Public Interface //------------------------------------------------------------------------------ +/** + * Core CLI. + */ class CLIEngine { /** @@ -623,12 +645,7 @@ class CLIEngine { const originalFix = (typeof options.fix === "function") ? options.fix : () => true; - options.fix = message => { - const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays); - const matches = rule && rule.meta && fixTypes.has(rule.meta.type); - - return matches && originalFix(message); - }; + options.fix = message => shouldMessageBeFixed(message, lastConfigArrays, fixTypes) && originalFix(message); } } @@ -730,6 +747,7 @@ class CLIEngine { /** * Executes the current configuration on an array of file and directory names. * @param {string[]} patterns An array of file and directory names. + * @throws {Error} As may be thrown by `fs.unlinkSync`. * @returns {LintReport} The results for all files that were linted. */ executeOnFiles(patterns) { @@ -936,6 +954,7 @@ class CLIEngine { * This is the same logic used by the ESLint CLI executable to determine * configuration for each file it processes. * @param {string} filePath The path of the file to retrieve a config object for. + * @throws {Error} If filepath a directory path. * @returns {ConfigData} A configuration object for the file. */ getConfigForFile(filePath) { @@ -984,6 +1003,7 @@ class CLIEngine { * Returns the formatter representing the given format or null if the `format` is not a string. * @param {string} [format] The name of the format to load or the path to a * custom formatter. + * @throws {any} As may be thrown by requiring of formatter * @returns {(Function|null)} The formatter function or null if the `format` is not a string. */ getFormatter(format) { @@ -1019,7 +1039,11 @@ class CLIEngine { try { return require(formatterPath); } catch (ex) { - ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; + if (format === "table" || format === "codeframe") { + ex.message = `The ${format} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${format}\``; + } else { + ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; + } throw ex; } diff --git a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js index ade28517b4..f1442d150b 100644 --- a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js +++ b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js @@ -60,7 +60,7 @@ const IGNORED_SILENTLY = 1; const IGNORED = 2; // For VSCode intellisense -/** @typedef {ReturnType} ConfigArray */ +/** @typedef {ReturnType} ConfigArray */ /** * @typedef {Object} FileEnumeratorOptions @@ -114,6 +114,7 @@ function isGlobPattern(pattern) { /** * Get stats of a given path. * @param {string} filePath The path to target file. + * @throws {Error} As may be thrown by `fs.statSync`. * @returns {fs.Stats|null} The stats. * @private */ @@ -132,6 +133,7 @@ function statSafeSync(filePath) { /** * Get filenames in a given path to a directory. * @param {string} directoryPath The path to target directory. + * @throws {Error} As may be thrown by `fs.readdirSync`. * @returns {import("fs").Dirent[]} The filenames. * @private */ @@ -173,7 +175,6 @@ function createExtensionRegExp(extensions) { */ class NoFilesFoundError extends Error { - // eslint-disable-next-line jsdoc/require-description /** * @param {string} pattern The glob pattern which was not found. * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled. @@ -190,7 +191,6 @@ class NoFilesFoundError extends Error { */ class AllFilesIgnoredError extends Error { - // eslint-disable-next-line jsdoc/require-description /** * @param {string} pattern The glob pattern which was not found. */ @@ -270,6 +270,7 @@ class FileEnumerator { /** * Iterate files which are matched by given glob patterns. * @param {string|string[]} patternOrPatterns The glob patterns to iterate files. + * @throws {NoFilesFoundError|AllFilesIgnoredError} On an unmatched pattern. * @returns {IterableIterator} The found files. */ *iterateFiles(patternOrPatterns) { diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/codeframe.js b/tools/node_modules/eslint/lib/cli-engine/formatters/codeframe.js deleted file mode 100644 index 41e3ab7b0a..0000000000 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/codeframe.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @fileoverview Codeframe reporter - * @author Vitor Balocco - */ -"use strict"; - -const chalk = require("chalk"); -const { codeFrameColumns } = require("@babel/code-frame"); -const path = require("path"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Given a word and a count, append an s if count is not one. - * @param {string} word A word in its singular form. - * @param {number} count A number controlling whether word should be pluralized. - * @returns {string} The original word with an s on the end if count is not one. - */ -function pluralize(word, count) { - return (count === 1 ? word : `${word}s`); -} - -/** - * Gets a formatted relative file path from an absolute path and a line/column in the file. - * @param {string} filePath The absolute file path to format. - * @param {number} line The line from the file to use for formatting. - * @param {number} column The column from the file to use for formatting. - * @returns {string} The formatted file path. - */ -function formatFilePath(filePath, line, column) { - let relPath = path.relative(process.cwd(), filePath); - - if (line && column) { - relPath += `:${line}:${column}`; - } - - return chalk.green(relPath); -} - -/** - * Gets the formatted output for a given message. - * @param {Object} message The object that represents this message. - * @param {Object} parentResult The result object that this message belongs to. - * @returns {string} The formatted output. - */ -function formatMessage(message, parentResult) { - const type = (message.fatal || message.severity === 2) ? chalk.red("error") : chalk.yellow("warning"); - const msg = `${chalk.bold(message.message.replace(/([^ ])\.$/u, "$1"))}`; - const ruleId = message.fatal ? "" : chalk.dim(`(${message.ruleId})`); - const filePath = formatFilePath(parentResult.filePath, message.line, message.column); - const sourceCode = parentResult.output ? parentResult.output : parentResult.source; - - const firstLine = [ - `${type}:`, - `${msg}`, - ruleId ? `${ruleId}` : "", - sourceCode ? `at ${filePath}:` : `at ${filePath}` - ].filter(String).join(" "); - - const result = [firstLine]; - - if (sourceCode) { - result.push( - codeFrameColumns(sourceCode, { start: { line: message.line, column: message.column } }, { highlightCode: false }) - ); - } - - return result.join("\n"); -} - -/** - * Gets the formatted output summary for a given number of errors and warnings. - * @param {number} errors The number of errors. - * @param {number} warnings The number of warnings. - * @param {number} fixableErrors The number of fixable errors. - * @param {number} fixableWarnings The number of fixable warnings. - * @returns {string} The formatted output summary. - */ -function formatSummary(errors, warnings, fixableErrors, fixableWarnings) { - const summaryColor = errors > 0 ? "red" : "yellow"; - const summary = []; - const fixablesSummary = []; - - if (errors > 0) { - summary.push(`${errors} ${pluralize("error", errors)}`); - } - - if (warnings > 0) { - summary.push(`${warnings} ${pluralize("warning", warnings)}`); - } - - if (fixableErrors > 0) { - fixablesSummary.push(`${fixableErrors} ${pluralize("error", fixableErrors)}`); - } - - if (fixableWarnings > 0) { - fixablesSummary.push(`${fixableWarnings} ${pluralize("warning", fixableWarnings)}`); - } - - let output = chalk[summaryColor].bold(`${summary.join(" and ")} found.`); - - if (fixableErrors || fixableWarnings) { - output += chalk[summaryColor].bold(`\n${fixablesSummary.join(" and ")} potentially fixable with the \`--fix\` option.`); - } - - return output; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - let errors = 0; - let warnings = 0; - let fixableErrors = 0; - let fixableWarnings = 0; - - const resultsWithMessages = results.filter(result => result.messages.length > 0); - - let output = resultsWithMessages.reduce((resultsOutput, result) => { - const messages = result.messages.map(message => `${formatMessage(message, result)}\n\n`); - - errors += result.errorCount; - warnings += result.warningCount; - fixableErrors += result.fixableErrorCount; - fixableWarnings += result.fixableWarningCount; - - return resultsOutput.concat(messages); - }, []).join("\n"); - - output += "\n"; - output += formatSummary(errors, warnings, fixableErrors, fixableWarnings); - - return (errors + warnings) > 0 ? output : ""; -}; diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/html.js b/tools/node_modules/eslint/lib/cli-engine/formatters/html.js index baddb63079..e28996f6cd 100644 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/html.js +++ b/tools/node_modules/eslint/lib/cli-engine/formatters/html.js @@ -281,8 +281,8 @@ function resultTemplate(it) { `.trimLeft(); } -// eslint-disable-next-line jsdoc/require-description /** + * Render the results. * @param {Array} results Test results. * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. * @returns {string} HTML string describing the results. diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/table.js b/tools/node_modules/eslint/lib/cli-engine/formatters/table.js deleted file mode 100644 index a74cce0d51..0000000000 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/table.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @fileoverview "table reporter. - * @author Gajus Kuizinas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const chalk = require("chalk"), - table = require("table").table; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Given a word and a count, append an "s" if count is not one. - * @param {string} word A word. - * @param {number} count Quantity. - * @returns {string} The original word with an s on the end if count is not one. - */ -function pluralize(word, count) { - return (count === 1 ? word : `${word}s`); -} - -/** - * Draws text table. - * @param {Array} messages Error messages relating to a specific file. - * @returns {string} A text table. - */ -function drawTable(messages) { - const rows = []; - - if (messages.length === 0) { - return ""; - } - - rows.push([ - chalk.bold("Line"), - chalk.bold("Column"), - chalk.bold("Type"), - chalk.bold("Message"), - chalk.bold("Rule ID") - ]); - - messages.forEach(message => { - let messageType; - - if (message.fatal || message.severity === 2) { - messageType = chalk.red("error"); - } else { - messageType = chalk.yellow("warning"); - } - - rows.push([ - message.line || 0, - message.column || 0, - messageType, - message.message, - message.ruleId || "" - ]); - }); - - return table(rows, { - columns: { - 0: { - width: 8, - wrapWord: true - }, - 1: { - width: 8, - wrapWord: true - }, - 2: { - width: 8, - wrapWord: true - }, - 3: { - paddingRight: 5, - width: 50, - wrapWord: true - }, - 4: { - width: 20, - wrapWord: true - } - }, - drawHorizontalLine(index) { - return index === 1; - } - }); -} - -/** - * Draws a report (multiple tables). - * @param {Array} results Report results for every file. - * @returns {string} A column of text tables. - */ -function drawReport(results) { - let files; - - files = results.map(result => { - if (!result.messages.length) { - return ""; - } - - return `\n${result.filePath}\n\n${drawTable(result.messages)}`; - }); - - files = files.filter(content => content.trim()); - - return files.join(""); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(report) { - let result, - errorCount, - warningCount; - - result = ""; - errorCount = 0; - warningCount = 0; - - report.forEach(fileReport => { - errorCount += fileReport.errorCount; - warningCount += fileReport.warningCount; - }); - - if (errorCount || warningCount) { - result = drawReport(report); - } - - result += `\n${table([ - [ - chalk.red(pluralize(`${errorCount} Error`, errorCount)) - ], - [ - chalk.yellow(pluralize(`${warningCount} Warning`, warningCount)) - ] - ], { - columns: { - 0: { - width: 110, - wrapWord: true - } - }, - drawHorizontalLine() { - return true; - } - })}`; - - return result; -}; diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/tap.js b/tools/node_modules/eslint/lib/cli-engine/formatters/tap.js index 354872a0c9..e4148a3b39 100644 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/tap.js +++ b/tools/node_modules/eslint/lib/cli-engine/formatters/tap.js @@ -31,7 +31,7 @@ function outputDiagnostics(diagnostic) { const prefix = " "; let output = `${prefix}---\n`; - output += prefix + yaml.safeDump(diagnostic).split("\n").join(`\n${prefix}`); + output += prefix + yaml.dump(diagnostic).split("\n").join(`\n${prefix}`); output += "...\n"; return output; } diff --git a/tools/node_modules/eslint/lib/cli-engine/hash.js b/tools/node_modules/eslint/lib/cli-engine/hash.js index 6d7ef8bf1b..8e467734a0 100644 --- a/tools/node_modules/eslint/lib/cli-engine/hash.js +++ b/tools/node_modules/eslint/lib/cli-engine/hash.js @@ -21,8 +21,8 @@ const murmur = require("imurmurhash"); /** * hash the given string - * @param {string} str the string to hash - * @returns {string} the hash + * @param {string} str the string to hash + * @returns {string} the hash */ function hash(str) { return murmur(str).result().toString(36); diff --git a/tools/node_modules/eslint/lib/cli-engine/xml-escape.js b/tools/node_modules/eslint/lib/cli-engine/xml-escape.js index 175c2c0c2d..2e52dbaac0 100644 --- a/tools/node_modules/eslint/lib/cli-engine/xml-escape.js +++ b/tools/node_modules/eslint/lib/cli-engine/xml-escape.js @@ -15,7 +15,7 @@ * @private */ module.exports = function(s) { - return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex + return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex -- Converting controls to entities switch (c) { case "<": return "<"; diff --git a/tools/node_modules/eslint/lib/config/flat-config-array.js b/tools/node_modules/eslint/lib/config/flat-config-array.js index ecf396a331..ef9cb33ca2 100644 --- a/tools/node_modules/eslint/lib/config/flat-config-array.js +++ b/tools/node_modules/eslint/lib/config/flat-config-array.js @@ -61,7 +61,7 @@ class FlatConfigArray extends ConfigArray { this.unshift(baseConfig); } - /* eslint-disable class-methods-use-this */ + /* eslint-disable class-methods-use-this -- Desired as instance method */ /** * Replaces a config with another config to allow us to put strings * in the config array that will be replaced by objects before @@ -118,7 +118,7 @@ class FlatConfigArray extends ConfigArray { return config; } - /* eslint-enable class-methods-use-this */ + /* eslint-enable class-methods-use-this -- Desired as instance method */ } diff --git a/tools/node_modules/eslint/lib/config/flat-config-schema.js b/tools/node_modules/eslint/lib/config/flat-config-schema.js index 8078547613..c8cc711494 100644 --- a/tools/node_modules/eslint/lib/config/flat-config-schema.js +++ b/tools/node_modules/eslint/lib/config/flat-config-schema.js @@ -336,7 +336,7 @@ const rulesSchema = { // avoid hairy edge case if (ruleId === "__proto__") { - /* eslint-disable-next-line no-proto */ + /* eslint-disable-next-line no-proto -- Though deprecated, may still be present */ delete result.__proto__; continue; } diff --git a/tools/node_modules/eslint/lib/config/rule-validator.js b/tools/node_modules/eslint/lib/config/rule-validator.js index f162dd81a0..527a56e179 100644 --- a/tools/node_modules/eslint/lib/config/rule-validator.js +++ b/tools/node_modules/eslint/lib/config/rule-validator.js @@ -19,6 +19,7 @@ const ajv = require("../shared/ajv")(); * Finds a rule with the given ID in the given config. * @param {string} ruleId The ID of the rule to find. * @param {Object} config The config to search in. + * @throws {TypeError} For missing plugin or rule. * @returns {{create: Function, schema: (Array|null)}} THe rule object. */ function findRuleDefinition(ruleId, config) { @@ -34,16 +35,33 @@ function findRuleDefinition(ruleId, config) { pluginName = ruleIdParts.join("/"); } - if (!config.plugins || !config.plugins[pluginName]) { - throw new TypeError(`Key "rules": Key "${ruleId}": Could not find plugin "${pluginName}".`); + const errorMessageHeader = `Key "rules": Key "${ruleId}"`; + let errorMessage = `${errorMessageHeader}: Could not find plugin "${pluginName}".`; + + // if the plugin exists then we need to check if the rule exists + if (config.plugins && config.plugins[pluginName]) { + + const plugin = config.plugins[pluginName]; + + // first check for exact rule match + if (plugin.rules && plugin.rules[ruleName]) { + return config.plugins[pluginName].rules[ruleName]; + } + + errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`; + + // otherwise, let's see if we can find the rule name elsewhere + for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) { + if (otherPlugin.rules && otherPlugin.rules[ruleName]) { + errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`; + break; + } + } + + // falls through to throw error } - if (!config.plugins[pluginName].rules || !config.plugins[pluginName].rules[ruleName]) { - throw new TypeError(`Key "rules": Key "${ruleId}": Could not find "${ruleName}" in plugin "${pluginName}".`); - } - - return config.plugins[pluginName].rules[ruleName]; - + throw new TypeError(errorMessage); } /** @@ -98,7 +116,6 @@ class RuleValidator { * A collection of compiled validators for rules that have already * been validated. * @type {WeakMap} - * @property validators */ this.validators = new WeakMap(); } diff --git a/tools/node_modules/eslint/lib/eslint/eslint.js b/tools/node_modules/eslint/lib/eslint/eslint.js index 056e04b594..b4a1d028db 100644 --- a/tools/node_modules/eslint/lib/eslint/eslint.js +++ b/tools/node_modules/eslint/lib/eslint/eslint.js @@ -125,7 +125,7 @@ function isArrayOfNonEmptyString(x) { * @returns {boolean} `true` if `x` is valid fix type. */ function isFixType(x) { - return x === "problem" || x === "suggestion" || x === "layout"; + return x === "directive" || x === "problem" || x === "suggestion" || x === "layout"; } /** @@ -151,6 +151,7 @@ class ESLintInvalidOptionsError extends Error { /** * Validates and normalizes options for the wrapped CLIEngine instance. * @param {ESLintOptions} options The options to process. + * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors. * @returns {ESLintOptions} The normalized options. */ function processOptions({ @@ -237,7 +238,7 @@ function processOptions({ errors.push("'fix' must be a boolean or a function."); } if (fixTypes !== null && !isFixTypeArray(fixTypes)) { - errors.push("'fixTypes' must be an array of any of \"problem\", \"suggestion\", and \"layout\"."); + errors.push("'fixTypes' must be an array of any of \"directive\", \"problem\", \"suggestion\", and \"layout\"."); } if (typeof globInputPaths !== "boolean") { errors.push("'globInputPaths' must be a boolean."); @@ -421,6 +422,9 @@ function compareResultsByFilePath(a, b) { return 0; } +/** + * Main API. + */ class ESLint { /** diff --git a/tools/node_modules/eslint/lib/init/autoconfig.js b/tools/node_modules/eslint/lib/init/autoconfig.js index 054c538496..ea2523421c 100644 --- a/tools/node_modules/eslint/lib/init/autoconfig.js +++ b/tools/node_modules/eslint/lib/init/autoconfig.js @@ -11,7 +11,11 @@ const equal = require("fast-deep-equal"), recConfig = require("../../conf/eslint-recommended"), - ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"), + { + Legacy: { + ConfigOps + } + } = require("@eslint/eslintrc"), { Linter } = require("../linter"), configRule = require("./config-rule"); @@ -32,9 +36,9 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only /** * Information about a rule configuration, in the context of a Registry. * @typedef {Object} registryItem - * @param {ruleConfig} config A valid configuration for the rule - * @param {number} specificity The number of elements in the ruleConfig array - * @param {number} errorCount The number of errors encountered when linting with the config + * @property {ruleConfig} config A valid configuration for the rule + * @property {number} specificity The number of elements in the ruleConfig array + * @property {number} errorCount The number of errors encountered when linting with the config */ /** @@ -45,8 +49,8 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only /** * Create registryItems for rules - * @param {rulesConfig} rulesConfig Hash of rule names and arrays of ruleConfig items - * @returns {Object} registryItems for each rule in provided rulesConfig + * @param {rulesConfig} rulesConfig Hash of rule names and arrays of ruleConfig items + * @returns {Object} registryItems for each rule in provided rulesConfig */ function makeRegistryItems(rulesConfig) { return Object.keys(rulesConfig).reduce((accumulator, ruleId) => { @@ -69,7 +73,6 @@ function makeRegistryItems(rulesConfig) { */ class Registry { - // eslint-disable-next-line jsdoc/require-description /** * @param {rulesConfig} [rulesConfig] Hash of rule names and arrays of possible configurations */ @@ -100,7 +103,7 @@ class Registry { * configurations. * * The length of the returned array will be <= MAX_CONFIG_COMBINATIONS. - * @returns {Object[]} "rules" configurations to use for linting + * @returns {Object[]} "rules" configurations to use for linting */ buildRuleSets() { let idx = 0; @@ -112,7 +115,7 @@ class Registry { * * This is broken out into its own function so that it doesn't need to be * created inside of the while loop. - * @param {string} rule The ruleId to add. + * @param {string} rule The ruleId to add. * @returns {void} */ const addRuleToRuleSet = function(rule) { @@ -199,7 +202,7 @@ class Registry { * Creates a registry of rules which had no error-free configs. * The new registry is intended to be analyzed to determine whether its rules * should be disabled or set to warning. - * @returns {Registry} A registry of failing rules. + * @returns {Registry} A registry of failing rules. */ getFailingRulesRegistry() { const ruleIds = Object.keys(this.rules), @@ -236,8 +239,8 @@ class Registry { /** * Return a cloned registry containing only configs with a desired specificity - * @param {number} specificity Only keep configs with this specificity - * @returns {Registry} A registry of rules + * @param {number} specificity Only keep configs with this specificity + * @returns {Registry} A registry of rules */ filterBySpecificity(specificity) { const ruleIds = Object.keys(this.rules), @@ -253,10 +256,10 @@ class Registry { /** * Lint SourceCodes against all configurations in the registry, and record results - * @param {Object[]} sourceCodes SourceCode objects for each filename - * @param {Object} config ESLint config object - * @param {progressCallback} [cb] Optional callback for reporting execution status - * @returns {Registry} New registry with errorCount populated + * @param {Object[]} sourceCodes SourceCode objects for each filename + * @param {Object} config ESLint config object + * @param {progressCallback} [cb] Optional callback for reporting execution status + * @returns {Registry} New registry with errorCount populated */ lintSourceCode(sourceCodes, config, cb) { let lintedRegistry = new Registry(); @@ -301,7 +304,7 @@ class Registry { ruleSetIdx += 1; if (cb) { - cb(totalFilesLinting); // eslint-disable-line node/callback-return + cb(totalFilesLinting); // eslint-disable-line node/callback-return -- End of function } }); @@ -318,8 +321,8 @@ class Registry { * * This will return a new config with `["extends": [ ..., "eslint:recommended"]` and * only the rules which have configurations different from the recommended config. - * @param {Object} config config object - * @returns {Object} config object using `"extends": ["eslint:recommended"]` + * @param {Object} config config object + * @returns {Object} config object using `"extends": ["eslint:recommended"]` */ function extendFromRecommended(config) { const newConfig = Object.assign({}, config); diff --git a/tools/node_modules/eslint/lib/init/config-file.js b/tools/node_modules/eslint/lib/init/config-file.js index 4c648ac055..9eb10fab3a 100644 --- a/tools/node_modules/eslint/lib/init/config-file.js +++ b/tools/node_modules/eslint/lib/init/config-file.js @@ -23,9 +23,9 @@ const debug = require("debug")("eslint:config-file"); * Determines sort order for object keys for json-stable-stringify * * see: https://github.com/samn/json-stable-stringify#cmp - * @param {Object} a The first comparison object ({key: akey, value: avalue}) - * @param {Object} b The second comparison object ({key: bkey, value: bvalue}) - * @returns {number} 1 or -1, used in stringify cmp method + * @param {Object} a The first comparison object ({key: akey, value: avalue}) + * @param {Object} b The second comparison object ({key: bkey, value: bvalue}) + * @returns {number} 1 or -1, used in stringify cmp method */ function sortByKey(a, b) { return a.key > b.key ? 1 : -1; @@ -63,7 +63,7 @@ function writeYAMLConfigFile(config, filePath) { // lazy load YAML to improve performance when not used const yaml = require("js-yaml"); - const content = yaml.safeDump(config, { sortKeys: true }); + const content = yaml.dump(config, { sortKeys: true }); fs.writeFileSync(filePath, content, "utf8"); } diff --git a/tools/node_modules/eslint/lib/init/config-initializer.js b/tools/node_modules/eslint/lib/init/config-initializer.js index 3c7f2ba094..3c244b7bcc 100644 --- a/tools/node_modules/eslint/lib/init/config-initializer.js +++ b/tools/node_modules/eslint/lib/init/config-initializer.js @@ -18,9 +18,13 @@ const util = require("util"), semver = require("semver"), espree = require("espree"), recConfig = require("../../conf/eslint-recommended"), - ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"), + { + Legacy: { + ConfigOps, + naming + } + } = require("@eslint/eslintrc"), log = require("../shared/logging"), - naming = require("@eslint/eslintrc/lib/shared/naming"), ModuleResolver = require("../shared/relative-module-resolver"), autoconfig = require("./autoconfig.js"), ConfigFile = require("./config-file"), @@ -98,8 +102,8 @@ getPeerDependencies.cache = new Map(); /** * Return necessary plugins, configs, parsers, etc. based on the config - * @param {Object} config config object - * @param {boolean} [installESLint=true] If `false` is given, it does not install eslint. + * @param {Object} config config object + * @param {boolean} [installESLint=true] If `false` is given, it does not install eslint. * @returns {string[]} An array of modules to be installed. */ function getModulesList(config, installESLint) { @@ -157,9 +161,10 @@ function getModulesList(config, installESLint) { * * Note: This clones the config object and returns a new config to avoid mutating * the original config parameter. - * @param {Object} answers answers received from enquirer - * @param {Object} config config object - * @returns {Object} config object with configured rules + * @param {Object} answers answers received from enquirer + * @param {Object} config config object + * @throws {Error} If source code retrieval fails or source code file count is 0. + * @returns {Object} config object with configured rules */ function configureRules(answers, config) { const BAR_TOTAL = 20, @@ -411,7 +416,7 @@ function hasESLintVersionConflict(answers) { /** * Install modules. - * @param {string[]} modules Modules to be installed. + * @param {string[]} modules Modules to be installed. * @returns {void} */ function installModules(modules) { @@ -422,9 +427,9 @@ function installModules(modules) { /* istanbul ignore next: no need to test enquirer */ /** * Ask user to install modules. - * @param {string[]} modules Array of modules to be installed. - * @param {boolean} packageJsonExists Indicates if package.json is existed. - * @returns {Promise} Answer that indicates if user wants to install. + * @param {string[]} modules Array of modules to be installed. + * @param {boolean} packageJsonExists Indicates if package.json is existed. + * @returns {Promise} Answer that indicates if user wants to install. */ function askInstallModules(modules, packageJsonExists) { @@ -460,7 +465,7 @@ function askInstallModules(modules, packageJsonExists) { /* istanbul ignore next: no need to test enquirer */ /** * Ask use a few questions on command prompt - * @returns {Promise} The promise with the result of the prompt + * @returns {Promise} The promise with the result of the prompt */ function promptUser() { diff --git a/tools/node_modules/eslint/lib/init/config-rule.js b/tools/node_modules/eslint/lib/init/config-rule.js index 7aec89c3df..131e84a60c 100644 --- a/tools/node_modules/eslint/lib/init/config-rule.js +++ b/tools/node_modules/eslint/lib/init/config-rule.js @@ -17,8 +17,8 @@ const builtInRules = require("../rules"); /** * Wrap all of the elements of an array into arrays. - * @param {*[]} xs Any array. - * @returns {Array[]} An array of arrays. + * @param {*[]} xs Any array. + * @returns {Array[]} An array of arrays. */ function explodeArray(xs) { return xs.reduce((accumulator, x) => { @@ -33,9 +33,9 @@ function explodeArray(xs) { * * For example: * combineArrays([a, [b, c]], [x, y]); // -> [[a, x], [a, y], [b, c, x], [b, c, y]] - * @param {Array} arr1 The first array to combine. - * @param {Array} arr2 The second array to combine. - * @returns {Array} A mixture of the elements of the first and second arrays. + * @param {Array} arr1 The first array to combine. + * @param {Array} arr2 The second array to combine. + * @returns {Array} A mixture of the elements of the first and second arrays. */ function combineArrays(arr1, arr2) { const res = []; @@ -70,8 +70,8 @@ function combineArrays(arr1, arr2) { * [{before: true}, {before: false}], * [{after: true}, {after: false}] * ] - * @param {Object[]} objects Array of objects, each with one property/value pair - * @returns {Array[]} Array of arrays of objects grouped by property + * @param {Object[]} objects Array of objects, each with one property/value pair + * @returns {Array[]} Array of arrays of objects grouped by property */ function groupByProperty(objects) { const groupedObj = objects.reduce((accumulator, obj) => { @@ -97,7 +97,7 @@ function groupByProperty(objects) { * Configs may also have one or more additional elements to specify rule * configuration or options. * @typedef {Array|number} ruleConfig - * @param {number} 0 The rule's severity (0, 1, 2). + * @param {number} 0 The rule's severity (0, 1, 2). */ /** @@ -131,9 +131,9 @@ function groupByProperty(objects) { * {before: false, after: true}, * {before: false, after: false} * ] - * @param {Object[]} objArr1 Single key/value objects, all with the same key - * @param {Object[]} objArr2 Single key/value objects, all with another key - * @returns {Object[]} Combined objects for each combination of input properties and values + * @param {Object[]} objArr1 Single key/value objects, all with the same key + * @param {Object[]} objArr2 Single key/value objects, all with another key + * @returns {Object[]} Combined objects for each combination of input properties and values */ function combinePropertyObjects(objArr1, objArr2) { const res = []; @@ -174,7 +174,6 @@ function combinePropertyObjects(objArr1, objArr2) { */ class RuleConfigSet { - // eslint-disable-next-line jsdoc/require-description /** * @param {ruleConfig[]} configs Valid rule configurations */ @@ -206,7 +205,7 @@ class RuleConfigSet { /** * Add rule configs from an array of strings (schema enums) - * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"]) + * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"]) * @returns {void} */ addEnums(enums) { @@ -215,7 +214,7 @@ class RuleConfigSet { /** * Add rule configurations from a schema object - * @param {Object} obj Schema item with type === "object" + * @param {Object} obj Schema item with type === "object" * @returns {boolean} true if at least one schema for the object could be generated, false otherwise */ addObject(obj) { @@ -260,8 +259,8 @@ class RuleConfigSet { /** * Generate valid rule configurations based on a schema object - * @param {Object} schema A rule's schema object - * @returns {Array[]} Valid rule configurations + * @param {Object} schema A rule's schema object + * @returns {Array[]} Valid rule configurations */ function generateConfigsFromSchema(schema) { const configSet = new RuleConfigSet(); diff --git a/tools/node_modules/eslint/lib/init/npm-utils.js b/tools/node_modules/eslint/lib/init/npm-utils.js index b91a824b12..4a8efe964f 100644 --- a/tools/node_modules/eslint/lib/init/npm-utils.js +++ b/tools/node_modules/eslint/lib/init/npm-utils.js @@ -21,8 +21,8 @@ const fs = require("fs"), /** * Find the closest package.json file, starting at process.cwd (by default), * and working up to root. - * @param {string} [startDir=process.cwd()] Starting directory - * @returns {string} Absolute path to closest package.json file + * @param {string} [startDir=process.cwd()] Starting directory + * @returns {string} Absolute path to closest package.json file */ function findPackageJson(startDir) { let dir = path.resolve(startDir || process.cwd()); @@ -45,7 +45,7 @@ function findPackageJson(startDir) { /** * Install node modules synchronously and save to devDependencies in package.json - * @param {string|string[]} packages Node module or modules to install + * @param {string|string[]} packages Node module or modules to install * @returns {void} */ function installSyncSaveDev(packages) { @@ -86,12 +86,13 @@ function fetchPeerDependencies(packageName) { /** * Check whether node modules are include in a project's package.json. - * @param {string[]} packages Array of node module names - * @param {Object} opt Options Object - * @param {boolean} opt.dependencies Set to true to check for direct dependencies - * @param {boolean} opt.devDependencies Set to true to check for development dependencies - * @param {boolean} opt.startdir Directory to begin searching from - * @returns {Object} An object whose keys are the module names + * @param {string[]} packages Array of node module names + * @param {Object} opt Options Object + * @param {boolean} opt.dependencies Set to true to check for direct dependencies + * @param {boolean} opt.devDependencies Set to true to check for development dependencies + * @param {boolean} opt.startdir Directory to begin searching from + * @throws {Error} If cannot find valid `package.json` file. + * @returns {Object} An object whose keys are the module names * and values are booleans indicating installation. */ function check(packages, opt) { @@ -133,9 +134,9 @@ function check(packages, opt) { * package.json. * * Convenience wrapper around check(). - * @param {string[]} packages Array of node modules to check. - * @param {string} rootDir The directory containing a package.json - * @returns {Object} An object whose keys are the module names + * @param {string[]} packages Array of node modules to check. + * @param {string} rootDir The directory containing a package.json + * @returns {Object} An object whose keys are the module names * and values are booleans indicating installation. */ function checkDeps(packages, rootDir) { @@ -147,8 +148,8 @@ function checkDeps(packages, rootDir) { * package.json. * * Convenience wrapper around check(). - * @param {string[]} packages Array of node modules to check. - * @returns {Object} An object whose keys are the module names + * @param {string[]} packages Array of node modules to check. + * @returns {Object} An object whose keys are the module names * and values are booleans indicating installation. */ function checkDevDeps(packages) { @@ -157,7 +158,7 @@ function checkDevDeps(packages) { /** * Check whether package.json is found in current path. - * @param {string} [startDir] Starting directory + * @param {string} [startDir] Starting directory * @returns {boolean} Whether a package.json is found in current path. */ function checkPackageJson(startDir) { diff --git a/tools/node_modules/eslint/lib/init/source-code-utils.js b/tools/node_modules/eslint/lib/init/source-code-utils.js index dca6541d1e..08c20e5d56 100644 --- a/tools/node_modules/eslint/lib/init/source-code-utils.js +++ b/tools/node_modules/eslint/lib/init/source-code-utils.js @@ -23,7 +23,7 @@ const { CLIEngine } = require("../cli-engine"); * TODO1: Expose the API that enumerates target files. * TODO2: Extract the creation logic of `SourceCode` from `Linter` class. */ -const { getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); // eslint-disable-line node/no-restricted-require +const { getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); // eslint-disable-line node/no-restricted-require -- Todo const debug = require("debug")("eslint:source-code-utils"); @@ -33,9 +33,10 @@ const debug = require("debug")("eslint:source-code-utils"); /** * Get the SourceCode object for a single file - * @param {string} filename The fully resolved filename to get SourceCode from. - * @param {Object} engine A CLIEngine. - * @returns {Array} Array of the SourceCode object representing the file + * @param {string} filename The fully resolved filename to get SourceCode from. + * @param {Object} engine A CLIEngine. + * @throws {Error} Upon fatal errors from execution. + * @returns {Array} Array of the SourceCode object representing the file * and fatal error message. */ function getSourceCodeOfFile(filename, engine) { @@ -97,7 +98,7 @@ function getSourceCodeOfFiles(patterns, options, callback) { sourceCodes[filename] = sourceCode; } if (callback) { - callback(filenames.length); // eslint-disable-line node/callback-return + callback(filenames.length); // eslint-disable-line node/callback-return -- End of function } }); diff --git a/tools/node_modules/eslint/lib/linter/apply-disable-directives.js b/tools/node_modules/eslint/lib/linter/apply-disable-directives.js index 0ba69ca9cc..e5f2e528ef 100644 --- a/tools/node_modules/eslint/lib/linter/apply-disable-directives.js +++ b/tools/node_modules/eslint/lib/linter/apply-disable-directives.js @@ -5,6 +5,8 @@ "use strict"; +const escapeRegExp = require("escape-string-regexp"); + /** * Compares the locations of two objects in a source file * @param {{line: number, column: number}} itemA The first object @@ -16,6 +18,177 @@ function compareLocations(itemA, itemB) { return itemA.line - itemB.line || itemA.column - itemB.column; } +/** + * Groups a set of directives into sub-arrays by their parent comment. + * @param {Directive[]} directives Unused directives to be removed. + * @returns {Directive[][]} Directives grouped by their parent comment. + */ +function groupByParentComment(directives) { + const groups = new Map(); + + for (const directive of directives) { + const { unprocessedDirective: { parentComment } } = directive; + + if (groups.has(parentComment)) { + groups.get(parentComment).push(directive); + } else { + groups.set(parentComment, [directive]); + } + } + + return [...groups.values()]; +} + +/** + * Creates removal details for a set of directives within the same comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, position }[]} Details for later creation of output Problems. + */ +function createIndividualDirectivesRemoval(directives, commentToken) { + + /* + * `commentToken.value` starts right after `//` or `/*`. + * All calculated offsets will be relative to this index. + */ + const commentValueStart = commentToken.range[0] + "//".length; + + // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`) + const listStartOffset = /^\s*\S+\s+/u.exec(commentToken.value)[0].length; + + /* + * Get the list text without any surrounding whitespace. In order to preserve the original + * formatting, we don't want to change that whitespace. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + */ + const listText = commentToken.value + .slice(listStartOffset) // remove directive name and all whitespace before the list + .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists + .trimRight(); // remove all whitespace after the list + + /* + * We can assume that `listText` contains multiple elements. + * Otherwise, this function wouldn't be called - if there is + * only one rule in the list, then the whole comment must be removed. + */ + + return directives.map(directive => { + const { ruleId } = directive; + + const regex = new RegExp(String.raw`(?:^|\s*,\s*)${escapeRegExp(ruleId)}(?:\s*,\s*|$)`, "u"); + const match = regex.exec(listText); + const matchedText = match[0]; + const matchStartOffset = listStartOffset + match.index; + const matchEndOffset = matchStartOffset + matchedText.length; + + const firstIndexOfComma = matchedText.indexOf(","); + const lastIndexOfComma = matchedText.lastIndexOf(","); + + let removalStartOffset, removalEndOffset; + + if (firstIndexOfComma !== lastIndexOfComma) { + + /* + * Since there are two commas, this must one of the elements in the middle of the list. + * Matched range starts where the previous rule name ends, and ends where the next rule name starts. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^ + * + * We want to remove only the content between the two commas, and also one of the commas. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset + firstIndexOfComma; + removalEndOffset = matchStartOffset + lastIndexOfComma; + + } else { + + /* + * This is either the first element or the last element. + * + * If this is the first element, matched range starts where the first rule name starts + * and ends where the second rule name starts. This is exactly the range we want + * to remove so that the second rule name will start where the first one was starting + * and thus preserve the original formatting. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + * + * Similarly, if this is the last element, we've already matched the range we want to + * remove. The previous rule name will end where the last one was ending, relative + * to the content on the right side. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset; + removalEndOffset = matchEndOffset; + } + + return { + description: `'${ruleId}'`, + fix: { + range: [ + commentValueStart + removalStartOffset, + commentValueStart + removalEndOffset + ], + text: "" + }, + position: directive.unprocessedDirective + }; + }); +} + +/** + * Creates a description of deleting an entire unused disable comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, position }} Details for later creation of an output Problem. + */ +function createCommentRemoval(directives, commentToken) { + const { range } = commentToken; + const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`); + + return { + description: ruleIds.length <= 2 + ? ruleIds.join(" or ") + : `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds[ruleIds.length - 1]}`, + fix: { + range, + text: " " + }, + position: directives[0].unprocessedDirective + }; +} + +/** + * Parses details from directives to create output Problems. + * @param {Directive[]} allDirectives Unused directives to be removed. + * @returns {{ description, fix, position }[]} Details for later creation of output Problems. + */ +function processUnusedDisableDirectives(allDirectives) { + const directiveGroups = groupByParentComment(allDirectives); + + return directiveGroups.flatMap( + directives => { + const { parentComment } = directives[0].unprocessedDirective; + const remainingRuleIds = new Set(parentComment.ruleIds); + + for (const directive of directives) { + remainingRuleIds.delete(directive.ruleId); + } + + return remainingRuleIds.size + ? createIndividualDirectivesRemoval(directives, parentComment.commentToken) + : [createCommentRemoval(directives, parentComment.commentToken)]; + } + ); +} + /** * This is the same as the exported function, except that it * doesn't handle disable-line and disable-next-line directives, and it always reports unused @@ -82,17 +255,22 @@ function applyDirectives(options) { } } - const unusedDisableDirectives = options.directives - .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)) - .map(directive => ({ + const unusedDisableDirectivesToReport = options.directives + .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)); + + const processed = processUnusedDisableDirectives(unusedDisableDirectivesToReport); + + const unusedDisableDirectives = processed + .map(({ description, fix, position }) => ({ ruleId: null, - message: directive.ruleId - ? `Unused eslint-disable directive (no problems were reported from '${directive.ruleId}').` + message: description + ? `Unused eslint-disable directive (no problems were reported from ${description}).` : "Unused eslint-disable directive (no problems were reported).", - line: directive.unprocessedDirective.line, - column: directive.unprocessedDirective.column, + line: position.line, + column: position.column, severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, - nodeType: null + nodeType: null, + ...options.disableFixes ? {} : { fix } })); return { problems, unusedDisableDirectives }; @@ -113,30 +291,17 @@ function applyDirectives(options) { * @param {{ruleId: (string|null), line: number, column: number}[]} options.problems * A list of problems reported by rules, sorted by increasing location in the file, with one-based columns. * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives + * @param {boolean} options.disableFixes If true, it doesn't make `fix` properties. * @returns {{ruleId: (string|null), line: number, column: number}[]} * A list of reported problems that were not disabled by the directive comments. */ -module.exports = ({ directives, problems, reportUnusedDisableDirectives = "off" }) => { +module.exports = ({ directives, disableFixes, problems, reportUnusedDisableDirectives = "off" }) => { const blockDirectives = directives .filter(directive => directive.type === "disable" || directive.type === "enable") .map(directive => Object.assign({}, directive, { unprocessedDirective: directive })) .sort(compareLocations); - /** - * Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. - * TODO(stephenwade): Replace this with array.flatMap when we drop support for Node v10 - * @param {any[]} array The array to process - * @param {Function} fn The function to use - * @returns {any[]} The result array - */ - function flatMap(array, fn) { - const mapped = array.map(fn); - const flattened = [].concat(...mapped); - - return flattened; - } - - const lineDirectives = flatMap(directives, directive => { + const lineDirectives = directives.flatMap(directive => { switch (directive.type) { case "disable": case "enable": @@ -162,11 +327,13 @@ module.exports = ({ directives, problems, reportUnusedDisableDirectives = "off" const blockDirectivesResult = applyDirectives({ problems, directives: blockDirectives, + disableFixes, reportUnusedDisableDirectives }); const lineDirectivesResult = applyDirectives({ problems: blockDirectivesResult.problems, directives: lineDirectives, + disableFixes, reportUnusedDisableDirectives }); diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js index 47427c11a3..d66c2f1be3 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js @@ -29,6 +29,18 @@ function isCaseNode(node) { return Boolean(node.test); } +/** + * Checks if a given node appears as the value of a PropertyDefinition node. + * @param {ASTNode} node THe node to check. + * @returns {boolean} `true` if the node is a PropertyDefinition value, + * false if not. + */ +function isPropertyDefinitionValue(node) { + const parent = node.parent; + + return parent && parent.type === "PropertyDefinition" && parent.value === node; +} + /** * Checks whether the given logical operator is taken into account for the code * path analysis. @@ -138,6 +150,7 @@ function isIdentifierReference(node) { return parent.id !== node; case "Property": + case "PropertyDefinition": case "MethodDefinition": return ( parent.key !== node || @@ -388,29 +401,64 @@ function processCodePathToEnter(analyzer, node) { let state = codePath && CodePath.getState(codePath); const parent = node.parent; + /** + * Creates a new code path and trigger the onCodePathStart event + * based on the currently selected node. + * @param {string} origin The reason the code path was started. + * @returns {void} + */ + function startCodePath(origin) { + if (codePath) { + + // Emits onCodePathSegmentStart events if updated. + forwardCurrentToHead(analyzer, node); + debug.dumpState(node, state, false); + } + + // Create the code path of this scope. + codePath = analyzer.codePath = new CodePath({ + id: analyzer.idGenerator.next(), + origin, + upper: codePath, + onLooped: analyzer.onLooped + }); + state = CodePath.getState(codePath); + + // Emits onCodePathStart events. + debug.dump(`onCodePathStart ${codePath.id}`); + analyzer.emitter.emit("onCodePathStart", codePath, node); + } + + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to start a new code path in this + * case. + */ + if (isPropertyDefinitionValue(node)) { + startCodePath("class-field-initializer"); + + /* + * Intentional fall through because `node` needs to also be + * processed by the code below. For example, if we have: + * + * class Foo { + * a = () => {} + * } + * + * In this case, we also need start a second code path. + */ + + } + switch (node.type) { case "Program": + startCodePath("program"); + break; + case "FunctionDeclaration": case "FunctionExpression": case "ArrowFunctionExpression": - if (codePath) { - - // Emits onCodePathSegmentStart events if updated. - forwardCurrentToHead(analyzer, node); - debug.dumpState(node, state, false); - } - - // Create the code path of this scope. - codePath = analyzer.codePath = new CodePath( - analyzer.idGenerator.next(), - codePath, - analyzer.onLooped - ); - state = CodePath.getState(codePath); - - // Emits onCodePathStart events. - debug.dump(`onCodePathStart ${codePath.id}`); - analyzer.emitter.emit("onCodePathStart", codePath, node); + startCodePath("function"); break; case "ChainExpression": @@ -503,6 +551,7 @@ function processCodePathToEnter(analyzer, node) { * @returns {void} */ function processCodePathToExit(analyzer, node) { + const codePath = analyzer.codePath; const state = CodePath.getState(codePath); let dontForward = false; @@ -627,28 +676,38 @@ function processCodePathToExit(analyzer, node) { * @returns {void} */ function postprocess(analyzer, node) { + + /** + * Ends the code path for the current node. + * @returns {void} + */ + function endCodePath() { + let codePath = analyzer.codePath; + + // Mark the current path as the final node. + CodePath.getState(codePath).makeFinal(); + + // Emits onCodePathSegmentEnd event of the current segments. + leaveFromCurrentSegment(analyzer, node); + + // Emits onCodePathEnd event of this code path. + debug.dump(`onCodePathEnd ${codePath.id}`); + analyzer.emitter.emit("onCodePathEnd", codePath, node); + debug.dumpDot(codePath); + + codePath = analyzer.codePath = analyzer.codePath.upper; + if (codePath) { + debug.dumpState(node, CodePath.getState(codePath), true); + } + + } + switch (node.type) { case "Program": case "FunctionDeclaration": case "FunctionExpression": case "ArrowFunctionExpression": { - let codePath = analyzer.codePath; - - // Mark the current path as the final node. - CodePath.getState(codePath).makeFinal(); - - // Emits onCodePathSegmentEnd event of the current segments. - leaveFromCurrentSegment(analyzer, node); - - // Emits onCodePathEnd event of this code path. - debug.dump(`onCodePathEnd ${codePath.id}`); - analyzer.emitter.emit("onCodePathEnd", codePath, node); - debug.dumpDot(codePath); - - codePath = analyzer.codePath = analyzer.codePath.upper; - if (codePath) { - debug.dumpState(node, CodePath.getState(codePath), true); - } + endCodePath(); break; } @@ -662,6 +721,27 @@ function postprocess(analyzer, node) { default: break; } + + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to end a code path in this + * case. + * + * We need to check after the other checks in order to close the + * code paths in the correct order for code like this: + * + * + * class Foo { + * a = () => {} + * } + * + * In this case, The ArrowFunctionExpression code path is closed first + * and then we need to close the code path for the PropertyDefinition + * value. + */ + if (isPropertyDefinitionValue(node)) { + endCodePath(); + } } //------------------------------------------------------------------------------ @@ -674,7 +754,6 @@ function postprocess(analyzer, node) { */ class CodePathAnalyzer { - // eslint-disable-next-line jsdoc/require-description /** * @param {EventGenerator} eventGenerator An event generator to wrap. */ diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js index ca96ad3418..fad559a2ad 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js @@ -33,7 +33,6 @@ function isReachable(segment) { */ class CodePathSegment { - // eslint-disable-next-line jsdoc/require-description /** * @param {string} id An identifier. * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js index f75e60e28a..118f70a170 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js @@ -219,7 +219,6 @@ function finalizeTestSegmentsOfFor(context, choiceContext, head) { */ class CodePathState { - // eslint-disable-next-line jsdoc/require-description /** * @param {IdGenerator} idGenerator An id generator to generate id for code * path segments. @@ -360,6 +359,7 @@ class CodePathState { /** * Pops the last choice context and finalizes it. + * @throws {Error} (Unreachable.) * @returns {ChoiceContext} The popped context. */ popChoiceContext() { @@ -450,6 +450,7 @@ class CodePathState { /** * Makes a code path segment of the right-hand operand of a logical * expression. + * @throws {Error} (Unreachable.) * @returns {void} */ makeLogicalRight() { @@ -965,6 +966,7 @@ class CodePathState { * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, * and `ForStatement`. * @param {string|null} label A label of the node which was triggered. + * @throws {Error} (Unreachable - unknown type.) * @returns {void} */ pushLoopContext(type, label) { @@ -1036,6 +1038,7 @@ class CodePathState { /** * Pops the last context of a loop statement and finalizes it. + * @throws {Error} (Unreachable - unknown type.) * @returns {void} */ popLoopContext() { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js index 49b37c6b22..f225c09a1d 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js @@ -21,13 +21,15 @@ const IdGenerator = require("./id-generator"); */ class CodePath { - // eslint-disable-next-line jsdoc/require-description /** - * @param {string} id An identifier. - * @param {CodePath|null} upper The code path of the upper function scope. - * @param {Function} onLooped A callback function to notify looping. + * Creates a new instance. + * @param {Object} options Options for the function (see below). + * @param {string} options.id An identifier. + * @param {string} options.origin The type of code path origin. + * @param {CodePath|null} options.upper The code path of the upper function scope. + * @param {Function} options.onLooped A callback function to notify looping. */ - constructor(id, upper, onLooped) { + constructor({ id, origin, upper, onLooped }) { /** * The identifier of this code path. @@ -36,6 +38,13 @@ class CodePath { */ this.id = id; + /** + * The reason that this code path was started. May be "program", + * "function", or "class-field-initializer". + * @type {string} + */ + this.origin = origin; + /** * The code path of the upper function scope. * @type {CodePath|null} diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js index a4cb99a22e..ca64862db3 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js @@ -21,7 +21,7 @@ const debug = require("debug")("eslint:code-path"); * @returns {string} Id of the segment. */ /* istanbul ignore next */ -function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc +function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc -- Ignoring return segment.id + (segment.reachable ? "" : "!"); } @@ -115,7 +115,7 @@ module.exports = { const traceMap = Object.create(null); const arrows = this.makeDotArrows(codePath, traceMap); - for (const id in traceMap) { // eslint-disable-line guard-for-in + for (const id in traceMap) { // eslint-disable-line guard-for-in -- Want ability to traverse prototype const segment = traceMap[id]; text += `${id}[`; diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js index 2e872b5c0d..04c59b5e41 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js @@ -97,7 +97,6 @@ function mergeExtraSegments(context, segments) { */ class ForkContext { - // eslint-disable-next-line jsdoc/require-description /** * @param {IdGenerator} idGenerator An identifier generator for segments. * @param {ForkContext|null} upper An upper fork context. diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js index 4cb2e0e3d8..83787a4ea5 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js @@ -18,7 +18,6 @@ */ class IdGenerator { - // eslint-disable-next-line jsdoc/require-description /** * @param {string} prefix Optional. A prefix of generated ids. */ diff --git a/tools/node_modules/eslint/lib/linter/config-comment-parser.js b/tools/node_modules/eslint/lib/linter/config-comment-parser.js index 07bbead281..34675a76b5 100644 --- a/tools/node_modules/eslint/lib/linter/config-comment-parser.js +++ b/tools/node_modules/eslint/lib/linter/config-comment-parser.js @@ -3,7 +3,7 @@ * @author Nicholas C. Zakas */ -/* eslint-disable class-methods-use-this*/ +/* eslint class-methods-use-this: off -- Methods desired on instance */ "use strict"; //------------------------------------------------------------------------------ @@ -11,7 +11,11 @@ //------------------------------------------------------------------------------ const levn = require("levn"), - ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"); + { + Legacy: { + ConfigOps + } + } = require("@eslint/eslintrc/universal"); // eslint-disable-line node/no-missing-require -- false positive const debug = require("debug")("eslint:config-comment-parser"); diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js index 4e80926a89..fab6c26113 100644 --- a/tools/node_modules/eslint/lib/linter/linter.js +++ b/tools/node_modules/eslint/lib/linter/linter.js @@ -16,11 +16,15 @@ const evk = require("eslint-visitor-keys"), espree = require("espree"), merge = require("lodash.merge"), - BuiltInEnvironments = require("@eslint/eslintrc/conf/environments"), pkg = require("../../package.json"), astUtils = require("../shared/ast-utils"), - ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"), - ConfigValidator = require("@eslint/eslintrc/lib/shared/config-validator"), + { + Legacy: { + ConfigOps, + ConfigValidator, + environments: BuiltInEnvironments + } + } = require("@eslint/eslintrc/universal"), // eslint-disable-line node/no-missing-require -- false positive Traverser = require("../shared/traverser"), { SourceCode } = require("../source-code"), CodePathAnalyzer = require("./code-path-analysis/code-path-analyzer"), @@ -46,8 +50,8 @@ const parserSymbol = Symbol.for("eslint.RuleTester.parser"); // Typedefs //------------------------------------------------------------------------------ -/** @typedef {InstanceType} ConfigArray */ -/** @typedef {InstanceType} ExtractedConfig */ +/** @typedef {InstanceType} ConfigArray */ +/** @typedef {InstanceType} ExtractedConfig */ /** @typedef {import("../shared/types").ConfigData} ConfigData */ /** @typedef {import("../shared/types").Environment} Environment */ /** @typedef {import("../shared/types").GlobalConf} GlobalConf */ @@ -56,17 +60,19 @@ const parserSymbol = Symbol.for("eslint.RuleTester.parser"); /** @typedef {import("../shared/types").Processor} Processor */ /** @typedef {import("../shared/types").Rule} Rule */ +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ /** * @template T * @typedef {{ [P in keyof T]-?: T[P] }} Required */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ /** * @typedef {Object} DisableDirective - * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type - * @property {number} line - * @property {number} column - * @property {(string|null)} ruleId + * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type Type of directive + * @property {number} line The line number + * @property {number} column The column number + * @property {(string|null)} ruleId The rule ID */ /** @@ -94,12 +100,12 @@ const parserSymbol = Symbol.for("eslint.RuleTester.parser"); * @typedef {Object} ProcessorOptions * @property {(filename:string, text:string) => boolean} [filterCodeBlock] the * predicate function that selects adopt code blocks. - * @property {Processor["postprocess"]} [postprocess] postprocessor for report + * @property {Processor.postprocess} [postprocess] postprocessor for report * messages. If provided, this should accept an array of the message lists * for each code block returned from the preprocessor, apply a mapping to * the messages as appropriate, and return a one-dimensional array of * messages. - * @property {Processor["preprocess"]} [preprocess] preprocessor for source text. + * @property {Processor.preprocess} [preprocess] preprocessor for source text. * If provided, this should accept a string of source text, and return an * array of code blocks to lint. */ @@ -242,14 +248,14 @@ function createLintingProblem(options) { * Creates a collection of disable directives from a comment * @param {Object} options to create disable directives * @param {("disable"|"enable"|"disable-line"|"disable-next-line")} options.type The type of directive comment - * @param {{line: number, column: number}} options.loc The 0-based location of the comment token + * @param {token} options.commentToken The Comment token * @param {string} options.value The value after the directive in the comment * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`) * @param {function(string): {create: Function}} options.ruleMapper A map from rule IDs to defined rules * @returns {Object} Directives and problems from the comment */ function createDisableDirectives(options) { - const { type, loc, value, ruleMapper } = options; + const { commentToken, type, value, ruleMapper } = options; const ruleIds = Object.keys(commentParser.parseListConfig(value)); const directiveRules = ruleIds.length ? ruleIds : [null]; const result = { @@ -257,13 +263,15 @@ function createDisableDirectives(options) { directiveProblems: [] // problems in directives }; + const parentComment = { commentToken, ruleIds }; + for (const ruleId of directiveRules) { // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) if (ruleId === null || ruleMapper(ruleId) !== null) { - result.directives.push({ type, line: loc.start.line, column: loc.start.column + 1, ruleId }); + result.directives.push({ parentComment, type, line: commentToken.loc.start.line, column: commentToken.loc.start.column + 1, ruleId }); } else { - result.directiveProblems.push(createLintingProblem({ ruleId, loc })); + result.directiveProblems.push(createLintingProblem({ ruleId, loc: commentToken.loc })); } } return result; @@ -344,7 +352,7 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { case "eslint-disable-next-line": case "eslint-disable-line": { const directiveType = directiveText.slice("eslint-".length); - const options = { type: directiveType, loc: comment.loc, value: directiveValue, ruleMapper }; + const options = { commentToken: comment, type: directiveType, value: directiveValue, ruleMapper }; const { directives, directiveProblems } = createDisableDirectives(options); disableDirectives.push(...directives); @@ -452,7 +460,7 @@ function normalizeEcmaVersion(parser, ecmaVersion) { return ecmaVersion >= 2015 ? ecmaVersion - 2009 : ecmaVersion; } -const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gsu; +const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)(?:\*\/|$)/gsu; /** * Checks whether or not there is a comment which has "eslint-env *" in a given text. @@ -465,10 +473,12 @@ function findEslintEnv(text) { eslintEnvPattern.lastIndex = 0; while ((match = eslintEnvPattern.exec(text)) !== null) { - retv = Object.assign( - retv || {}, - commentParser.parseListConfig(stripDirectiveComment(match[1])) - ); + if (match[0].endsWith("*/")) { + retv = Object.assign( + retv || {}, + commentParser.parseListConfig(stripDirectiveComment(match[1])) + ); + } } return retv; @@ -758,6 +768,7 @@ function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) { * Runs a rule, and gets its listeners * @param {Rule} rule A normalized rule with a `create` method * @param {Context} ruleContext The context that should be passed to the rule + * @throws {any} Any error during the rule's `create` * @returns {Object} A map of selector listeners provided by the rule */ function createRuleListeners(rule, ruleContext) { @@ -925,8 +936,16 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser } const problem = reportTranslator(...args); - if (problem.fix && rule.meta && !rule.meta.fixable) { - throw new Error("Fixable rules should export a `meta.fixable` property."); + if (problem.fix && !(rule.meta && rule.meta.fixable)) { + throw new Error("Fixable rules must set the `meta.fixable` property to \"code\" or \"whitespace\"."); + } + if (problem.suggestions && !(rule.meta && rule.meta.hasSuggestions === true)) { + if (rule.meta && rule.meta.docs && typeof rule.meta.docs.suggestion !== "undefined") { + + // Encourage migration from the former property name. + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`. `meta.docs.suggestion` is ignored by ESLint."); + } + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); } lintingProblems.push(problem); } @@ -936,13 +955,31 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser const ruleListeners = createRuleListeners(rule, ruleContext); + /** + * Include `ruleId` in error logs + * @param {Function} ruleListener A rule method that listens for a node. + * @returns {Function} ruleListener wrapped in error handler + */ + function addRuleErrorHandler(ruleListener) { + return function ruleErrorHandler(...listenerArgs) { + try { + return ruleListener(...listenerArgs); + } catch (e) { + e.ruleId = ruleId; + throw e; + } + }; + } + // add all the selectors from the rule as listeners Object.keys(ruleListeners).forEach(selector => { + const ruleListener = timing.enabled + ? timing.time(ruleId, ruleListeners[selector]) + : ruleListeners[selector]; + emitter.on( selector, - timing.enabled - ? timing.time(ruleId, ruleListeners[selector]) - : ruleListeners[selector] + addRuleErrorHandler(ruleListener) ); }); }); @@ -1027,7 +1064,7 @@ function normalizeCwd(cwd) { } // It's more explicit to assign the undefined - // eslint-disable-next-line no-undefined + // eslint-disable-next-line no-undefined -- Consistently returning a value return undefined; } @@ -1050,7 +1087,7 @@ class Linter { /** * Initialize the Linter. * @param {Object} [config] the config object - * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. + * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. */ constructor({ cwd } = {}) { internalSlotsMap.set(this, { @@ -1078,6 +1115,7 @@ class Linter { * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. * @param {ConfigData} providedConfig An ESLintConfig instance to configure everything. * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. + * @throws {Error} If during rule execution. * @returns {LintMessage[]} The results as an array of messages or an empty array if no messages. */ _verifyWithoutProcessors(textOrSourceCode, providedConfig, providedOptions) { @@ -1203,11 +1241,17 @@ class Linter { debug("Parser Options:", parserOptions); debug("Parser Path:", parserName); debug("Settings:", settings); + + if (err.ruleId) { + err.message += `\nRule: "${err.ruleId}"`; + } + throw err; } return applyDisableDirectives({ directives: commentDirectives.disableDirectives, + disableFixes: options.disableFixes, problems: lintingProblems .concat(commentDirectives.problems) .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), @@ -1295,8 +1339,7 @@ class Linter { const text = ensureText(textOrSourceCode); const preprocess = options.preprocess || (rawText => [rawText]); - // TODO(stephenwade): Replace this with array.flat() when we drop support for Node v10 - const postprocess = options.postprocess || (array => [].concat(...array)); + const postprocess = options.postprocess || (messagesList => messagesList.flat()); const filterCodeBlock = options.filterCodeBlock || (blockFilename => blockFilename.endsWith(".js")); diff --git a/tools/node_modules/eslint/lib/linter/node-event-generator.js b/tools/node_modules/eslint/lib/linter/node-event-generator.js index 8b619fdff8..89ebd28104 100644 --- a/tools/node_modules/eslint/lib/linter/node-event-generator.js +++ b/tools/node_modules/eslint/lib/linter/node-event-generator.js @@ -37,9 +37,7 @@ const esquery = require("esquery"); * @returns {any[]} The union of the input arrays */ function union(...arrays) { - - // TODO(stephenwade): Replace this with arrays.flat() when we drop support for Node v10 - return [...new Set([].concat(...arrays))]; + return [...new Set(arrays.flat())]; } /** @@ -239,7 +237,6 @@ function parseSelector(rawSelector) { */ class NodeEventGenerator { - // eslint-disable-next-line jsdoc/require-description /** * @param {SafeEmitter} emitter * An SafeEmitter which is the destination of events. This emitter must already diff --git a/tools/node_modules/eslint/lib/linter/report-translator.js b/tools/node_modules/eslint/lib/linter/report-translator.js index 75005c16e5..781b3136ec 100644 --- a/tools/node_modules/eslint/lib/linter/report-translator.js +++ b/tools/node_modules/eslint/lib/linter/report-translator.js @@ -32,18 +32,18 @@ const interpolate = require("./interpolate"); /** * Information about the report * @typedef {Object} ReportInfo - * @property {string} ruleId - * @property {(0|1|2)} severity - * @property {(string|undefined)} message - * @property {(string|undefined)} [messageId] - * @property {number} line - * @property {number} column - * @property {(number|undefined)} [endLine] - * @property {(number|undefined)} [endColumn] - * @property {(string|null)} nodeType - * @property {string} source - * @property {({text: string, range: (number[]|null)}|null)} [fix] - * @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] + * @property {string} ruleId The rule ID + * @property {(0|1|2)} severity Severity of the error + * @property {(string|undefined)} message The message + * @property {(string|undefined)} [messageId] The message ID + * @property {number} line The line number + * @property {number} column The column number + * @property {(number|undefined)} [endLine] The ending line number + * @property {(number|undefined)} [endColumn] The ending column number + * @property {(string|null)} nodeType Type of node + * @property {string} source Source text + * @property {({text: string, range: (number[]|null)}|null)} [fix] The fix object + * @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] Suggestion info */ //------------------------------------------------------------------------------ diff --git a/tools/node_modules/eslint/lib/linter/rules.js b/tools/node_modules/eslint/lib/linter/rules.js index a153266efb..647bab6878 100644 --- a/tools/node_modules/eslint/lib/linter/rules.js +++ b/tools/node_modules/eslint/lib/linter/rules.js @@ -30,6 +30,9 @@ function normalizeRule(rule) { // Public Interface //------------------------------------------------------------------------------ +/** + * A storage for rules. + */ class Rules { constructor() { this._rules = Object.create(null); diff --git a/tools/node_modules/eslint/lib/linter/safe-emitter.js b/tools/node_modules/eslint/lib/linter/safe-emitter.js index ab212230d3..f4837c1ddc 100644 --- a/tools/node_modules/eslint/lib/linter/safe-emitter.js +++ b/tools/node_modules/eslint/lib/linter/safe-emitter.js @@ -12,8 +12,8 @@ /** * An event emitter * @typedef {Object} SafeEmitter - * @property {function(eventName: string, listenerFunc: Function): void} on Adds a listener for a given event name - * @property {function(eventName: string, arg1?: any, arg2?: any, arg3?: any)} emit Emits an event with a given name. + * @property {(eventName: string, listenerFunc: Function) => void} on Adds a listener for a given event name + * @property {(eventName: string, arg1?: any, arg2?: any, arg3?: any) => void} emit Emits an event with a given name. * This calls all the listeners that were listening for that name, with `arg1`, `arg2`, and `arg3` as arguments. * @property {function(): string[]} eventNames Gets the list of event names that have registered listeners. */ diff --git a/tools/node_modules/eslint/lib/linter/source-code-fixer.js b/tools/node_modules/eslint/lib/linter/source-code-fixer.js index 53dc1dc6be..15386c926c 100644 --- a/tools/node_modules/eslint/lib/linter/source-code-fixer.js +++ b/tools/node_modules/eslint/lib/linter/source-code-fixer.js @@ -80,8 +80,8 @@ SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) { /** * Try to use the 'fix' from a problem. - * @param {Message} problem The message object to apply fixes from - * @returns {boolean} Whether fix was successfully applied + * @param {Message} problem The message object to apply fixes from + * @returns {boolean} Whether fix was successfully applied */ function attemptFix(problem) { const fix = problem.fix; diff --git a/tools/node_modules/eslint/lib/linter/timing.js b/tools/node_modules/eslint/lib/linter/timing.js index 5823030685..c9ab01ec64 100644 --- a/tools/node_modules/eslint/lib/linter/timing.js +++ b/tools/node_modules/eslint/lib/linter/timing.js @@ -116,7 +116,7 @@ function display(data) { return ALIGN[index](":", width + extraAlignment, "-"); }).join("|")); - console.log(table.join("\n")); // eslint-disable-line no-console + console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function } /* istanbul ignore next */ @@ -126,7 +126,7 @@ module.exports = (function() { /** * Time the run - * @param {*} key key from the data object + * @param {any} key key from the data object * @param {Function} fn function to be called * @returns {Function} function to be executed * @private diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js index e3661ec81d..2dd186de3e 100644 --- a/tools/node_modules/eslint/lib/options.js +++ b/tools/node_modules/eslint/lib/options.js @@ -32,7 +32,7 @@ const optionator = require("optionator"); * @property {string[]} [ext] Specify JavaScript file extensions * @property {boolean} fix Automatically fix problems * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system - * @property {("problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (problem, suggestion, layout) + * @property {("directive" | "problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (directive, problem, suggestion, layout) * @property {string} format Use a specific output format * @property {string[]} [global] Define global variables * @property {boolean} [help] Show help @@ -151,7 +151,7 @@ module.exports = optionator({ { option: "fix-type", type: "Array", - description: "Specify the types of fixes to apply (problem, suggestion, layout)" + description: "Specify the types of fixes to apply (directive, problem, suggestion, layout)" }, { heading: "Ignoring files" diff --git a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js index 2b5524923b..324af7b2ca 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -4,7 +4,7 @@ */ "use strict"; -/* global describe, it */ +/* eslint-env mocha -- Mocha wrapper */ /* * This is a wrapper around mocha to allow for DRY unittests for eslint @@ -55,12 +55,15 @@ const ajv = require("../shared/ajv")({ strictDefaults: true }); const espreePath = require.resolve("espree"); const parserSymbol = Symbol.for("eslint.RuleTester.parser"); +const { SourceCode } = require("../source-code"); + //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ /** @typedef {import("../shared/types").Parser} Parser */ +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ /** * A test case that is expected to pass lint. * @typedef {Object} ValidTestCase @@ -103,6 +106,7 @@ const parserSymbol = Symbol.for("eslint.RuleTester.parser"); * @property {number} [endLine] The 1-based line number of the reported end location. * @property {number} [endColumn] The 1-based column number of the reported end location. */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ //------------------------------------------------------------------------------ // Private Members @@ -210,7 +214,7 @@ function freezeDeeply(x) { */ function sanitize(text) { return text.replace( - /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex + /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex -- Escaping controls c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` ); } @@ -284,6 +288,17 @@ function wrapParser(parser) { }; } +/** + * Function to replace `SourceCode.prototype.getComments`. + * @returns {void} + * @throws {Error} Deprecation message. + */ +function getCommentsDeprecation() { + throw new Error( + "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead." + ); +} + //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -298,6 +313,7 @@ const IT_ONLY = Symbol("itOnly"); * @this {Mocha} * @param {string} text The description of the test case. * @param {Function} method The logic of the test case. + * @throws {Error} Any error upon execution of `method`. * @returns {any} Returned value of `method`. */ function itDefaultHandler(text, method) { @@ -322,6 +338,9 @@ function describeDefaultHandler(text, method) { return method.call(this); } +/** + * Mocha test wrapper. + */ class RuleTester { /** @@ -353,6 +372,7 @@ class RuleTester { /** * Set the configuration to use for all future tests * @param {Object} config the configuration to use. + * @throws {TypeError} If non-object config. * @returns {void} */ static setDefaultConfig(config) { @@ -468,6 +488,8 @@ class RuleTester { * valid: (ValidTestCase | string)[], * invalid: InvalidTestCase[] * }} test The collection of tests to run. + * @throws {TypeError|Error} If non-object `test`, or if a required + * scenario of the given type is missing. * @returns {void} */ run(ruleName, rule, test) { @@ -511,6 +533,7 @@ class RuleTester { /** * Run the rule for the given item * @param {string|Object} item Item to run the rule against + * @throws {Error} If an invalid schema. * @returns {Object} Eslint run result * @private */ @@ -607,7 +630,16 @@ class RuleTester { validate(config, "rule-tester", id => (id === ruleName ? rule : null)); // Verify the code. - const messages = linter.verify(code, config, filename); + const { getComments } = SourceCode.prototype; + let messages; + + try { + SourceCode.prototype.getComments = getCommentsDeprecation; + messages = linter.verify(code, config, filename); + } finally { + SourceCode.prototype.getComments = getComments; + } + const fatalErrorMessage = messages.find(m => m.fatal); assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); @@ -921,16 +953,6 @@ class RuleTester { ); } - // Rules that produce fixes must have `meta.fixable` property. - if (result.output !== item.code) { - assert.ok( - hasOwnProperty(rule, "meta"), - "Fixable rules should export a `meta.fixable` property." - ); - - // Linter throws if a rule that produced a fix has `meta` but doesn't have `meta.fixable`. - } - assertASTDidntChange(result.beforeAST, result.afterAST); } diff --git a/tools/node_modules/eslint/lib/rules/accessor-pairs.js b/tools/node_modules/eslint/lib/rules/accessor-pairs.js index 0e0d07a00c..f047252668 100644 --- a/tools/node_modules/eslint/lib/rules/accessor-pairs.js +++ b/tools/node_modules/eslint/lib/rules/accessor-pairs.js @@ -140,7 +140,6 @@ module.exports = { docs: { description: "enforce getter and setter pairs in objects and classes", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/accessor-pairs" }, diff --git a/tools/node_modules/eslint/lib/rules/array-bracket-newline.js b/tools/node_modules/eslint/lib/rules/array-bracket-newline.js index b4b4dd430f..28a05b3504 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-newline.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce linebreaks after opening and before closing array brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-bracket-newline" }, diff --git a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js index c2b77a641f..1eea99c14c 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce consistent spacing inside array brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-bracket-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/array-callback-return.js b/tools/node_modules/eslint/lib/rules/array-callback-return.js index 7267347149..d13ecd7179 100644 --- a/tools/node_modules/eslint/lib/rules/array-callback-return.js +++ b/tools/node_modules/eslint/lib/rules/array-callback-return.js @@ -139,7 +139,6 @@ module.exports = { docs: { description: "enforce `return` statements in callbacks of array methods", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/array-callback-return" }, diff --git a/tools/node_modules/eslint/lib/rules/array-element-newline.js b/tools/node_modules/eslint/lib/rules/array-element-newline.js index b7a967865b..535fa2155a 100644 --- a/tools/node_modules/eslint/lib/rules/array-element-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-element-newline.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce line breaks after each array element", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-element-newline" }, diff --git a/tools/node_modules/eslint/lib/rules/arrow-body-style.js b/tools/node_modules/eslint/lib/rules/arrow-body-style.js index 5b8a5f0116..3a3f544444 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-body-style.js +++ b/tools/node_modules/eslint/lib/rules/arrow-body-style.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "require braces around arrow function bodies", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-body-style" }, diff --git a/tools/node_modules/eslint/lib/rules/arrow-parens.js b/tools/node_modules/eslint/lib/rules/arrow-parens.js index eaa1aab023..4f4dea0e23 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-parens.js +++ b/tools/node_modules/eslint/lib/rules/arrow-parens.js @@ -33,7 +33,6 @@ module.exports = { docs: { description: "require parentheses around arrow function arguments", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-parens" }, diff --git a/tools/node_modules/eslint/lib/rules/arrow-spacing.js b/tools/node_modules/eslint/lib/rules/arrow-spacing.js index e5110c6c87..9e1ed71d4b 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-spacing.js +++ b/tools/node_modules/eslint/lib/rules/arrow-spacing.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce consistent spacing before and after the arrow in arrow functions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/block-scoped-var.js b/tools/node_modules/eslint/lib/rules/block-scoped-var.js index 481057ba6c..10125e61fd 100644 --- a/tools/node_modules/eslint/lib/rules/block-scoped-var.js +++ b/tools/node_modules/eslint/lib/rules/block-scoped-var.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "enforce the use of variables within the scope they are defined", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/block-scoped-var" }, diff --git a/tools/node_modules/eslint/lib/rules/block-spacing.js b/tools/node_modules/eslint/lib/rules/block-spacing.js index c4b30b0b70..13cfbf0e2c 100644 --- a/tools/node_modules/eslint/lib/rules/block-spacing.js +++ b/tools/node_modules/eslint/lib/rules/block-spacing.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow or enforce spaces inside of blocks after opening block and before closing block", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/block-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/brace-style.js b/tools/node_modules/eslint/lib/rules/brace-style.js index 07223d10d4..60aa532693 100644 --- a/tools/node_modules/eslint/lib/rules/brace-style.js +++ b/tools/node_modules/eslint/lib/rules/brace-style.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce consistent brace style for blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/brace-style" }, diff --git a/tools/node_modules/eslint/lib/rules/callback-return.js b/tools/node_modules/eslint/lib/rules/callback-return.js index fa66e6383b..449b9a9622 100644 --- a/tools/node_modules/eslint/lib/rules/callback-return.js +++ b/tools/node_modules/eslint/lib/rules/callback-return.js @@ -1,6 +1,7 @@ /** * @fileoverview Enforce return after a callback. * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -18,7 +19,6 @@ module.exports = { docs: { description: "require `return` statements after callbacks", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/callback-return" }, diff --git a/tools/node_modules/eslint/lib/rules/camelcase.js b/tools/node_modules/eslint/lib/rules/camelcase.js index d34656cfab..7e8fc68da6 100644 --- a/tools/node_modules/eslint/lib/rules/camelcase.js +++ b/tools/node_modules/eslint/lib/rules/camelcase.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce camelcase naming convention", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/camelcase" }, @@ -55,32 +54,25 @@ module.exports = { ], messages: { - notCamelCase: "Identifier '{{name}}' is not in camel case." + notCamelCase: "Identifier '{{name}}' is not in camel case.", + notCamelCasePrivate: "#{{name}} is not in camel case." } }, create(context) { - const options = context.options[0] || {}; - let properties = options.properties || ""; + const properties = options.properties === "never" ? "never" : "always"; const ignoreDestructuring = options.ignoreDestructuring; const ignoreImports = options.ignoreImports; const ignoreGlobals = options.ignoreGlobals; const allow = options.allow || []; - let globalScope; - - if (properties !== "always" && properties !== "never") { - properties = "always"; - } - //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - const reported = []; - const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); + const reported = new Set(); /** * Checks if a string contains an underscore and isn't all upper-case @@ -89,9 +81,10 @@ module.exports = { * @private */ function isUnderscored(name) { + const nameBody = name.replace(/^_+|_+$/gu, ""); // if there's an underscore, it might be A_CONSTANT, which is okay - return name.includes("_") && name !== name.toUpperCase(); + return nameBody.includes("_") && nameBody !== nameBody.toUpperCase(); } /** @@ -107,94 +100,76 @@ module.exports = { } /** - * Checks if a parent of a node is an ObjectPattern. - * @param {ASTNode} node The node to check. - * @returns {boolean} if the node is inside an ObjectPattern + * Checks if a given name is good or not. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is good. * @private */ - function isInsideObjectPattern(node) { - let current = node; - - while (current) { - const parent = current.parent; - - if (parent && parent.type === "Property" && parent.computed && parent.key === current) { - return false; - } - - if (current.type === "ObjectPattern") { - return true; - } - - current = parent; - } - - return false; + function isGoodName(name) { + return !isUnderscored(name) || isAllowed(name); } /** - * Checks whether the given node represents assignment target property in destructuring. - * - * For examples: - * ({a: b.foo} = c); // => true for `foo` - * ([a.foo] = b); // => true for `foo` - * ([a.foo = 1] = b); // => true for `foo` - * ({...a.foo} = b); // => true for `foo` - * @param {ASTNode} node An Identifier node to check - * @returns {boolean} True if the node is an assignment target property in destructuring. + * Checks if a given identifier reference or member expression is an assignment + * target. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is an assignment target. */ - function isAssignmentTargetPropertyInDestructuring(node) { - if ( - node.parent.type === "MemberExpression" && - node.parent.property === node && - !node.parent.computed - ) { - const effectiveParent = node.parent.parent; - - return ( - effectiveParent.type === "Property" && - effectiveParent.value === node.parent && - effectiveParent.parent.type === "ObjectPattern" || - effectiveParent.type === "ArrayPattern" || - effectiveParent.type === "RestElement" || - ( - effectiveParent.type === "AssignmentPattern" && - effectiveParent.left === node.parent - ) - ); - } - return false; - } - - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - - return variable && variable.defs.length === 0 && - variable.references.some(ref => ref.identifier === node); - } - - /** - * Checks whether the given node represents a reference to a property of an object in an object literal expression. - * This allows to differentiate between a global variable that is allowed to be used as a reference, and the key - * of the expressed object (which shouldn't be allowed). - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a property name of an object literal expression - */ - function isPropertyNameInObjectLiteral(node) { + function isAssignmentTarget(node) { const parent = node.parent; - return ( - parent.type === "Property" && - parent.parent.type === "ObjectExpression" && - !parent.computed && - parent.key === node - ); + switch (parent.type) { + case "AssignmentExpression": + case "AssignmentPattern": + return parent.left === node; + + case "Property": + return ( + parent.parent.type === "ObjectPattern" && + parent.value === node + ); + case "ArrayPattern": + case "RestElement": + return true; + + default: + return false; + } + } + + /** + * Checks if a given binding identifier uses the original name as-is. + * - If it's in object destructuring, the original name is its property name. + * - If it's in import declaration, the original name is its exported name. + * @param {ASTNode} node The `Identifier` node to check. + * @returns {boolean} `true` if the identifier uses the original name as-is. + */ + function equalsToOriginalName(node) { + const localName = node.name; + const valueNode = node.parent.type === "AssignmentPattern" + ? node.parent + : node; + const parent = valueNode.parent; + + switch (parent.type) { + case "Property": + return ( + parent.parent.type === "ObjectPattern" && + parent.value === valueNode && + !parent.computed && + parent.key.type === "Identifier" && + parent.key.name === localName + ); + + case "ImportSpecifier": + return ( + parent.local === node && + parent.imported.name === localName + ); + + default: + return false; + } } /** @@ -204,122 +179,213 @@ module.exports = { * @private */ function report(node) { - if (!reported.includes(node)) { - reported.push(node); - context.report({ node, messageId: "notCamelCase", data: { name: node.name } }); + if (reported.has(node.range[0])) { + return; } + reported.add(node.range[0]); + + // Report it. + context.report({ + node, + messageId: node.type === "PrivateIdentifier" + ? "notCamelCasePrivate" + : "notCamelCase", + data: { name: node.name } + }); + } + + /** + * Reports an identifier reference or a binding identifier. + * @param {ASTNode} node The `Identifier` node to report. + * @returns {void} + */ + function reportReferenceId(node) { + + /* + * For backward compatibility, if it's in callings then ignore it. + * Not sure why it is. + */ + if ( + node.parent.type === "CallExpression" || + node.parent.type === "NewExpression" + ) { + return; + } + + /* + * For backward compatibility, if it's a default value of + * destructuring/parameters then ignore it. + * Not sure why it is. + */ + if ( + node.parent.type === "AssignmentPattern" && + node.parent.right === node + ) { + return; + } + + /* + * The `ignoreDestructuring` flag skips the identifiers that uses + * the property name as-is. + */ + if (ignoreDestructuring && equalsToOriginalName(node)) { + return; + } + + report(node); } return { + // Report camelcase of global variable references ------------------ Program() { - globalScope = context.getScope(); + const scope = context.getScope(); + + if (!ignoreGlobals) { + + // Defined globals in config files or directive comments. + for (const variable of scope.variables) { + if ( + variable.identifiers.length > 0 || + isGoodName(variable.name) + ) { + continue; + } + for (const reference of variable.references) { + + /* + * For backward compatibility, this rule reports read-only + * references as well. + */ + reportReferenceId(reference.identifier); + } + } + } + + // Undefined globals. + for (const reference of scope.through) { + const id = reference.identifier; + + if (isGoodName(id.name)) { + continue; + } + + /* + * For backward compatibility, this rule reports read-only + * references as well. + */ + reportReferenceId(id); + } }, - Identifier(node) { + // Report camelcase of declared variables -------------------------- + [[ + "VariableDeclaration", + "FunctionDeclaration", + "FunctionExpression", + "ArrowFunctionExpression", + "ClassDeclaration", + "ClassExpression", + "CatchClause" + ]](node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + const id = variable.identifiers[0]; - /* - * Leading and trailing underscores are commonly used to flag - * private/protected identifiers, strip them before checking if underscored - */ - const name = node.name, - nameIsUnderscored = isUnderscored(name.replace(/^_+|_+$/gu, "")), - effectiveParent = (node.parent.type === "MemberExpression") ? node.parent.parent : node.parent; + // Report declaration. + if (!(ignoreDestructuring && equalsToOriginalName(id))) { + report(id); + } - // First, we ignore the node if it match the ignore list - if (isAllowed(name)) { + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + for (const reference of variable.references) { + if (reference.init) { + continue; // Skip the write references of initializers. + } + reportReferenceId(reference.identifier); + } + } + }, + + // Report camelcase in properties ---------------------------------- + [[ + "ObjectExpression > Property[computed!=true] > Identifier.key", + "MethodDefinition[computed!=true] > Identifier.key", + "PropertyDefinition[computed!=true] > Identifier.key", + "MethodDefinition > PrivateIdentifier.key", + "PropertyDefinition > PrivateIdentifier.key" + ]](node) { + if (properties === "never" || isGoodName(node.name)) { return; } - - // Check if it's a global variable - if (ignoreGlobals && isReferenceToGlobalVariable(node) && !isPropertyNameInObjectLiteral(node)) { + report(node); + }, + "MemberExpression[computed!=true] > Identifier.property"(node) { + if ( + properties === "never" || + !isAssignmentTarget(node.parent) || // ← ignore read-only references. + isGoodName(node.name) + ) { return; } + report(node); + }, - // MemberExpressions get special rules - if (node.parent.type === "MemberExpression") { + // Report camelcase in import -------------------------------------- + ImportDeclaration(node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + const id = variable.identifiers[0]; - // "never" check properties - if (properties === "never") { - return; + // Report declaration. + if (!(ignoreImports && equalsToOriginalName(id))) { + report(id); } - // Always report underscored object names - if (node.parent.object.type === "Identifier" && node.parent.object.name === node.name && nameIsUnderscored) { - report(node); - - // Report AssignmentExpressions only if they are the left side of the assignment - } else if (effectiveParent.type === "AssignmentExpression" && nameIsUnderscored && (effectiveParent.right.type !== "MemberExpression" || effectiveParent.left.type === "MemberExpression" && effectiveParent.left.property.name === node.name)) { - report(node); - - } else if (isAssignmentTargetPropertyInDestructuring(node) && nameIsUnderscored) { - report(node); + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + for (const reference of variable.references) { + reportReferenceId(reference.identifier); } + } + }, + + // Report camelcase in re-export ----------------------------------- + [[ + "ExportAllDeclaration > Identifier.exported", + "ExportSpecifier > Identifier.exported" + ]](node) { + if (isGoodName(node.name)) { + return; + } + report(node); + }, + + // Report camelcase in labels -------------------------------------- + [[ + "LabeledStatement > Identifier.label", /* - * Properties have their own rules, and - * AssignmentPattern nodes can be treated like Properties: - * e.g.: const { no_camelcased = false } = bar; + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. */ - } else if (node.parent.type === "Property" || node.parent.type === "AssignmentPattern") { - - if (node.parent.parent && node.parent.parent.type === "ObjectPattern") { - if (node.parent.shorthand && node.parent.value.left && nameIsUnderscored) { - report(node); - } - - const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name; - - if (nameIsUnderscored && node.parent.computed) { - report(node); - } - - // prevent checking righthand side of destructured object - if (node.parent.key === node && node.parent.value !== node) { - return; - } - - const valueIsUnderscored = node.parent.value.name && nameIsUnderscored; - - // ignore destructuring if the option is set, unless a new identifier is created - if (valueIsUnderscored && !(assignmentKeyEqualsValue && ignoreDestructuring)) { - report(node); - } - } - - // "never" check properties or always ignore destructuring - if (properties === "never" || (ignoreDestructuring && isInsideObjectPattern(node))) { - return; - } - - // don't check right hand side of AssignmentExpression to prevent duplicate warnings - if (nameIsUnderscored && !ALLOWED_PARENT_TYPES.has(effectiveParent.type) && !(node.parent.right === node)) { - report(node); - } - - // Check if it's an import specifier - } else if (["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.parent.type)) { - - if (node.parent.type === "ImportSpecifier" && ignoreImports) { - return; - } - - // Report only if the local imported identifier is underscored - if ( - node.parent.local && - node.parent.local.name === node.name && - nameIsUnderscored - ) { - report(node); - } - - // Report anything that is underscored that isn't a CallExpression - } else if (nameIsUnderscored && !ALLOWED_PARENT_TYPES.has(effectiveParent.type)) { - report(node); + "BreakStatement > Identifier.label", + "ContinueStatement > Identifier.label" + ]](node) { + if (isGoodName(node.name)) { + return; } + report(node); } - }; - } }; diff --git a/tools/node_modules/eslint/lib/rules/capitalized-comments.js b/tools/node_modules/eslint/lib/rules/capitalized-comments.js index d7524b878d..e5f429356b 100644 --- a/tools/node_modules/eslint/lib/rules/capitalized-comments.js +++ b/tools/node_modules/eslint/lib/rules/capitalized-comments.js @@ -105,7 +105,6 @@ module.exports = { docs: { description: "enforce or disallow capitalization of the first letter of a comment", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/capitalized-comments" }, diff --git a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js index 2cc5cc4184..034ba3abca 100644 --- a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js +++ b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "enforce that class methods utilize `this`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/class-methods-use-this" }, @@ -34,6 +33,10 @@ module.exports = { items: { type: "string" } + }, + enforceForClassFields: { + type: "boolean", + default: true } }, additionalProperties: false @@ -45,10 +48,27 @@ module.exports = { }, create(context) { const config = Object.assign({}, context.options[0]); + const enforceForClassFields = config.enforceForClassFields !== false; const exceptMethods = new Set(config.exceptMethods || []); const stack = []; + /** + * Push `this` used flag initialized with `false` onto the stack. + * @returns {void} + */ + function pushContext() { + stack.push(false); + } + + /** + * Pop `this` used flag from the stack. + * @returns {boolean | undefined} `this` used flag + */ + function popContext() { + return stack.pop(); + } + /** * Initializes the current context to false and pushes it onto the stack. * These booleans represent whether 'this' has been used in the context. @@ -56,7 +76,7 @@ module.exports = { * @private */ function enterFunction() { - stack.push(false); + pushContext(); } /** @@ -66,7 +86,14 @@ module.exports = { * @private */ function isInstanceMethod(node) { - return !node.static && node.kind !== "constructor" && node.type === "MethodDefinition"; + switch (node.type) { + case "MethodDefinition": + return !node.static && node.kind !== "constructor"; + case "PropertyDefinition": + return !node.static && enforceForClassFields; + default: + return false; + } } /** @@ -76,8 +103,19 @@ module.exports = { * @private */ function isIncludedInstanceMethod(node) { - return isInstanceMethod(node) && - (node.computed || !exceptMethods.has(node.key.name)); + if (isInstanceMethod(node)) { + if (node.computed) { + return true; + } + + const hashIfNeeded = node.key.type === "PrivateIdentifier" ? "#" : ""; + const name = node.key.type === "Literal" + ? astUtils.getStaticStringValue(node.key) + : (node.key.name || ""); + + return !exceptMethods.has(hashIfNeeded + name); + } + return false; } /** @@ -89,11 +127,12 @@ module.exports = { * @private */ function exitFunction(node) { - const methodUsesThis = stack.pop(); + const methodUsesThis = popContext(); if (isIncludedInstanceMethod(node.parent) && !methodUsesThis) { context.report({ node, + loc: astUtils.getFunctionHeadLoc(node, context.getSourceCode()), messageId: "missingThis", data: { name: astUtils.getFunctionNameWithKind(node) @@ -118,8 +157,21 @@ module.exports = { "FunctionDeclaration:exit": exitFunction, FunctionExpression: enterFunction, "FunctionExpression:exit": exitFunction, + + /* + * Class field value are implicit functions. + */ + "PropertyDefinition:exit": popContext, + "PropertyDefinition > *.key:exit": pushContext, + ThisExpression: markThisUsed, - Super: markThisUsed + Super: markThisUsed, + ...( + enforceForClassFields && { + "PropertyDefinition > ArrowFunctionExpression.value": enterFunction, + "PropertyDefinition > ArrowFunctionExpression.value:exit": exitFunction + } + ) }; } }; diff --git a/tools/node_modules/eslint/lib/rules/comma-dangle.js b/tools/node_modules/eslint/lib/rules/comma-dangle.js index 798c111ec3..e97a59886e 100644 --- a/tools/node_modules/eslint/lib/rules/comma-dangle.js +++ b/tools/node_modules/eslint/lib/rules/comma-dangle.js @@ -76,7 +76,6 @@ module.exports = { docs: { description: "require or disallow trailing commas", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-dangle" }, @@ -123,7 +122,8 @@ module.exports = { } ] } - ] + ], + additionalItems: false }, messages: { diff --git a/tools/node_modules/eslint/lib/rules/comma-spacing.js b/tools/node_modules/eslint/lib/rules/comma-spacing.js index 2bf41a00bb..d30a5ef320 100644 --- a/tools/node_modules/eslint/lib/rules/comma-spacing.js +++ b/tools/node_modules/eslint/lib/rules/comma-spacing.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce consistent spacing before and after commas", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/comma-style.js b/tools/node_modules/eslint/lib/rules/comma-style.js index 824ad89b2f..1d62fcf1c4 100644 --- a/tools/node_modules/eslint/lib/rules/comma-style.js +++ b/tools/node_modules/eslint/lib/rules/comma-style.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce consistent comma style", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-style" }, diff --git a/tools/node_modules/eslint/lib/rules/complexity.js b/tools/node_modules/eslint/lib/rules/complexity.js index 116c8ad0a6..b833aafc0f 100644 --- a/tools/node_modules/eslint/lib/rules/complexity.js +++ b/tools/node_modules/eslint/lib/rules/complexity.js @@ -23,7 +23,6 @@ module.exports = { docs: { description: "enforce a maximum cyclomatic complexity allowed in a program", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/complexity" }, @@ -75,60 +74,16 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- - // Using a stack to store complexity (handling nested functions) - const fns = []; + // Using a stack to store complexity per code path + const complexities = []; /** - * When parsing a new function, store it in our function stack - * @returns {void} - * @private - */ - function startFunction() { - fns.push(1); - } - - /** - * Evaluate the node at the end of function - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function endFunction(node) { - const name = upperCaseFirst(astUtils.getFunctionNameWithKind(node)); - const complexity = fns.pop(); - - if (complexity > THRESHOLD) { - context.report({ - node, - messageId: "complex", - data: { name, complexity, max: THRESHOLD } - }); - } - } - - /** - * Increase the complexity of the function in context + * Increase the complexity of the code path in context * @returns {void} * @private */ function increaseComplexity() { - if (fns.length) { - fns[fns.length - 1]++; - } - } - - /** - * Increase the switch complexity in context - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function increaseSwitchComplexity(node) { - - // Avoiding `default` - if (node.test) { - increaseComplexity(); - } + complexities[complexities.length - 1]++; } //-------------------------------------------------------------------------- @@ -136,13 +91,14 @@ module.exports = { //-------------------------------------------------------------------------- return { - FunctionDeclaration: startFunction, - FunctionExpression: startFunction, - ArrowFunctionExpression: startFunction, - "FunctionDeclaration:exit": endFunction, - "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction, + onCodePathStart() { + + // The initial complexity is 1, representing one execution path in the CodePath + complexities.push(1); + }, + + // Each branching in the code adds 1 to the complexity CatchClause: increaseComplexity, ConditionalExpression: increaseComplexity, LogicalExpression: increaseComplexity, @@ -150,14 +106,49 @@ module.exports = { ForInStatement: increaseComplexity, ForOfStatement: increaseComplexity, IfStatement: increaseComplexity, - SwitchCase: increaseSwitchComplexity, WhileStatement: increaseComplexity, DoWhileStatement: increaseComplexity, + // Avoid `default` + "SwitchCase[test]": increaseComplexity, + + // Logical assignment operators have short-circuiting behavior AssignmentExpression(node) { if (astUtils.isLogicalAssignmentOperator(node.operator)) { increaseComplexity(); } + }, + + onCodePathEnd(codePath, node) { + const complexity = complexities.pop(); + + /* + * This rule only evaluates complexity of functions, so "program" is excluded. + * Class field initializers are implicit functions. Therefore, they shouldn't contribute + * to the enclosing function's complexity, but their own complexity should be evaluated. + */ + if ( + codePath.origin !== "function" && + codePath.origin !== "class-field-initializer" + ) { + return; + } + + if (complexity > THRESHOLD) { + const name = codePath.origin === "class-field-initializer" + ? "class field initializer" + : astUtils.getFunctionNameWithKind(node); + + context.report({ + node, + messageId: "complex", + data: { + name: upperCaseFirst(name), + complexity, + max: THRESHOLD + } + }); + } } }; diff --git a/tools/node_modules/eslint/lib/rules/computed-property-spacing.js b/tools/node_modules/eslint/lib/rules/computed-property-spacing.js index 53fdb8f4e4..c8d8834ea9 100644 --- a/tools/node_modules/eslint/lib/rules/computed-property-spacing.js +++ b/tools/node_modules/eslint/lib/rules/computed-property-spacing.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce consistent spacing inside computed property brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/computed-property-spacing" }, @@ -195,7 +194,8 @@ module.exports = { }; if (enforceForClassMembers) { - listeners.MethodDefinition = checkSpacing("key"); + listeners.MethodDefinition = + listeners.PropertyDefinition = listeners.Property; } return listeners; diff --git a/tools/node_modules/eslint/lib/rules/consistent-return.js b/tools/node_modules/eslint/lib/rules/consistent-return.js index 0e20209af5..b509c36564 100644 --- a/tools/node_modules/eslint/lib/rules/consistent-return.js +++ b/tools/node_modules/eslint/lib/rules/consistent-return.js @@ -46,7 +46,6 @@ module.exports = { docs: { description: "require `return` statements to either always or never specify values", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/consistent-return" }, diff --git a/tools/node_modules/eslint/lib/rules/consistent-this.js b/tools/node_modules/eslint/lib/rules/consistent-this.js index e5bc9678da..025f3d0a34 100644 --- a/tools/node_modules/eslint/lib/rules/consistent-this.js +++ b/tools/node_modules/eslint/lib/rules/consistent-this.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "enforce consistent naming when capturing the current execution context", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/consistent-this" }, @@ -47,7 +46,7 @@ module.exports = { * Reports that a variable declarator or assignment expression is assigning * a non-'this' value to the specified alias. * @param {ASTNode} node The assigning node. - * @param {string} name the name of the alias that was incorrectly used. + * @param {string} name the name of the alias that was incorrectly used. * @returns {void} */ function reportBadAssignment(node, name) { diff --git a/tools/node_modules/eslint/lib/rules/constructor-super.js b/tools/node_modules/eslint/lib/rules/constructor-super.js index dfec18fb65..38eb489327 100644 --- a/tools/node_modules/eslint/lib/rules/constructor-super.js +++ b/tools/node_modules/eslint/lib/rules/constructor-super.js @@ -122,7 +122,6 @@ module.exports = { docs: { description: "require `super()` calls in constructors", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/constructor-super" }, diff --git a/tools/node_modules/eslint/lib/rules/curly.js b/tools/node_modules/eslint/lib/rules/curly.js index 61dcd8024b..57c2e72e4e 100644 --- a/tools/node_modules/eslint/lib/rules/curly.js +++ b/tools/node_modules/eslint/lib/rules/curly.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce consistent brace style for all control statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/curly" }, diff --git a/tools/node_modules/eslint/lib/rules/default-case-last.js b/tools/node_modules/eslint/lib/rules/default-case-last.js index 80c5d6bda7..1eeadd1e71 100644 --- a/tools/node_modules/eslint/lib/rules/default-case-last.js +++ b/tools/node_modules/eslint/lib/rules/default-case-last.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce default clauses in switch statements to be last", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-case-last" }, diff --git a/tools/node_modules/eslint/lib/rules/default-case.js b/tools/node_modules/eslint/lib/rules/default-case.js index 821e0d72bd..b839aa2013 100644 --- a/tools/node_modules/eslint/lib/rules/default-case.js +++ b/tools/node_modules/eslint/lib/rules/default-case.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "require `default` cases in `switch` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-case" }, @@ -50,8 +49,8 @@ module.exports = { /** * Shortcut to get last element of array - * @param {*[]} collection Array - * @returns {*} Last element + * @param {*[]} collection Array + * @returns {any} Last element */ function last(collection) { return collection[collection.length - 1]; diff --git a/tools/node_modules/eslint/lib/rules/default-param-last.js b/tools/node_modules/eslint/lib/rules/default-param-last.js index 12e0b5950d..8382d46e76 100644 --- a/tools/node_modules/eslint/lib/rules/default-param-last.js +++ b/tools/node_modules/eslint/lib/rules/default-param-last.js @@ -11,7 +11,6 @@ module.exports = { docs: { description: "enforce default parameters to be last", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-param-last" }, @@ -25,8 +24,8 @@ module.exports = { create(context) { - // eslint-disable-next-line jsdoc/require-description /** + * Handler for function contexts. * @param {ASTNode} node function node * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/dot-location.js b/tools/node_modules/eslint/lib/rules/dot-location.js index a8d5a76056..d80f87090a 100644 --- a/tools/node_modules/eslint/lib/rules/dot-location.js +++ b/tools/node_modules/eslint/lib/rules/dot-location.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce consistent newlines before and after dots", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/dot-location" }, diff --git a/tools/node_modules/eslint/lib/rules/dot-notation.js b/tools/node_modules/eslint/lib/rules/dot-notation.js index 3aa9f3110f..1cd908f7a2 100644 --- a/tools/node_modules/eslint/lib/rules/dot-notation.js +++ b/tools/node_modules/eslint/lib/rules/dot-notation.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "enforce dot notation whenever possible", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/dot-notation" }, @@ -141,6 +140,7 @@ module.exports = { if ( !allowKeywords && !node.computed && + node.property.type === "Identifier" && keywords.indexOf(String(node.property.name)) !== -1 ) { context.report({ diff --git a/tools/node_modules/eslint/lib/rules/eol-last.js b/tools/node_modules/eslint/lib/rules/eol-last.js index 24b0c9279c..f8b922c250 100644 --- a/tools/node_modules/eslint/lib/rules/eol-last.js +++ b/tools/node_modules/eslint/lib/rules/eol-last.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "require or disallow newline at the end of files", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/eol-last" }, @@ -86,10 +85,15 @@ module.exports = { }); } else if (mode === "never" && endsWithNewline) { + const secondLastLine = sourceCode.lines[sourceCode.lines.length - 2]; + // File is newline-terminated, but shouldn't be context.report({ node, - loc: location, + loc: { + start: { line: sourceCode.lines.length - 1, column: secondLastLine.length }, + end: { line: sourceCode.lines.length, column: 0 } + }, messageId: "unexpected", fix(fixer) { const finalEOLs = /(?:\r?\n)+$/u, diff --git a/tools/node_modules/eslint/lib/rules/eqeqeq.js b/tools/node_modules/eslint/lib/rules/eqeqeq.js index 57926dbed0..d3e6b5af0b 100644 --- a/tools/node_modules/eslint/lib/rules/eqeqeq.js +++ b/tools/node_modules/eslint/lib/rules/eqeqeq.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "require the use of `===` and `!==`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/eqeqeq" }, @@ -78,7 +77,7 @@ module.exports = { /** * Checks if an expression is a typeof expression - * @param {ASTNode} node The node to check + * @param {ASTNode} node The node to check * @returns {boolean} if the node is a typeof expression */ function isTypeOf(node) { diff --git a/tools/node_modules/eslint/lib/rules/for-direction.js b/tools/node_modules/eslint/lib/rules/for-direction.js index c15d10e5f8..abe4ad3c6b 100644 --- a/tools/node_modules/eslint/lib/rules/for-direction.js +++ b/tools/node_modules/eslint/lib/rules/for-direction.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce \"for\" loop update clause moving the counter in the right direction.", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/for-direction" }, diff --git a/tools/node_modules/eslint/lib/rules/func-call-spacing.js b/tools/node_modules/eslint/lib/rules/func-call-spacing.js index 132a583314..a6ebde4ac0 100644 --- a/tools/node_modules/eslint/lib/rules/func-call-spacing.js +++ b/tools/node_modules/eslint/lib/rules/func-call-spacing.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "require or disallow spacing between function identifiers and their invocations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-call-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/func-name-matching.js b/tools/node_modules/eslint/lib/rules/func-name-matching.js index 755c2ee507..122cfd8d33 100644 --- a/tools/node_modules/eslint/lib/rules/func-name-matching.js +++ b/tools/node_modules/eslint/lib/rules/func-name-matching.js @@ -74,7 +74,6 @@ module.exports = { docs: { description: "require function names to match the name of the variable or property to which they are assigned", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-name-matching" }, @@ -196,21 +195,25 @@ module.exports = { const isProp = node.left.type === "MemberExpression"; const name = isProp ? astUtils.getStaticPropertyName(node.left) : node.left.name; - if (node.right.id && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { + if (node.right.id && name && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { report(node, name, node.right.id.name, isProp); } }, - Property(node) { - if (node.value.type !== "FunctionExpression" || !node.value.id || node.computed && !isStringLiteral(node.key)) { + "Property, PropertyDefinition[value]"(node) { + if (!(node.value.type === "FunctionExpression" && node.value.id)) { return; } - if (node.key.type === "Identifier") { + if (node.key.type === "Identifier" && !node.computed) { const functionName = node.value.id.name; let propertyName = node.key.name; - if (considerPropertyDescriptor && propertyName === "value") { + if ( + considerPropertyDescriptor && + propertyName === "value" && + node.parent.type === "ObjectExpression" + ) { if (isPropertyCall("Object", "defineProperty", node.parent.parent) || isPropertyCall("Reflect", "defineProperty", node.parent.parent)) { const property = node.parent.parent.arguments[1]; diff --git a/tools/node_modules/eslint/lib/rules/func-names.js b/tools/node_modules/eslint/lib/rules/func-names.js index ecfedb9e0e..589903c96a 100644 --- a/tools/node_modules/eslint/lib/rules/func-names.js +++ b/tools/node_modules/eslint/lib/rules/func-names.js @@ -30,7 +30,6 @@ module.exports = { docs: { description: "require or disallow named `function` expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-names" }, @@ -118,6 +117,7 @@ module.exports = { return isObjectOrClassMethod(node) || (parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node) || (parent.type === "Property" && parent.value === node) || + (parent.type === "PropertyDefinition" && parent.value === node) || (parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node) || (parent.type === "AssignmentPattern" && parent.left.type === "Identifier" && parent.right === node); } diff --git a/tools/node_modules/eslint/lib/rules/func-style.js b/tools/node_modules/eslint/lib/rules/func-style.js index e150b1a76f..0921ff54cd 100644 --- a/tools/node_modules/eslint/lib/rules/func-style.js +++ b/tools/node_modules/eslint/lib/rules/func-style.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "enforce the consistent use of either `function` declarations or expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-style" }, diff --git a/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js b/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js index b6abbe95fa..ed4e296fd6 100644 --- a/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js +++ b/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce line breaks between arguments of a function call", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/function-call-argument-newline" }, diff --git a/tools/node_modules/eslint/lib/rules/function-paren-newline.js b/tools/node_modules/eslint/lib/rules/function-paren-newline.js index 9d8d67ba14..18435b7897 100644 --- a/tools/node_modules/eslint/lib/rules/function-paren-newline.js +++ b/tools/node_modules/eslint/lib/rules/function-paren-newline.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce consistent line breaks inside function parentheses", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/function-paren-newline" }, @@ -183,6 +182,7 @@ module.exports = { /** * Gets the left paren and right paren tokens of a node. * @param {ASTNode} node The node with parens + * @throws {TypeError} Unexecpted node type. * @returns {Object} An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token. * Can also return `null` if an expression has no parens (e.g. a NewExpression with no arguments, or an ArrowFunctionExpression * with a single parameter) diff --git a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js index 65534f727f..c50445c9c9 100644 --- a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js +++ b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js @@ -31,7 +31,6 @@ module.exports = { docs: { description: "enforce consistent spacing around `*` operators in generator functions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/generator-star-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/getter-return.js b/tools/node_modules/eslint/lib/rules/getter-return.js index c54ebfb4ff..8bb42536e8 100644 --- a/tools/node_modules/eslint/lib/rules/getter-return.js +++ b/tools/node_modules/eslint/lib/rules/getter-return.js @@ -35,7 +35,6 @@ module.exports = { docs: { description: "enforce `return` statements in getters", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/getter-return" }, diff --git a/tools/node_modules/eslint/lib/rules/global-require.js b/tools/node_modules/eslint/lib/rules/global-require.js index 09d0332007..f2d29d1df5 100644 --- a/tools/node_modules/eslint/lib/rules/global-require.js +++ b/tools/node_modules/eslint/lib/rules/global-require.js @@ -1,6 +1,7 @@ /** * @fileoverview Rule for disallowing require() outside of the top-level module context * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -57,7 +58,6 @@ module.exports = { docs: { description: "require `require()` calls to be placed at top-level module scope", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/global-require" }, diff --git a/tools/node_modules/eslint/lib/rules/grouped-accessor-pairs.js b/tools/node_modules/eslint/lib/rules/grouped-accessor-pairs.js index a790f83750..cc4a4b522a 100644 --- a/tools/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +++ b/tools/node_modules/eslint/lib/rules/grouped-accessor-pairs.js @@ -96,7 +96,6 @@ module.exports = { docs: { description: "require grouped accessor pairs in object literals and classes", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/grouped-accessor-pairs" }, diff --git a/tools/node_modules/eslint/lib/rules/guard-for-in.js b/tools/node_modules/eslint/lib/rules/guard-for-in.js index 2c0976d997..6f877bab95 100644 --- a/tools/node_modules/eslint/lib/rules/guard-for-in.js +++ b/tools/node_modules/eslint/lib/rules/guard-for-in.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require `for-in` loops to include an `if` statement", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/guard-for-in" }, diff --git a/tools/node_modules/eslint/lib/rules/handle-callback-err.js b/tools/node_modules/eslint/lib/rules/handle-callback-err.js index b92490ad16..cdb3a7642e 100644 --- a/tools/node_modules/eslint/lib/rules/handle-callback-err.js +++ b/tools/node_modules/eslint/lib/rules/handle-callback-err.js @@ -1,6 +1,7 @@ /** * @fileoverview Ensure handling of errors when we know they exist. * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -19,7 +20,6 @@ module.exports = { docs: { description: "require error handling in callbacks", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/handle-callback-err" }, diff --git a/tools/node_modules/eslint/lib/rules/id-blacklist.js b/tools/node_modules/eslint/lib/rules/id-blacklist.js index 4fbba909fd..77deac7070 100644 --- a/tools/node_modules/eslint/lib/rules/id-blacklist.js +++ b/tools/node_modules/eslint/lib/rules/id-blacklist.js @@ -2,6 +2,7 @@ * @fileoverview Rule that warns when identifier names that are * specified in the configuration are used. * @author Keith Cirkel (http://keithcirkel.co.uk) + * @deprecated in ESLint v7.5.0 */ "use strict"; @@ -118,7 +119,6 @@ module.exports = { docs: { description: "disallow specified identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-blacklist" }, @@ -205,7 +205,17 @@ module.exports = { * @private */ function report(node) { - if (!reportedNodes.has(node)) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { context.report({ node, messageId: "restricted", @@ -213,8 +223,9 @@ module.exports = { name: node.name } }); - reportedNodes.add(node); + reportedNodes.add(node.range.toString()); } + } return { diff --git a/tools/node_modules/eslint/lib/rules/id-denylist.js b/tools/node_modules/eslint/lib/rules/id-denylist.js index 112fd8a9d5..2b34635542 100644 --- a/tools/node_modules/eslint/lib/rules/id-denylist.js +++ b/tools/node_modules/eslint/lib/rules/id-denylist.js @@ -69,14 +69,14 @@ function isRenamedImport(node) { } /** - * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. + * Checks whether the given node is an ObjectPattern destructuring. * * Examples: - * const { a : b } = foo; // node `a` is renamed node. + * const { a : b } = foo; * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. + * @returns {boolean} `true` if the node is in an ObjectPattern destructuring. */ -function isRenamedInDestructuring(node) { +function isPropertyNameInDestructuring(node) { const parent = node.parent; return ( @@ -84,27 +84,11 @@ function isRenamedInDestructuring(node) { !parent.computed && parent.type === "Property" && parent.parent.type === "ObjectPattern" && - parent.value !== node && parent.key === node ) ); } -/** - * Checks whether the given node represents shorthand definition of a property in an object literal. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a shorthand property definition. - */ -function isShorthandPropertyDefinition(node) { - const parent = node.parent; - - return ( - parent.type === "Property" && - parent.parent.type === "ObjectExpression" && - parent.shorthand - ); -} - //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -115,7 +99,6 @@ module.exports = { docs: { description: "disallow specified identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-denylist" }, @@ -128,7 +111,8 @@ module.exports = { uniqueItems: true }, messages: { - restricted: "Identifier '{{name}}' is restricted." + restricted: "Identifier '{{name}}' is restricted.", + restrictedPrivate: "Identifier '#{{name}}' is restricted." } }, @@ -187,11 +171,8 @@ module.exports = { parent.type !== "CallExpression" && parent.type !== "NewExpression" && !isRenamedImport(node) && - !isRenamedInDestructuring(node) && - !( - isReferenceToGlobalVariable(node) && - !isShorthandPropertyDefinition(node) - ) + !isPropertyNameInDestructuring(node) && + !isReferenceToGlobalVariable(node) ); } @@ -202,15 +183,27 @@ module.exports = { * @private */ function report(node) { - if (!reportedNodes.has(node)) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + const isPrivate = node.type === "PrivateIdentifier"; + context.report({ node, - messageId: "restricted", + messageId: isPrivate ? "restrictedPrivate" : "restricted", data: { name: node.name } }); - reportedNodes.add(node); + reportedNodes.add(node.range.toString()); } } @@ -220,7 +213,10 @@ module.exports = { globalScope = context.getScope(); }, - Identifier(node) { + [[ + "Identifier", + "PrivateIdentifier" + ]](node) { if (isRestricted(node.name) && shouldCheck(node)) { report(node); } diff --git a/tools/node_modules/eslint/lib/rules/id-length.js b/tools/node_modules/eslint/lib/rules/id-length.js index 4df081ff9f..ac6385f59c 100644 --- a/tools/node_modules/eslint/lib/rules/id-length.js +++ b/tools/node_modules/eslint/lib/rules/id-length.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce minimum and maximum identifier lengths", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-length" }, @@ -55,7 +54,9 @@ module.exports = { ], messages: { tooShort: "Identifier name '{{name}}' is too short (< {{min}}).", - tooLong: "Identifier name '{{name}}' is too long (> {{max}})." + tooShortPrivate: "Identifier name '#{{name}}' is too short (< {{min}}).", + tooLong: "Identifier name '{{name}}' is too long (> {{max}}).", + tooLongPrivate: "Identifier name #'{{name}}' is too long (> {{max}})." } }, @@ -66,7 +67,7 @@ module.exports = { const properties = options.properties !== "never"; const exceptions = new Set(options.exceptions); const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); - const reportedNode = new Set(); + const reportedNodes = new Set(); /** * Checks if a string matches the provided exception patterns @@ -99,12 +100,14 @@ module.exports = { Property(parent, node) { if (parent.parent.type === "ObjectPattern") { + const isKeyAndValueSame = parent.value.name === parent.key.name; + return ( - parent.value !== parent.key && parent.value === node || - parent.value === parent.key && parent.key === node && properties + !isKeyAndValueSame && parent.value === node || + isKeyAndValueSame && parent.key === node && properties ); } - return properties && !parent.computed && parent.key === node; + return properties && !parent.computed && parent.key.name === node.name; }, ImportDefaultSpecifier: true, RestElement: true, @@ -113,12 +116,16 @@ module.exports = { ClassDeclaration: true, FunctionDeclaration: true, MethodDefinition: true, + PropertyDefinition: true, CatchClause: true, ArrayPattern: true }; return { - Identifier(node) { + [[ + "Identifier", + "PrivateIdentifier" + ]](node) { const name = node.name; const parent = node.parent; @@ -131,11 +138,27 @@ module.exports = { const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type]; - if (isValidExpression && !reportedNode.has(node) && (isValidExpression === true || isValidExpression(parent, node))) { - reportedNode.add(node); + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (isValidExpression && !reportedNodes.has(node.range.toString()) && (isValidExpression === true || isValidExpression(parent, node))) { + reportedNodes.add(node.range.toString()); + + let messageId = isShort ? "tooShort" : "tooLong"; + + if (node.type === "PrivateIdentifier") { + messageId += "Private"; + } + context.report({ node, - messageId: isShort ? "tooShort" : "tooLong", + messageId, data: { name, min: minLength, max: maxLength } }); } diff --git a/tools/node_modules/eslint/lib/rules/id-match.js b/tools/node_modules/eslint/lib/rules/id-match.js index 7e400d037a..7a6cd058f2 100644 --- a/tools/node_modules/eslint/lib/rules/id-match.js +++ b/tools/node_modules/eslint/lib/rules/id-match.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require identifiers to match a specified regular expression", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-match" }, @@ -31,6 +30,10 @@ module.exports = { type: "boolean", default: false }, + classFields: { + type: "boolean", + default: false + }, onlyDeclarations: { type: "boolean", default: false @@ -44,7 +47,8 @@ module.exports = { } ], messages: { - notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'." + notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'.", + notMatchPrivate: "Identifier '#{{name}}' does not match the pattern '{{pattern}}'." } }, @@ -57,7 +61,8 @@ module.exports = { regexp = new RegExp(pattern, "u"); const options = context.options[1] || {}, - properties = !!options.properties, + checkProperties = !!options.properties, + checkClassFields = !!options.classFields, onlyDeclarations = !!options.onlyDeclarations, ignoreDestructuring = !!options.ignoreDestructuring; @@ -66,7 +71,7 @@ module.exports = { //-------------------------------------------------------------------------- // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - const reported = new Map(); + const reportedNodes = new Set(); const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); const DECLARATION_TYPES = new Set(["FunctionDeclaration", "VariableDeclarator"]); const IMPORT_TYPES = new Set(["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"]); @@ -120,16 +125,30 @@ module.exports = { * @private */ function report(node) { - if (!reported.has(node)) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + + const messageId = (node.type === "PrivateIdentifier") + ? "notMatchPrivate" : "notMatch"; + context.report({ node, - messageId: "notMatch", + messageId, data: { name: node.name, pattern } }); - reported.set(node, true); + reportedNodes.add(node.range.toString()); } } @@ -142,7 +161,7 @@ module.exports = { if (parent.type === "MemberExpression") { - if (!properties) { + if (!checkProperties) { return; } @@ -176,8 +195,7 @@ module.exports = { } else if (parent.type === "Property" || parent.type === "AssignmentPattern") { if (parent.parent && parent.parent.type === "ObjectPattern") { - if (parent.shorthand && parent.value.left && isInvalid(name)) { - + if (!ignoreDestructuring && parent.shorthand && parent.value.left && isInvalid(name)) { report(node); } @@ -197,7 +215,7 @@ module.exports = { } // never check properties or always ignore destructuring - if (!properties || (ignoreDestructuring && isInsideObjectPattern(node))) { + if (!checkProperties || (ignoreDestructuring && isInsideObjectPattern(node))) { return; } @@ -214,10 +232,29 @@ module.exports = { report(node); } + } else if (parent.type === "PropertyDefinition") { + + if (checkClassFields && isInvalid(name)) { + report(node); + } + // Report anything that is invalid that isn't a CallExpression } else if (shouldReport(effectiveParent, name)) { report(node); } + }, + + "PrivateIdentifier"(node) { + + const isClassField = node.parent.type === "PropertyDefinition"; + + if (isClassField && !checkClassFields) { + return; + } + + if (isInvalid(node.name)) { + report(node); + } } }; diff --git a/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js b/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js index 409145e7dc..2d09552440 100644 --- a/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +++ b/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce the location of arrow function bodies", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/implicit-arrow-linebreak" }, diff --git a/tools/node_modules/eslint/lib/rules/indent-legacy.js b/tools/node_modules/eslint/lib/rules/indent-legacy.js index a26ee87b13..54ca9ddd13 100644 --- a/tools/node_modules/eslint/lib/rules/indent-legacy.js +++ b/tools/node_modules/eslint/lib/rules/indent-legacy.js @@ -4,6 +4,7 @@ * This rule has been ported and modified from nodeca. * @author Vitaly Puzrin * @author Gyandeep Singh + * @deprecated in ESLint v4.0.0 */ "use strict"; @@ -25,7 +26,6 @@ module.exports = { docs: { description: "enforce consistent indentation", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/indent-legacy" }, diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js index 04f41db9e2..7b17e3e540 100644 --- a/tools/node_modules/eslint/lib/rules/indent.js +++ b/tools/node_modules/eslint/lib/rules/indent.js @@ -60,8 +60,10 @@ const KNOWN_NODES = new Set([ "NewExpression", "ObjectExpression", "ObjectPattern", + "PrivateIdentifier", "Program", "Property", + "PropertyDefinition", "RestElement", "ReturnStatement", "SequenceExpression", @@ -138,7 +140,7 @@ class BinarySearchTree { /** * Inserts an entry into the tree. * @param {number} key The entry's key - * @param {*} value The entry's value + * @param {any} value The entry's value * @returns {void} */ insert(key, value) { @@ -188,7 +190,6 @@ class BinarySearchTree { */ class TokenInfo { - // eslint-disable-next-line jsdoc/require-description /** * @param {SourceCode} sourceCode A SourceCode object */ @@ -238,7 +239,6 @@ class TokenInfo { */ class OffsetStorage { - // eslint-disable-next-line jsdoc/require-description /** * @param {TokenInfo} tokenInfo a TokenInfo instance * @param {number} indentSize The desired size of each indentation level @@ -263,7 +263,7 @@ class OffsetStorage { /** * Sets the offset column of token B to match the offset column of token A. - * **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In + * - **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In * most cases, `setDesiredOffset` should be used instead. * @param {Token} baseToken The first token * @param {Token} offsetToken The second token, whose offset should be matched to the first token @@ -352,11 +352,11 @@ class OffsetStorage { * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following * list could represent the state of the offset tree at a given point: * - * * Tokens starting in the interval [0, 15) are aligned with the beginning of the file - * * Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token - * * Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token - * * Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token - * * Tokens starting in the interval [820, āˆž) are offset by 1 indent level from the `baz` token + * - Tokens starting in the interval [0, 15) are aligned with the beginning of the file + * - Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token + * - Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token + * - Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token + * - Tokens starting in the interval [820, āˆž) are offset by 1 indent level from the `baz` token * * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: * `setDesiredOffsets([30, 43], fooToken, 1);` @@ -499,7 +499,6 @@ module.exports = { docs: { description: "enforce consistent indentation", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/indent" }, @@ -1359,6 +1358,45 @@ module.exports = { } }, + PropertyDefinition(node) { + const firstToken = sourceCode.getFirstToken(node); + const maybeSemicolonToken = sourceCode.getLastToken(node); + let keyLastToken = null; + + // Indent key. + if (node.computed) { + const bracketTokenL = sourceCode.getTokenBefore(node.key, astUtils.isOpeningBracketToken); + const bracketTokenR = keyLastToken = sourceCode.getTokenAfter(node.key, astUtils.isClosingBracketToken); + const keyRange = [bracketTokenL.range[1], bracketTokenR.range[0]]; + + if (bracketTokenL !== firstToken) { + offsets.setDesiredOffset(bracketTokenL, firstToken, 0); + } + offsets.setDesiredOffsets(keyRange, bracketTokenL, 1); + offsets.setDesiredOffset(bracketTokenR, bracketTokenL, 0); + } else { + const idToken = keyLastToken = sourceCode.getFirstToken(node.key); + + if (idToken !== firstToken) { + offsets.setDesiredOffset(idToken, firstToken, 1); + } + } + + // Indent initializer. + if (node.value) { + const eqToken = sourceCode.getTokenBefore(node.value, astUtils.isEqToken); + const valueToken = sourceCode.getTokenAfter(eqToken); + + offsets.setDesiredOffset(eqToken, keyLastToken, 1); + offsets.setDesiredOffset(valueToken, eqToken, 1); + if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, eqToken, 1); + } + } else if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, keyLastToken, 1); + } + }, + SwitchStatement(node) { const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken); const closingCurly = sourceCode.getLastToken(node); diff --git a/tools/node_modules/eslint/lib/rules/index.js b/tools/node_modules/eslint/lib/rules/index.js index 35af38fd10..c88febd85b 100644 --- a/tools/node_modules/eslint/lib/rules/index.js +++ b/tools/node_modules/eslint/lib/rules/index.js @@ -6,7 +6,7 @@ "use strict"; -/* eslint sort-keys: ["error", "asc"] */ +/* eslint sort-keys: ["error", "asc"] -- More readable for long list */ const { LazyLoadingRuleMap } = require("./utils/lazy-loading-rule-map"); diff --git a/tools/node_modules/eslint/lib/rules/init-declarations.js b/tools/node_modules/eslint/lib/rules/init-declarations.js index 6cfdf92c90..d994bbc1ea 100644 --- a/tools/node_modules/eslint/lib/rules/init-declarations.js +++ b/tools/node_modules/eslint/lib/rules/init-declarations.js @@ -48,7 +48,6 @@ module.exports = { docs: { description: "require or disallow initialization in variable declarations", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/init-declarations" }, diff --git a/tools/node_modules/eslint/lib/rules/jsx-quotes.js b/tools/node_modules/eslint/lib/rules/jsx-quotes.js index 3b282df2f0..cbadc19d5e 100644 --- a/tools/node_modules/eslint/lib/rules/jsx-quotes.js +++ b/tools/node_modules/eslint/lib/rules/jsx-quotes.js @@ -42,7 +42,6 @@ module.exports = { docs: { description: "enforce the consistent use of either double or single quotes in JSX attributes", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/jsx-quotes" }, diff --git a/tools/node_modules/eslint/lib/rules/key-spacing.js b/tools/node_modules/eslint/lib/rules/key-spacing.js index fc885a117a..cb176dd00d 100644 --- a/tools/node_modules/eslint/lib/rules/key-spacing.js +++ b/tools/node_modules/eslint/lib/rules/key-spacing.js @@ -139,7 +139,6 @@ module.exports = { docs: { description: "enforce consistent spacing between keys and values in object literal properties", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/key-spacing" }, @@ -531,8 +530,8 @@ module.exports = { /** * Creates groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. - * @returns {Array.} Groups of property AST node lists. + * @param {ASTNode} node ObjectExpression node being evaluated. + * @returns {Array} Groups of property AST node lists. */ function createGroups(node) { if (node.properties.length === 1) { @@ -600,7 +599,7 @@ module.exports = { /** * Verifies spacing of property conforms to specified options. - * @param {ASTNode} node Property node being evaluated. + * @param {ASTNode} node Property node being evaluated. * @param {Object} lineOptions Configured singleLine or multiLine options * @returns {void} */ @@ -629,7 +628,7 @@ module.exports = { /** * Verifies vertical alignment, taking into account groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. + * @param {ASTNode} node ObjectExpression node being evaluated. * @returns {void} */ function verifyAlignment(node) { diff --git a/tools/node_modules/eslint/lib/rules/keyword-spacing.js b/tools/node_modules/eslint/lib/rules/keyword-spacing.js index 913cf4682f..e9441ad170 100644 --- a/tools/node_modules/eslint/lib/rules/keyword-spacing.js +++ b/tools/node_modules/eslint/lib/rules/keyword-spacing.js @@ -22,7 +22,7 @@ const PREV_TOKEN_M = /^[)\]}>*]$/u; const NEXT_TOKEN_M = /^[{*]$/u; const TEMPLATE_OPEN_PAREN = /\$\{$/u; const TEMPLATE_CLOSE_PAREN = /^\}/u; -const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template)$/u; +const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template|PrivateIdentifier)$/u; const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of", "set", "yield"]); // check duplications. @@ -67,7 +67,6 @@ module.exports = { docs: { description: "enforce consistent spacing before and after keywords", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/keyword-spacing" }, @@ -403,7 +402,15 @@ module.exports = { */ function checkSpacingForForInStatement(node) { checkSpacingAroundFirstToken(node); - checkSpacingAroundTokenBefore(node.right); + + const inToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(inToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(inToken); + } + + checkSpacingAfter(inToken); } /** @@ -419,7 +426,15 @@ module.exports = { } else { checkSpacingAroundFirstToken(node); } - checkSpacingAround(sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken)); + + const ofToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(ofToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(ofToken); + } + + checkSpacingAfter(ofToken); } /** @@ -473,6 +488,7 @@ module.exports = { * Reports `static`, `get`, and `set` keywords of a given node if usage of * spacing around those keywords is invalid. * @param {ASTNode} node A node to report. + * @throws {Error} If unable to find token get, set, or async beside method name. * @returns {void} */ function checkSpacingForProperty(node) { @@ -567,6 +583,7 @@ module.exports = { // Others ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier, MethodDefinition: checkSpacingForProperty, + PropertyDefinition: checkSpacingForProperty, Property: checkSpacingForProperty }; } diff --git a/tools/node_modules/eslint/lib/rules/line-comment-position.js b/tools/node_modules/eslint/lib/rules/line-comment-position.js index 77ee147cbe..ad109a4f79 100644 --- a/tools/node_modules/eslint/lib/rules/line-comment-position.js +++ b/tools/node_modules/eslint/lib/rules/line-comment-position.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce position of line comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/line-comment-position" }, diff --git a/tools/node_modules/eslint/lib/rules/linebreak-style.js b/tools/node_modules/eslint/lib/rules/linebreak-style.js index b3b393ead7..92996ebd33 100644 --- a/tools/node_modules/eslint/lib/rules/linebreak-style.js +++ b/tools/node_modules/eslint/lib/rules/linebreak-style.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "enforce consistent linebreak style", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/linebreak-style" }, diff --git a/tools/node_modules/eslint/lib/rules/lines-around-comment.js b/tools/node_modules/eslint/lib/rules/lines-around-comment.js index 6806e793cd..79bcbb7fc1 100644 --- a/tools/node_modules/eslint/lib/rules/lines-around-comment.js +++ b/tools/node_modules/eslint/lib/rules/lines-around-comment.js @@ -55,7 +55,6 @@ module.exports = { docs: { description: "require empty lines around comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-around-comment" }, diff --git a/tools/node_modules/eslint/lib/rules/lines-around-directive.js b/tools/node_modules/eslint/lib/rules/lines-around-directive.js index fb439dad6a..c0c70e1a61 100644 --- a/tools/node_modules/eslint/lib/rules/lines-around-directive.js +++ b/tools/node_modules/eslint/lib/rules/lines-around-directive.js @@ -1,7 +1,7 @@ /** * @fileoverview Require or disallow newlines around directives. * @author Kai Cataldo - * @deprecated + * @deprecated in ESLint v4.0.0 */ "use strict"; @@ -18,7 +18,6 @@ module.exports = { docs: { description: "require or disallow newlines around directives", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-around-directive" }, diff --git a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js index 9723530369..e4c05f3050 100644 --- a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js +++ b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js @@ -4,6 +4,10 @@ */ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + const astUtils = require("./utils/ast-utils"); //------------------------------------------------------------------------------ @@ -16,7 +20,6 @@ module.exports = { docs: { description: "require or disallow an empty line between class members", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-between-class-members" }, @@ -53,6 +56,51 @@ module.exports = { const sourceCode = context.getSourceCode(); + /** + * Gets a pair of tokens that should be used to check lines between two class member nodes. + * + * In most cases, this returns the very last token of the current node and + * the very first token of the next node. + * For example: + * + * class C { + * x = 1; // curLast: `;` nextFirst: `in` + * in = 2 + * } + * + * There is only one exception. If the given node ends with a semicolon, and it looks like + * a semicolon-less style's semicolon - one that is not on the same line as the preceding + * token, but is on the line where the next class member starts - this returns the preceding + * token and the semicolon as boundary tokens. + * For example: + * + * class C { + * x = 1 // curLast: `1` nextFirst: `;` + * ;in = 2 + * } + * When determining the desired layout of the code, we should treat this semicolon as + * a part of the next class member node instead of the one it technically belongs to. + * @param {ASTNode} curNode Current class member node. + * @param {ASTNode} nextNode Next class member node. + * @returns {Token} The actual last token of `node`. + * @private + */ + function getBoundaryTokens(curNode, nextNode) { + const lastToken = sourceCode.getLastToken(curNode); + const prevToken = sourceCode.getTokenBefore(lastToken); + const nextToken = sourceCode.getFirstToken(nextNode); // skip possible lone `;` between nodes + + const isSemicolonLessStyle = ( + astUtils.isSemicolonToken(lastToken) && + !astUtils.isTokenOnSameLine(prevToken, lastToken) && + astUtils.isTokenOnSameLine(lastToken, nextToken) + ); + + return isSemicolonLessStyle + ? { curLast: prevToken, nextFirst: lastToken } + : { curLast: lastToken, nextFirst: nextToken }; + } + /** * Return the last token among the consecutive tokens that have no exceed max line difference in between, before the first token in the next member. * @param {Token} prevLastToken The last token in the previous member node. @@ -101,8 +149,7 @@ module.exports = { for (let i = 0; i < body.length - 1; i++) { const curFirst = sourceCode.getFirstToken(body[i]); - const curLast = sourceCode.getLastToken(body[i]); - const nextFirst = sourceCode.getFirstToken(body[i + 1]); + const { curLast, nextFirst } = getBoundaryTokens(body[i], body[i + 1]); const isMulti = !astUtils.isTokenOnSameLine(curFirst, curLast); const skip = !isMulti && options[1].exceptAfterSingleLine; const beforePadding = findLastConsecutiveTokenAfter(curLast, nextFirst, 1); diff --git a/tools/node_modules/eslint/lib/rules/max-classes-per-file.js b/tools/node_modules/eslint/lib/rules/max-classes-per-file.js index bb48a546e9..3d26108a71 100644 --- a/tools/node_modules/eslint/lib/rules/max-classes-per-file.js +++ b/tools/node_modules/eslint/lib/rules/max-classes-per-file.js @@ -19,15 +19,31 @@ module.exports = { docs: { description: "enforce a maximum number of classes per file", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/max-classes-per-file" }, schema: [ { - type: "integer", - minimum: 1 + oneOf: [ + { + type: "integer", + minimum: 1 + }, + { + type: "object", + properties: { + ignoreExpressions: { + type: "boolean" + }, + max: { + type: "integer", + minimum: 1 + } + }, + additionalProperties: false + } + ] } ], @@ -36,8 +52,10 @@ module.exports = { } }, create(context) { - - const maxClasses = context.options[0] || 1; + const [option = {}] = context.options; + const [ignoreExpressions, max] = typeof option === "number" + ? [false, option || 1] + : [option.ignoreExpressions, option.max || 1]; let classCount = 0; @@ -46,19 +64,24 @@ module.exports = { classCount = 0; }, "Program:exit"(node) { - if (classCount > maxClasses) { + if (classCount > max) { context.report({ node, messageId: "maximumExceeded", data: { classCount, - max: maxClasses + max } }); } }, - "ClassDeclaration, ClassExpression"() { + "ClassDeclaration"() { classCount++; + }, + "ClassExpression"() { + if (!ignoreExpressions) { + classCount++; + } } }; } diff --git a/tools/node_modules/eslint/lib/rules/max-depth.js b/tools/node_modules/eslint/lib/rules/max-depth.js index 5c5296bec0..415598b292 100644 --- a/tools/node_modules/eslint/lib/rules/max-depth.js +++ b/tools/node_modules/eslint/lib/rules/max-depth.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce a maximum depth that blocks can be nested", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-depth" }, diff --git a/tools/node_modules/eslint/lib/rules/max-len.js b/tools/node_modules/eslint/lib/rules/max-len.js index dd76760c50..8c7985d3e1 100644 --- a/tools/node_modules/eslint/lib/rules/max-len.js +++ b/tools/node_modules/eslint/lib/rules/max-len.js @@ -69,7 +69,6 @@ module.exports = { docs: { description: "enforce a maximum line length", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-len" }, @@ -215,7 +214,7 @@ module.exports = { * Ensure that an array exists at [key] on `object`, and add `value` to it. * @param {Object} object the object to mutate * @param {string} key the object's key - * @param {*} value the value to add + * @param {any} value the value to add * @returns {void} * @private */ diff --git a/tools/node_modules/eslint/lib/rules/max-lines-per-function.js b/tools/node_modules/eslint/lib/rules/max-lines-per-function.js index 60e2e879f5..b2130ca260 100644 --- a/tools/node_modules/eslint/lib/rules/max-lines-per-function.js +++ b/tools/node_modules/eslint/lib/rules/max-lines-per-function.js @@ -48,7 +48,7 @@ const OPTIONS_OR_INTEGER_SCHEMA = { /** * Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values. * @param {Array} comments An array of comment nodes. - * @returns {Map.} A map with numeric keys (source code line numbers) and comment token values. + * @returns {Map} A map with numeric keys (source code line numbers) and comment token values. */ function getCommentLineNumbers(comments) { const map = new Map(); @@ -71,7 +71,6 @@ module.exports = { docs: { description: "enforce a maximum number of lines of code in a function", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-lines-per-function" }, diff --git a/tools/node_modules/eslint/lib/rules/max-lines.js b/tools/node_modules/eslint/lib/rules/max-lines.js index 8bd5a1c95f..291d7d9c1a 100644 --- a/tools/node_modules/eslint/lib/rules/max-lines.js +++ b/tools/node_modules/eslint/lib/rules/max-lines.js @@ -34,7 +34,6 @@ module.exports = { docs: { description: "enforce a maximum number of lines per file", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-lines" }, @@ -137,20 +136,6 @@ module.exports = { return []; } - /** - * Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. - * TODO(stephenwade): Replace this with array.flatMap when we drop support for Node v10 - * @param {any[]} array The array to process - * @param {Function} fn The function to use - * @returns {any[]} The result array - */ - function flatMap(array, fn) { - const mapped = array.map(fn); - const flattened = [].concat(...mapped); - - return flattened; - } - return { "Program:exit"() { let lines = sourceCode.lines.map((text, i) => ({ @@ -173,7 +158,7 @@ module.exports = { if (skipComments) { const comments = sourceCode.getAllComments(); - const commentLines = flatMap(comments, comment => getLinesWithoutCode(comment)); + const commentLines = comments.flatMap(getLinesWithoutCode); lines = lines.filter( l => !commentLines.includes(l.lineNumber) diff --git a/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js b/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js index df1baceeb4..df24a96da5 100644 --- a/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js +++ b/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce a maximum depth that callbacks can be nested", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-nested-callbacks" }, diff --git a/tools/node_modules/eslint/lib/rules/max-params.js b/tools/node_modules/eslint/lib/rules/max-params.js index 8fb798401c..c8be60e577 100644 --- a/tools/node_modules/eslint/lib/rules/max-params.js +++ b/tools/node_modules/eslint/lib/rules/max-params.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "enforce a maximum number of parameters in function definitions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-params" }, diff --git a/tools/node_modules/eslint/lib/rules/max-statements-per-line.js b/tools/node_modules/eslint/lib/rules/max-statements-per-line.js index 5407cff3c5..7c743292bd 100644 --- a/tools/node_modules/eslint/lib/rules/max-statements-per-line.js +++ b/tools/node_modules/eslint/lib/rules/max-statements-per-line.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce a maximum number of statements allowed per line", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-statements-per-line" }, diff --git a/tools/node_modules/eslint/lib/rules/max-statements.js b/tools/node_modules/eslint/lib/rules/max-statements.js index 65d5539550..6f48c9218a 100644 --- a/tools/node_modules/eslint/lib/rules/max-statements.js +++ b/tools/node_modules/eslint/lib/rules/max-statements.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "enforce a maximum number of statements allowed in function blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-statements" }, diff --git a/tools/node_modules/eslint/lib/rules/multiline-comment-style.js b/tools/node_modules/eslint/lib/rules/multiline-comment-style.js index 9524818b8b..da5ee50df4 100644 --- a/tools/node_modules/eslint/lib/rules/multiline-comment-style.js +++ b/tools/node_modules/eslint/lib/rules/multiline-comment-style.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce a particular style for multiline comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/multiline-comment-style" }, diff --git a/tools/node_modules/eslint/lib/rules/multiline-ternary.js b/tools/node_modules/eslint/lib/rules/multiline-ternary.js index 98360b9cad..6f468c828c 100644 --- a/tools/node_modules/eslint/lib/rules/multiline-ternary.js +++ b/tools/node_modules/eslint/lib/rules/multiline-ternary.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce newlines between operands of ternary expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/multiline-ternary" }, diff --git a/tools/node_modules/eslint/lib/rules/new-cap.js b/tools/node_modules/eslint/lib/rules/new-cap.js index 4249a54280..9abf3379b8 100644 --- a/tools/node_modules/eslint/lib/rules/new-cap.js +++ b/tools/node_modules/eslint/lib/rules/new-cap.js @@ -33,7 +33,8 @@ const CAPS_ALLOWED = [ * Ensure that if the key is provided, it must be an array. * @param {Object} obj Object to check with `key`. * @param {string} key Object key to check on `obj`. - * @param {*} fallback If obj[key] is not present, this will be returned. + * @param {any} fallback If obj[key] is not present, this will be returned. + * @throws {TypeError} If key is not an own array type property of `obj`. * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` */ function checkArray(obj, key, fallback) { @@ -81,7 +82,6 @@ module.exports = { docs: { description: "require constructor names to begin with a capital letter", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/new-cap" }, diff --git a/tools/node_modules/eslint/lib/rules/new-parens.js b/tools/node_modules/eslint/lib/rules/new-parens.js index 405ec1b515..786300dba7 100644 --- a/tools/node_modules/eslint/lib/rules/new-parens.js +++ b/tools/node_modules/eslint/lib/rules/new-parens.js @@ -25,7 +25,6 @@ module.exports = { docs: { description: "enforce or disallow parentheses when invoking a constructor with no arguments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/new-parens" }, diff --git a/tools/node_modules/eslint/lib/rules/newline-after-var.js b/tools/node_modules/eslint/lib/rules/newline-after-var.js index 4809d9bfc5..3eea1b1f73 100644 --- a/tools/node_modules/eslint/lib/rules/newline-after-var.js +++ b/tools/node_modules/eslint/lib/rules/newline-after-var.js @@ -1,7 +1,7 @@ /** * @fileoverview Rule to check empty newline after "var" statement * @author Gopal Venkatesan - * @deprecated + * @deprecated in ESLint v4.0.0 */ "use strict"; @@ -22,7 +22,6 @@ module.exports = { docs: { description: "require or disallow an empty line after variable declarations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-after-var" }, @@ -145,9 +144,9 @@ module.exports = { /** * Determine if a token starts more than one line after a comment ends - * @param {token} token The token being checked - * @param {integer} commentStartLine The line number on which the comment starts - * @returns {boolean} True if `token` does not start immediately after a comment + * @param {token} token The token being checked + * @param {integer} commentStartLine The line number on which the comment starts + * @returns {boolean} True if `token` does not start immediately after a comment */ function hasBlankLineAfterComment(token, commentStartLine) { return token.loc.start.line > getLastCommentLineOfBlock(commentStartLine) + 1; diff --git a/tools/node_modules/eslint/lib/rules/newline-before-return.js b/tools/node_modules/eslint/lib/rules/newline-before-return.js index 65ca32321c..fd6341e67c 100644 --- a/tools/node_modules/eslint/lib/rules/newline-before-return.js +++ b/tools/node_modules/eslint/lib/rules/newline-before-return.js @@ -1,7 +1,7 @@ /** * @fileoverview Rule to require newlines before `return` statement * @author Kai Cataldo - * @deprecated + * @deprecated in ESLint v4.0.0 */ "use strict"; @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require an empty line before `return` statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-before-return" }, diff --git a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js index 46c9d6c10f..8de9a6a239 100644 --- a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js +++ b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js @@ -18,7 +18,6 @@ module.exports = { docs: { description: "require a newline after each call in a method chain", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-per-chained-call" }, @@ -53,7 +52,7 @@ module.exports = { * Get the prefix of a given MemberExpression node. * If the MemberExpression node is a computed value it returns a * left bracket. If not it returns a period. - * @param {ASTNode} node A MemberExpression node to get + * @param {ASTNode} node A MemberExpression node to get * @returns {string} The prefix of the node. */ function getPrefix(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-alert.js b/tools/node_modules/eslint/lib/rules/no-alert.js index 702b4d2ba7..918b98489a 100644 --- a/tools/node_modules/eslint/lib/rules/no-alert.js +++ b/tools/node_modules/eslint/lib/rules/no-alert.js @@ -88,7 +88,6 @@ module.exports = { docs: { description: "disallow the use of `alert`, `confirm`, and `prompt`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-alert" }, diff --git a/tools/node_modules/eslint/lib/rules/no-array-constructor.js b/tools/node_modules/eslint/lib/rules/no-array-constructor.js index 90c6d6bbd5..0904fa6d8f 100644 --- a/tools/node_modules/eslint/lib/rules/no-array-constructor.js +++ b/tools/node_modules/eslint/lib/rules/no-array-constructor.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow `Array` constructors", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-array-constructor" }, diff --git a/tools/node_modules/eslint/lib/rules/no-async-promise-executor.js b/tools/node_modules/eslint/lib/rules/no-async-promise-executor.js index 553311e580..27116f1da7 100644 --- a/tools/node_modules/eslint/lib/rules/no-async-promise-executor.js +++ b/tools/node_modules/eslint/lib/rules/no-async-promise-executor.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow using an async function as a Promise executor", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-async-promise-executor" }, diff --git a/tools/node_modules/eslint/lib/rules/no-await-in-loop.js b/tools/node_modules/eslint/lib/rules/no-await-in-loop.js index 9ca89866a6..38af8b56c1 100644 --- a/tools/node_modules/eslint/lib/rules/no-await-in-loop.js +++ b/tools/node_modules/eslint/lib/rules/no-await-in-loop.js @@ -59,7 +59,6 @@ module.exports = { docs: { description: "disallow `await` inside of loops", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-await-in-loop" }, diff --git a/tools/node_modules/eslint/lib/rules/no-bitwise.js b/tools/node_modules/eslint/lib/rules/no-bitwise.js index a9c3360a7c..10bf24a299 100644 --- a/tools/node_modules/eslint/lib/rules/no-bitwise.js +++ b/tools/node_modules/eslint/lib/rules/no-bitwise.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "disallow bitwise operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-bitwise" }, @@ -63,7 +62,7 @@ module.exports = { /** * Reports an unexpected use of a bitwise operator. - * @param {ASTNode} node Node which contains the bitwise operator. + * @param {ASTNode} node Node which contains the bitwise operator. * @returns {void} */ function report(node) { @@ -72,7 +71,7 @@ module.exports = { /** * Checks if the given node has a bitwise operator. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node has a bitwise operator. */ function hasBitwiseOperator(node) { @@ -81,7 +80,7 @@ module.exports = { /** * Checks if exceptions were provided, e.g. `{ allow: ['~', '|'] }`. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node has a bitwise operator. */ function allowedOperator(node) { @@ -90,7 +89,7 @@ module.exports = { /** * Checks if the given bitwise operator is used for integer typecasting, i.e. "|0" - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} whether the node is used in integer typecasting. */ function isInt32Hint(node) { @@ -100,7 +99,7 @@ module.exports = { /** * Report if the given node contains a bitwise operator. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {void} */ function checkNodeForBitwiseOperator(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js b/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js index 152dda0cea..cc5906e78a 100644 --- a/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js +++ b/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js @@ -1,6 +1,7 @@ /** * @fileoverview disallow use of the Buffer() constructor * @author Teddy Katz + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -18,7 +19,6 @@ module.exports = { docs: { description: "disallow use of the `Buffer()` constructor", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-buffer-constructor" }, diff --git a/tools/node_modules/eslint/lib/rules/no-caller.js b/tools/node_modules/eslint/lib/rules/no-caller.js index 5fe1bd4498..dbb527906f 100644 --- a/tools/node_modules/eslint/lib/rules/no-caller.js +++ b/tools/node_modules/eslint/lib/rules/no-caller.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow the use of `arguments.caller` or `arguments.callee`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-caller" }, diff --git a/tools/node_modules/eslint/lib/rules/no-case-declarations.js b/tools/node_modules/eslint/lib/rules/no-case-declarations.js index 1d54e22162..a132f0370f 100644 --- a/tools/node_modules/eslint/lib/rules/no-case-declarations.js +++ b/tools/node_modules/eslint/lib/rules/no-case-declarations.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow lexical declarations in case clauses", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-case-declarations" }, diff --git a/tools/node_modules/eslint/lib/rules/no-catch-shadow.js b/tools/node_modules/eslint/lib/rules/no-catch-shadow.js index 4917af84e4..0cbeedf90b 100644 --- a/tools/node_modules/eslint/lib/rules/no-catch-shadow.js +++ b/tools/node_modules/eslint/lib/rules/no-catch-shadow.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow `catch` clause parameters from shadowing variables in the outer scope", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-catch-shadow" }, diff --git a/tools/node_modules/eslint/lib/rules/no-class-assign.js b/tools/node_modules/eslint/lib/rules/no-class-assign.js index 887058ba0f..839ad03e29 100644 --- a/tools/node_modules/eslint/lib/rules/no-class-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-class-assign.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow reassigning class members", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-class-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js b/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js index 0c6865ad59..e8fdaa0cc6 100644 --- a/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js +++ b/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow comparing against -0", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-compare-neg-zero" }, diff --git a/tools/node_modules/eslint/lib/rules/no-cond-assign.js b/tools/node_modules/eslint/lib/rules/no-cond-assign.js index 3843a7ac2e..42f75af7d0 100644 --- a/tools/node_modules/eslint/lib/rules/no-cond-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-cond-assign.js @@ -34,7 +34,6 @@ module.exports = { docs: { description: "disallow assignment operators in conditional expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-cond-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js b/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js index 9009b64fa1..fa87f4012e 100644 --- a/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js +++ b/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js @@ -31,7 +31,6 @@ module.exports = { docs: { description: "disallow arrow functions where they could be confused with comparisons", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-confusing-arrow" }, diff --git a/tools/node_modules/eslint/lib/rules/no-console.js b/tools/node_modules/eslint/lib/rules/no-console.js index 56dbbc3a9f..a5937cbddb 100644 --- a/tools/node_modules/eslint/lib/rules/no-console.js +++ b/tools/node_modules/eslint/lib/rules/no-console.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow the use of `console`", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-console" }, diff --git a/tools/node_modules/eslint/lib/rules/no-const-assign.js b/tools/node_modules/eslint/lib/rules/no-const-assign.js index e4ae891705..6ca1b6107a 100644 --- a/tools/node_modules/eslint/lib/rules/no-const-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-const-assign.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow reassigning `const` variables", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-const-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-constant-condition.js b/tools/node_modules/eslint/lib/rules/no-constant-condition.js index 3c2d68cbf6..7a7030a9a4 100644 --- a/tools/node_modules/eslint/lib/rules/no-constant-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-constant-condition.js @@ -19,7 +19,6 @@ module.exports = { docs: { description: "disallow constant expressions in conditions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-constant-condition" }, diff --git a/tools/node_modules/eslint/lib/rules/no-constructor-return.js b/tools/node_modules/eslint/lib/rules/no-constructor-return.js index 4757770b7c..b4b5baf743 100644 --- a/tools/node_modules/eslint/lib/rules/no-constructor-return.js +++ b/tools/node_modules/eslint/lib/rules/no-constructor-return.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow returning value from constructor", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-constructor-return" }, diff --git a/tools/node_modules/eslint/lib/rules/no-continue.js b/tools/node_modules/eslint/lib/rules/no-continue.js index 96718d17a3..e72e862df5 100644 --- a/tools/node_modules/eslint/lib/rules/no-continue.js +++ b/tools/node_modules/eslint/lib/rules/no-continue.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow `continue` statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-continue" }, diff --git a/tools/node_modules/eslint/lib/rules/no-control-regex.js b/tools/node_modules/eslint/lib/rules/no-control-regex.js index 6feeb6419d..908d61ae44 100644 --- a/tools/node_modules/eslint/lib/rules/no-control-regex.js +++ b/tools/node_modules/eslint/lib/rules/no-control-regex.js @@ -52,7 +52,6 @@ module.exports = { docs: { description: "disallow control characters in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-control-regex" }, diff --git a/tools/node_modules/eslint/lib/rules/no-debugger.js b/tools/node_modules/eslint/lib/rules/no-debugger.js index 95a28a8621..46dd57639c 100644 --- a/tools/node_modules/eslint/lib/rules/no-debugger.js +++ b/tools/node_modules/eslint/lib/rules/no-debugger.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow the use of `debugger`", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-debugger" }, diff --git a/tools/node_modules/eslint/lib/rules/no-delete-var.js b/tools/node_modules/eslint/lib/rules/no-delete-var.js index aeab951d75..1438ebc33b 100644 --- a/tools/node_modules/eslint/lib/rules/no-delete-var.js +++ b/tools/node_modules/eslint/lib/rules/no-delete-var.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow deleting variables", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-delete-var" }, diff --git a/tools/node_modules/eslint/lib/rules/no-div-regex.js b/tools/node_modules/eslint/lib/rules/no-div-regex.js index 0ccabdcc69..40388c366e 100644 --- a/tools/node_modules/eslint/lib/rules/no-div-regex.js +++ b/tools/node_modules/eslint/lib/rules/no-div-regex.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow division operators explicitly at the beginning of regular expressions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-div-regex" }, diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-args.js b/tools/node_modules/eslint/lib/rules/no-dupe-args.js index 817277f522..0880b9c812 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-args.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-args.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow duplicate arguments in `function` definitions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-args" }, diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js b/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js index b12939d57b..f74865b82a 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow duplicate class members", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-class-members" }, @@ -73,20 +72,21 @@ module.exports = { }, // Reports the node if its name has been declared already. - MethodDefinition(node) { + "MethodDefinition, PropertyDefinition"(node) { const name = astUtils.getStaticPropertyName(node); + const kind = node.type === "MethodDefinition" ? node.kind : "field"; - if (name === null || node.kind === "constructor") { + if (name === null || kind === "constructor") { return; } const state = getState(name, node.static); let isDuplicate = false; - if (node.kind === "get") { + if (kind === "get") { isDuplicate = (state.init || state.get); state.get = true; - } else if (node.kind === "set") { + } else if (kind === "set") { isDuplicate = (state.init || state.set); state.set = true; } else { diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-else-if.js b/tools/node_modules/eslint/lib/rules/no-dupe-else-if.js index cbeb437da1..0d8b17cc0a 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-else-if.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-else-if.js @@ -52,7 +52,6 @@ module.exports = { docs: { description: "disallow duplicate conditions in if-else-if chains", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-else-if" }, diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-keys.js b/tools/node_modules/eslint/lib/rules/no-dupe-keys.js index 89e1f2de64..ecec022185 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-keys.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-keys.js @@ -23,7 +23,6 @@ const SET_KIND = /^(?:init|set)$/u; */ class ObjectInfo { - // eslint-disable-next-line jsdoc/require-description /** * @param {ObjectInfo|null} upper The information of the outer object. * @param {ASTNode} node The ObjectExpression node of this information. @@ -89,7 +88,6 @@ module.exports = { docs: { description: "disallow duplicate keys in object literals", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-keys" }, diff --git a/tools/node_modules/eslint/lib/rules/no-duplicate-case.js b/tools/node_modules/eslint/lib/rules/no-duplicate-case.js index e2d9665e7f..4669dcee1b 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-case.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-case.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow duplicate case labels", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-duplicate-case" }, diff --git a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js index cc3da1d5a6..2663698dc9 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js @@ -233,7 +233,6 @@ module.exports = { docs: { description: "disallow duplicate module imports", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-duplicate-imports" }, diff --git a/tools/node_modules/eslint/lib/rules/no-else-return.js b/tools/node_modules/eslint/lib/rules/no-else-return.js index 84409fac87..4c981ae159 100644 --- a/tools/node_modules/eslint/lib/rules/no-else-return.js +++ b/tools/node_modules/eslint/lib/rules/no-else-return.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow `else` blocks after `return` statements in `if` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-else-return" }, diff --git a/tools/node_modules/eslint/lib/rules/no-empty-character-class.js b/tools/node_modules/eslint/lib/rules/no-empty-character-class.js index 7dc219fe1a..85e8ef7679 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty-character-class.js +++ b/tools/node_modules/eslint/lib/rules/no-empty-character-class.js @@ -12,16 +12,13 @@ /* * plain-English description of the following regexp: * 0. `^` fix the match at the beginning of the string - * 1. `\/`: the `/` that begins the regexp - * 2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following - * 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) - * 2.1. `\\.`: an escape sequence - * 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty - * 3. `\/` the `/` that ends the regexp - * 4. `[gimuy]*`: optional regexp flags - * 5. `$`: fix the match at the end of the string + * 1. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following + * 1.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) + * 1.1. `\\.`: an escape sequence + * 1.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty + * 2. `$`: fix the match at the end of the string */ -const regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimuys]*$/u; +const regex = /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u; //------------------------------------------------------------------------------ // Rule Definition @@ -33,7 +30,6 @@ module.exports = { docs: { description: "disallow empty character classes in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-empty-character-class" }, @@ -46,18 +42,12 @@ module.exports = { }, create(context) { - const sourceCode = context.getSourceCode(); - return { - - Literal(node) { - const token = sourceCode.getFirstToken(node); - - if (token.type === "RegularExpression" && !regex.test(token.value)) { + "Literal[regex]"(node) { + if (!regex.test(node.regex.pattern)) { context.report({ node, messageId: "unexpected" }); } } - }; } diff --git a/tools/node_modules/eslint/lib/rules/no-empty-function.js b/tools/node_modules/eslint/lib/rules/no-empty-function.js index c512f8cd5f..8b1073a59d 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty-function.js +++ b/tools/node_modules/eslint/lib/rules/no-empty-function.js @@ -95,7 +95,6 @@ module.exports = { docs: { description: "disallow empty functions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-empty-function" }, diff --git a/tools/node_modules/eslint/lib/rules/no-empty-pattern.js b/tools/node_modules/eslint/lib/rules/no-empty-pattern.js index 9f34bfde92..99ea3a7905 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty-pattern.js +++ b/tools/node_modules/eslint/lib/rules/no-empty-pattern.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow empty destructuring patterns", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-empty-pattern" }, diff --git a/tools/node_modules/eslint/lib/rules/no-empty.js b/tools/node_modules/eslint/lib/rules/no-empty.js index 45bf03c13a..4ed3c5c545 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty.js +++ b/tools/node_modules/eslint/lib/rules/no-empty.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow empty block statements", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-empty" }, diff --git a/tools/node_modules/eslint/lib/rules/no-eq-null.js b/tools/node_modules/eslint/lib/rules/no-eq-null.js index b8dead96d2..dae922840b 100644 --- a/tools/node_modules/eslint/lib/rules/no-eq-null.js +++ b/tools/node_modules/eslint/lib/rules/no-eq-null.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow `null` comparisons without type-checking operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-eq-null" }, diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js index a020fdee01..9748152835 100644 --- a/tools/node_modules/eslint/lib/rules/no-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-eval.js @@ -43,7 +43,6 @@ module.exports = { docs: { description: "disallow the use of `eval()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-eval" }, @@ -247,6 +246,8 @@ module.exports = { "FunctionExpression:exit": exitVarScope, ArrowFunctionExpression: enterVarScope, "ArrowFunctionExpression:exit": exitVarScope, + "PropertyDefinition > *.value": enterVarScope, + "PropertyDefinition > *.value:exit": exitVarScope, ThisExpression(node) { if (!isMember(node.parent, "eval")) { diff --git a/tools/node_modules/eslint/lib/rules/no-ex-assign.js b/tools/node_modules/eslint/lib/rules/no-ex-assign.js index 1163920361..cd56c94af7 100644 --- a/tools/node_modules/eslint/lib/rules/no-ex-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-ex-assign.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow reassigning exceptions in `catch` clauses", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-ex-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-extend-native.js b/tools/node_modules/eslint/lib/rules/no-extend-native.js index 2a804b5639..4d5accbae6 100644 --- a/tools/node_modules/eslint/lib/rules/no-extend-native.js +++ b/tools/node_modules/eslint/lib/rules/no-extend-native.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow extending native types", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extend-native" }, diff --git a/tools/node_modules/eslint/lib/rules/no-extra-bind.js b/tools/node_modules/eslint/lib/rules/no-extra-bind.js index 2db440dc1e..6fd3be1d60 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-bind.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-bind.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "disallow unnecessary calls to `.bind()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extra-bind" }, diff --git a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js index 6ae3ea62ca..cb061dac5d 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js @@ -24,7 +24,6 @@ module.exports = { docs: { description: "disallow unnecessary boolean casts", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-extra-boolean-cast" }, @@ -150,6 +149,7 @@ module.exports = { * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. * @param {ASTNode} previousNode Previous node. * @param {ASTNode} node The node to check. + * @throws {Error} (Unreachable.) * @returns {boolean} `true` if the node needs to be parenthesized. */ function needsParens(previousNode, node) { diff --git a/tools/node_modules/eslint/lib/rules/no-extra-label.js b/tools/node_modules/eslint/lib/rules/no-extra-label.js index 81406e7609..bbb2413b2c 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-label.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-label.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow unnecessary labels", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extra-label" }, diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js index 307e340c95..0756d2fb2c 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow unnecessary parentheses", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-extra-parens" }, @@ -808,13 +807,6 @@ module.exports = { CallExpression: checkCallNew, - ClassBody(node) { - node.body - .filter(member => member.type === "MethodDefinition" && member.computed && member.key) - .filter(member => hasExcessParensWithPrecedence(member.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) - .forEach(member => report(member.key)); - }, - ConditionalExpression(node) { if (isReturnAssignException(node)) { return; @@ -1063,6 +1055,12 @@ module.exports = { } }, + "MethodDefinition[computed=true]"(node) { + if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + }, + NewExpression: checkCallNew, ObjectExpression(node) { @@ -1090,6 +1088,16 @@ module.exports = { } }, + PropertyDefinition(node) { + if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + + if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.value); + } + }, + RestElement(node) { const argument = node.argument; diff --git a/tools/node_modules/eslint/lib/rules/no-extra-semi.js b/tools/node_modules/eslint/lib/rules/no-extra-semi.js index e0a8df0565..952869c3ea 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-semi.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-semi.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow unnecessary semicolons", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-extra-semi" }, @@ -117,7 +116,7 @@ module.exports = { * @param {Node} node A MethodDefinition node of the start point. * @returns {void} */ - MethodDefinition(node) { + "MethodDefinition, PropertyDefinition"(node) { checkForPartOfClassBody(sourceCode.getTokenAfter(node)); } }; diff --git a/tools/node_modules/eslint/lib/rules/no-fallthrough.js b/tools/node_modules/eslint/lib/rules/no-fallthrough.js index 3b949acd1d..bf2c82514b 100644 --- a/tools/node_modules/eslint/lib/rules/no-fallthrough.js +++ b/tools/node_modules/eslint/lib/rules/no-fallthrough.js @@ -64,7 +64,6 @@ module.exports = { docs: { description: "disallow fallthrough of `case` statements", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-fallthrough" }, diff --git a/tools/node_modules/eslint/lib/rules/no-floating-decimal.js b/tools/node_modules/eslint/lib/rules/no-floating-decimal.js index b1d883212e..92ac2326b9 100644 --- a/tools/node_modules/eslint/lib/rules/no-floating-decimal.js +++ b/tools/node_modules/eslint/lib/rules/no-floating-decimal.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow leading or trailing decimal points in numeric literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-floating-decimal" }, diff --git a/tools/node_modules/eslint/lib/rules/no-func-assign.js b/tools/node_modules/eslint/lib/rules/no-func-assign.js index 33d0ad9ecd..aa04f337ae 100644 --- a/tools/node_modules/eslint/lib/rules/no-func-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-func-assign.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow reassigning `function` declarations", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-func-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-global-assign.js b/tools/node_modules/eslint/lib/rules/no-global-assign.js index ea854c4aa8..85aac7cdc0 100644 --- a/tools/node_modules/eslint/lib/rules/no-global-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-global-assign.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow assignments to native objects or read-only global variables", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-global-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js index 993b8d1f1c..1d11e10d59 100644 --- a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js @@ -173,7 +173,6 @@ module.exports = { docs: { description: "disallow shorthand type conversions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implicit-coercion" }, diff --git a/tools/node_modules/eslint/lib/rules/no-implicit-globals.js b/tools/node_modules/eslint/lib/rules/no-implicit-globals.js index d4bfa3af82..8740cd8053 100644 --- a/tools/node_modules/eslint/lib/rules/no-implicit-globals.js +++ b/tools/node_modules/eslint/lib/rules/no-implicit-globals.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow declarations in the global scope", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implicit-globals" }, diff --git a/tools/node_modules/eslint/lib/rules/no-implied-eval.js b/tools/node_modules/eslint/lib/rules/no-implied-eval.js index b8120a6488..2432e68b61 100644 --- a/tools/node_modules/eslint/lib/rules/no-implied-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-implied-eval.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow the use of `eval()`-like methods", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implied-eval" }, diff --git a/tools/node_modules/eslint/lib/rules/no-import-assign.js b/tools/node_modules/eslint/lib/rules/no-import-assign.js index 41060d8ac9..fbe63d0539 100644 --- a/tools/node_modules/eslint/lib/rules/no-import-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-import-assign.js @@ -180,7 +180,6 @@ module.exports = { docs: { description: "disallow assigning to imported bindings", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-import-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-inline-comments.js b/tools/node_modules/eslint/lib/rules/no-inline-comments.js index dec278615e..8a955a6130 100644 --- a/tools/node_modules/eslint/lib/rules/no-inline-comments.js +++ b/tools/node_modules/eslint/lib/rules/no-inline-comments.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow inline comments after code", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-inline-comments" }, diff --git a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js index 0768bc6114..9bbe24d7c8 100644 --- a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js +++ b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js @@ -24,7 +24,6 @@ module.exports = { docs: { description: "disallow variable or `function` declarations in nested blocks", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-inner-declarations" }, diff --git a/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js b/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js index 94ad5ba6d5..ee19932896 100644 --- a/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js +++ b/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js @@ -10,7 +10,7 @@ const RegExpValidator = require("regexpp").RegExpValidator; const validator = new RegExpValidator(); -const validFlags = /[gimuys]/gu; +const validFlags = /[dgimsuy]/gu; const undefined1 = void 0; //------------------------------------------------------------------------------ @@ -23,7 +23,6 @@ module.exports = { docs: { description: "disallow invalid regular expression strings in `RegExp` constructors", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-invalid-regexp" }, diff --git a/tools/node_modules/eslint/lib/rules/no-invalid-this.js b/tools/node_modules/eslint/lib/rules/no-invalid-this.js index a79c586d71..77558b90dc 100644 --- a/tools/node_modules/eslint/lib/rules/no-invalid-this.js +++ b/tools/node_modules/eslint/lib/rules/no-invalid-this.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow `this` keywords outside of classes or class-like objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-invalid-this" }, @@ -129,6 +128,10 @@ module.exports = { FunctionExpression: enterFunction, "FunctionExpression:exit": exitFunction, + // Field initializers are implicit functions. + "PropertyDefinition > *.value": enterFunction, + "PropertyDefinition > *.value:exit": exitFunction, + // Reports if `this` of the current context is invalid. ThisExpression(node) { const current = stack.getCurrent(); diff --git a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js index 15711c6157..c160971539 100644 --- a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js +++ b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js @@ -31,7 +31,6 @@ module.exports = { docs: { description: "disallow irregular whitespace", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-irregular-whitespace" }, diff --git a/tools/node_modules/eslint/lib/rules/no-iterator.js b/tools/node_modules/eslint/lib/rules/no-iterator.js index 9ba1e7aefd..4117f6211c 100644 --- a/tools/node_modules/eslint/lib/rules/no-iterator.js +++ b/tools/node_modules/eslint/lib/rules/no-iterator.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow the use of the `__iterator__` property", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-iterator" }, diff --git a/tools/node_modules/eslint/lib/rules/no-label-var.js b/tools/node_modules/eslint/lib/rules/no-label-var.js index 570db03285..4532527c6e 100644 --- a/tools/node_modules/eslint/lib/rules/no-label-var.js +++ b/tools/node_modules/eslint/lib/rules/no-label-var.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow labels that share a name with a variable", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-label-var" }, diff --git a/tools/node_modules/eslint/lib/rules/no-labels.js b/tools/node_modules/eslint/lib/rules/no-labels.js index 85760d80db..5dd15be092 100644 --- a/tools/node_modules/eslint/lib/rules/no-labels.js +++ b/tools/node_modules/eslint/lib/rules/no-labels.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow labeled statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-labels" }, diff --git a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js index 290784b82e..5f74cd83c8 100644 --- a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js +++ b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow unnecessary nested blocks", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-lone-blocks" }, diff --git a/tools/node_modules/eslint/lib/rules/no-lonely-if.js b/tools/node_modules/eslint/lib/rules/no-lonely-if.js index 6552adc575..e44f000141 100644 --- a/tools/node_modules/eslint/lib/rules/no-lonely-if.js +++ b/tools/node_modules/eslint/lib/rules/no-lonely-if.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow `if` statements as the only statement in `else` blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-lonely-if" }, diff --git a/tools/node_modules/eslint/lib/rules/no-loop-func.js b/tools/node_modules/eslint/lib/rules/no-loop-func.js index 13ebd3ee22..d1a7868072 100644 --- a/tools/node_modules/eslint/lib/rules/no-loop-func.js +++ b/tools/node_modules/eslint/lib/rules/no-loop-func.js @@ -154,7 +154,6 @@ module.exports = { docs: { description: "disallow function declarations that contain unsafe references inside loop statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-loop-func" }, @@ -174,7 +173,7 @@ module.exports = { * - has a loop node in ancestors. * - has any references which refers to an unsafe variable. * @param {ASTNode} node The AST node to check. - * @returns {boolean} Whether or not the node is within a loop. + * @returns {void} */ function checkForLoops(node) { const loopNode = getContainingLoopNode(node); diff --git a/tools/node_modules/eslint/lib/rules/no-loss-of-precision.js b/tools/node_modules/eslint/lib/rules/no-loss-of-precision.js index 2d0c618422..417616dd23 100644 --- a/tools/node_modules/eslint/lib/rules/no-loss-of-precision.js +++ b/tools/node_modules/eslint/lib/rules/no-loss-of-precision.js @@ -15,8 +15,7 @@ module.exports = { docs: { description: "disallow literal numbers that lose precision", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-loss-of-precision" }, schema: [], diff --git a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js index 510b3f9b26..a2c678e710 100644 --- a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js +++ b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -32,7 +32,6 @@ module.exports = { docs: { description: "disallow magic numbers", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-magic-numbers" }, diff --git a/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js b/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js index 3d004615c3..70e31e604f 100644 --- a/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js +++ b/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js @@ -104,7 +104,6 @@ module.exports = { docs: { description: "disallow characters which are made with multiple code points in character class syntax", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-misleading-character-class" }, diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-operators.js b/tools/node_modules/eslint/lib/rules/no-mixed-operators.js index 5a2e139a62..ed37a90b1c 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-operators.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-operators.js @@ -58,7 +58,7 @@ function normalizeOptions(options = {}) { /** * Checks whether any group which includes both given operator exists or not. - * @param {Array.} groups A list of groups to check. + * @param {Array} groups A list of groups to check. * @param {string} left An operator. * @param {string} right Another operator. * @returns {boolean} `true` if such group existed. @@ -88,7 +88,6 @@ module.exports = { docs: { description: "disallow mixed binary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-mixed-operators" }, diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js index a02de9104b..f7c2d11ee4 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js @@ -1,6 +1,7 @@ /** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -19,7 +20,6 @@ module.exports = { docs: { description: "disallow `require` calls to be mixed with regular variable declarations", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-mixed-requires" }, diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js b/tools/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js index 287cbda03d..ac73cddda3 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow mixed spaces and tabs for indentation", - category: "Stylistic Issues", recommended: true, url: "https://eslint.org/docs/rules/no-mixed-spaces-and-tabs" }, diff --git a/tools/node_modules/eslint/lib/rules/no-multi-assign.js b/tools/node_modules/eslint/lib/rules/no-multi-assign.js index d2606a1502..8d7bd32c7d 100644 --- a/tools/node_modules/eslint/lib/rules/no-multi-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-multi-assign.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow use of chained assignment expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-multi-assign" }, @@ -45,16 +44,21 @@ module.exports = { const options = context.options[0] || { ignoreNonDeclaration: false }; - const targetParent = options.ignoreNonDeclaration ? ["VariableDeclarator"] : ["AssignmentExpression", "VariableDeclarator"]; + const selectors = [ + "VariableDeclarator > AssignmentExpression.init", + "PropertyDefinition > AssignmentExpression.value" + ]; + + if (!options.ignoreNonDeclaration) { + selectors.push("AssignmentExpression > AssignmentExpression.right"); + } return { - AssignmentExpression(node) { - if (targetParent.indexOf(node.parent.type) !== -1) { - context.report({ - node, - messageId: "unexpectedChain" - }); - } + [selectors](node) { + context.report({ + node, + messageId: "unexpectedChain" + }); } }; diff --git a/tools/node_modules/eslint/lib/rules/no-multi-spaces.js b/tools/node_modules/eslint/lib/rules/no-multi-spaces.js index d43ed73633..0134dd279b 100644 --- a/tools/node_modules/eslint/lib/rules/no-multi-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-multi-spaces.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow multiple spaces", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-multi-spaces" }, diff --git a/tools/node_modules/eslint/lib/rules/no-multi-str.js b/tools/node_modules/eslint/lib/rules/no-multi-str.js index 7cf1ae3679..848f8d405a 100644 --- a/tools/node_modules/eslint/lib/rules/no-multi-str.js +++ b/tools/node_modules/eslint/lib/rules/no-multi-str.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow multiline strings", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-multi-str" }, diff --git a/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js b/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js index 9cccef3088..33ac76f603 100644 --- a/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +++ b/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow multiple empty lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-multiple-empty-lines" }, diff --git a/tools/node_modules/eslint/lib/rules/no-native-reassign.js b/tools/node_modules/eslint/lib/rules/no-native-reassign.js index 833e3b7ce4..80ba0948cb 100644 --- a/tools/node_modules/eslint/lib/rules/no-native-reassign.js +++ b/tools/node_modules/eslint/lib/rules/no-native-reassign.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow assignments to native objects or read-only global variables", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-native-reassign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-negated-condition.js b/tools/node_modules/eslint/lib/rules/no-negated-condition.js index 8a9eba881d..b5cbadca50 100644 --- a/tools/node_modules/eslint/lib/rules/no-negated-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-negated-condition.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow negated conditions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-negated-condition" }, diff --git a/tools/node_modules/eslint/lib/rules/no-negated-in-lhs.js b/tools/node_modules/eslint/lib/rules/no-negated-in-lhs.js index 1229cedd11..0f9c84be6c 100644 --- a/tools/node_modules/eslint/lib/rules/no-negated-in-lhs.js +++ b/tools/node_modules/eslint/lib/rules/no-negated-in-lhs.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow negating the left operand in `in` expressions", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-negated-in-lhs" }, diff --git a/tools/node_modules/eslint/lib/rules/no-nested-ternary.js b/tools/node_modules/eslint/lib/rules/no-nested-ternary.js index 383bb23888..2d3359d38f 100644 --- a/tools/node_modules/eslint/lib/rules/no-nested-ternary.js +++ b/tools/node_modules/eslint/lib/rules/no-nested-ternary.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow nested ternary expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-nested-ternary" }, diff --git a/tools/node_modules/eslint/lib/rules/no-new-func.js b/tools/node_modules/eslint/lib/rules/no-new-func.js index 9af4e31cab..ddf61024da 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-func.js +++ b/tools/node_modules/eslint/lib/rules/no-new-func.js @@ -5,6 +5,18 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const callMethods = new Set(["apply", "bind", "call"]); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -15,7 +27,6 @@ module.exports = { docs: { description: "disallow `new` operators with the `Function` object", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new-func" }, @@ -38,14 +49,30 @@ module.exports = { variable.references.forEach(ref => { const node = ref.identifier; const { parent } = node; + let evalNode; - if ( - parent && - (parent.type === "NewExpression" || parent.type === "CallExpression") && - node === parent.callee - ) { + if (parent) { + if (node === parent.callee && ( + parent.type === "NewExpression" || + parent.type === "CallExpression" + )) { + evalNode = parent; + } else if ( + parent.type === "MemberExpression" && + node === parent.object && + callMethods.has(astUtils.getStaticPropertyName(parent)) + ) { + const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent; + + if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) { + evalNode = maybeCallee.parent; + } + } + } + + if (evalNode) { context.report({ - node: parent, + node: evalNode, messageId: "noFunctionConstructor" }); } diff --git a/tools/node_modules/eslint/lib/rules/no-new-object.js b/tools/node_modules/eslint/lib/rules/no-new-object.js index e9f915db5e..17dfd34447 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-object.js +++ b/tools/node_modules/eslint/lib/rules/no-new-object.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow `Object` constructors", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-new-object" }, diff --git a/tools/node_modules/eslint/lib/rules/no-new-require.js b/tools/node_modules/eslint/lib/rules/no-new-require.js index 063f783e70..7973f8f2a2 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-require.js +++ b/tools/node_modules/eslint/lib/rules/no-new-require.js @@ -1,6 +1,7 @@ /** * @fileoverview Rule to disallow use of new operator with the `require` function * @author Wil Moore III + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -19,7 +20,6 @@ module.exports = { docs: { description: "disallow `new` operators with calls to `require`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-new-require" }, diff --git a/tools/node_modules/eslint/lib/rules/no-new-symbol.js b/tools/node_modules/eslint/lib/rules/no-new-symbol.js index aeb509c0d9..391527df90 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-symbol.js +++ b/tools/node_modules/eslint/lib/rules/no-new-symbol.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow `new` operators with the `Symbol` object", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-new-symbol" }, diff --git a/tools/node_modules/eslint/lib/rules/no-new-wrappers.js b/tools/node_modules/eslint/lib/rules/no-new-wrappers.js index d276c48d20..b697d8d795 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-wrappers.js +++ b/tools/node_modules/eslint/lib/rules/no-new-wrappers.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new-wrappers" }, diff --git a/tools/node_modules/eslint/lib/rules/no-new.js b/tools/node_modules/eslint/lib/rules/no-new.js index aa8a4e2687..1b37f077d5 100644 --- a/tools/node_modules/eslint/lib/rules/no-new.js +++ b/tools/node_modules/eslint/lib/rules/no-new.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow `new` operators outside of assignments or comparisons", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new" }, diff --git a/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js b/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js index a4b46d9591..da61f61d02 100644 --- a/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +++ b/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js @@ -30,12 +30,12 @@ module.exports = { docs: { description: "disallow `\\8` and `\\9` escape sequences in string literals", - category: "Best Practices", - recommended: false, - url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape", - suggestion: true + recommended: true, + url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape" }, + hasSuggestions: true, + schema: [], messages: { diff --git a/tools/node_modules/eslint/lib/rules/no-obj-calls.js b/tools/node_modules/eslint/lib/rules/no-obj-calls.js index 6eb200c9b8..d62c1f0b4b 100644 --- a/tools/node_modules/eslint/lib/rules/no-obj-calls.js +++ b/tools/node_modules/eslint/lib/rules/no-obj-calls.js @@ -43,7 +43,6 @@ module.exports = { docs: { description: "disallow calling global object properties as functions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-obj-calls" }, diff --git a/tools/node_modules/eslint/lib/rules/no-octal-escape.js b/tools/node_modules/eslint/lib/rules/no-octal-escape.js index 5b4c7b2ebb..4513a83861 100644 --- a/tools/node_modules/eslint/lib/rules/no-octal-escape.js +++ b/tools/node_modules/eslint/lib/rules/no-octal-escape.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow octal escape sequences in string literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-octal-escape" }, diff --git a/tools/node_modules/eslint/lib/rules/no-octal.js b/tools/node_modules/eslint/lib/rules/no-octal.js index e9940befaf..5ee6895f62 100644 --- a/tools/node_modules/eslint/lib/rules/no-octal.js +++ b/tools/node_modules/eslint/lib/rules/no-octal.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow octal literals", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-octal" }, diff --git a/tools/node_modules/eslint/lib/rules/no-param-reassign.js b/tools/node_modules/eslint/lib/rules/no-param-reassign.js index 6874af44f3..b758b9d97f 100644 --- a/tools/node_modules/eslint/lib/rules/no-param-reassign.js +++ b/tools/node_modules/eslint/lib/rules/no-param-reassign.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow reassigning `function` parameters", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-param-reassign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-path-concat.js b/tools/node_modules/eslint/lib/rules/no-path-concat.js index fc1f894f87..184c9182b4 100644 --- a/tools/node_modules/eslint/lib/rules/no-path-concat.js +++ b/tools/node_modules/eslint/lib/rules/no-path-concat.js @@ -1,6 +1,7 @@ /** * @fileoverview Disallow string concatenation when using __dirname and __filename * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -18,7 +19,6 @@ module.exports = { docs: { description: "disallow string concatenation with `__dirname` and `__filename`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-path-concat" }, diff --git a/tools/node_modules/eslint/lib/rules/no-plusplus.js b/tools/node_modules/eslint/lib/rules/no-plusplus.js index 84d6c3e1f9..d7b6c73056 100644 --- a/tools/node_modules/eslint/lib/rules/no-plusplus.js +++ b/tools/node_modules/eslint/lib/rules/no-plusplus.js @@ -51,7 +51,6 @@ module.exports = { docs: { description: "disallow the unary operators `++` and `--`", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-plusplus" }, diff --git a/tools/node_modules/eslint/lib/rules/no-process-env.js b/tools/node_modules/eslint/lib/rules/no-process-env.js index 49d1734906..c61b557231 100644 --- a/tools/node_modules/eslint/lib/rules/no-process-env.js +++ b/tools/node_modules/eslint/lib/rules/no-process-env.js @@ -1,6 +1,7 @@ /** * @fileoverview Disallow the use of process.env() * @author Vignesh Anand + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -18,7 +19,6 @@ module.exports = { docs: { description: "disallow the use of `process.env`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-process-env" }, diff --git a/tools/node_modules/eslint/lib/rules/no-process-exit.js b/tools/node_modules/eslint/lib/rules/no-process-exit.js index 77c9cfd7cb..73310a9e4e 100644 --- a/tools/node_modules/eslint/lib/rules/no-process-exit.js +++ b/tools/node_modules/eslint/lib/rules/no-process-exit.js @@ -1,6 +1,7 @@ /** * @fileoverview Disallow the use of process.exit() * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -18,7 +19,6 @@ module.exports = { docs: { description: "disallow the use of `process.exit()`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-process-exit" }, diff --git a/tools/node_modules/eslint/lib/rules/no-promise-executor-return.js b/tools/node_modules/eslint/lib/rules/no-promise-executor-return.js index 32ee6e1512..42652416f8 100644 --- a/tools/node_modules/eslint/lib/rules/no-promise-executor-return.js +++ b/tools/node_modules/eslint/lib/rules/no-promise-executor-return.js @@ -69,7 +69,6 @@ module.exports = { docs: { description: "disallow returning values from Promise executor functions", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-promise-executor-return" }, diff --git a/tools/node_modules/eslint/lib/rules/no-proto.js b/tools/node_modules/eslint/lib/rules/no-proto.js index 82ce02fa4e..0c2490f7b4 100644 --- a/tools/node_modules/eslint/lib/rules/no-proto.js +++ b/tools/node_modules/eslint/lib/rules/no-proto.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow the use of the `__proto__` property", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-proto" }, diff --git a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js index c5e4d49259..1f837b9604 100644 --- a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js +++ b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow calling some `Object.prototype` methods directly on objects", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-prototype-builtins" }, diff --git a/tools/node_modules/eslint/lib/rules/no-redeclare.js b/tools/node_modules/eslint/lib/rules/no-redeclare.js index 6ddb21c9e1..afbe6170cb 100644 --- a/tools/node_modules/eslint/lib/rules/no-redeclare.js +++ b/tools/node_modules/eslint/lib/rules/no-redeclare.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow variable redeclaration", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-redeclare" }, diff --git a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js index e6d4c9efba..1d6b121ba8 100644 --- a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js @@ -39,7 +39,6 @@ module.exports = { docs: { description: "disallow multiple spaces in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-regex-spaces" }, diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-exports.js b/tools/node_modules/eslint/lib/rules/no-restricted-exports.js index f0df0ffaed..f568fdc685 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-exports.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-exports.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow specified names in exports", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-exports" }, diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-globals.js b/tools/node_modules/eslint/lib/rules/no-restricted-globals.js index 2c932a7307..efbcd755b1 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-globals.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-globals.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow specified global variables", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-globals" }, @@ -43,7 +42,7 @@ module.exports = { messages: { defaultMessage: "Unexpected use of '{{name}}'.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period customMessage: "Unexpected use of '{{name}}'. {{customMessage}}" } }, diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js index 414164d29f..eda63407ff 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js @@ -79,26 +79,25 @@ module.exports = { docs: { description: "disallow specified modules when loaded by `import`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-imports" }, messages: { path: "'{{importSource}}' import is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}", patterns: "'{{importSource}}' import is restricted from being used by a pattern.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}", everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}", importName: "'{{importName}}' import from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}" }, @@ -147,7 +146,7 @@ module.exports = { ? [{ matcher: ignore().add(restrictedPatterns) }] : restrictedPatterns.map(({ group, message }) => ({ matcher: ignore().add(group), customMessage: message })); - // if no imports are restricted we don"t need to check + // if no imports are restricted we don't need to check if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) { return {}; } diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-modules.js b/tools/node_modules/eslint/lib/rules/no-restricted-modules.js index d0b8a78a50..66e6fe49e3 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-modules.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-modules.js @@ -1,6 +1,7 @@ /** * @fileoverview Restrict usage of specified node modules. * @author Christian Schulz + * @deprecated in ESLint v7.0.0 */ "use strict"; @@ -48,7 +49,6 @@ module.exports = { docs: { description: "disallow specified modules when loaded by `require`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-modules" }, @@ -73,7 +73,7 @@ module.exports = { messages: { defaultMessage: "'{{name}}' module is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}", patternMessage: "'{{name}}' module is restricted from being used by a pattern." } @@ -97,7 +97,7 @@ module.exports = { return memo; }, {}); - // if no imports are restricted we don"t need to check + // if no imports are restricted we don't need to check if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) { return {}; } diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-properties.js b/tools/node_modules/eslint/lib/rules/no-restricted-properties.js index 7ab83995a3..3671d88eb6 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-properties.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-properties.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow certain properties on certain objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-properties" }, @@ -64,9 +63,9 @@ module.exports = { }, messages: { - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}" } }, diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-syntax.js b/tools/node_modules/eslint/lib/rules/no-restricted-syntax.js index 9572603a82..0ff6b91bc6 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-syntax.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-syntax.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow specified syntax", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-syntax" }, @@ -42,7 +41,7 @@ module.exports = { }, messages: { - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedSyntax: "{{message}}" } }, diff --git a/tools/node_modules/eslint/lib/rules/no-return-assign.js b/tools/node_modules/eslint/lib/rules/no-return-assign.js index 4b57d42eb9..ecb789ea26 100644 --- a/tools/node_modules/eslint/lib/rules/no-return-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-return-assign.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "disallow assignment operators in `return` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-return-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-return-await.js b/tools/node_modules/eslint/lib/rules/no-return-await.js index d1d8982685..7ec808f50a 100644 --- a/tools/node_modules/eslint/lib/rules/no-return-await.js +++ b/tools/node_modules/eslint/lib/rules/no-return-await.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow unnecessary `return await`", - category: "Best Practices", recommended: false, diff --git a/tools/node_modules/eslint/lib/rules/no-script-url.js b/tools/node_modules/eslint/lib/rules/no-script-url.js index 0c82052440..12451ad9a9 100644 --- a/tools/node_modules/eslint/lib/rules/no-script-url.js +++ b/tools/node_modules/eslint/lib/rules/no-script-url.js @@ -2,8 +2,7 @@ * @fileoverview Rule to flag when using javascript: urls * @author Ilya Volodin */ -/* jshint scripturl: true */ -/* eslint no-script-url: 0 */ +/* eslint no-script-url: 0 -- Code is checking to report such URLs */ "use strict"; @@ -19,7 +18,6 @@ module.exports = { docs: { description: "disallow `javascript:` urls", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-script-url" }, diff --git a/tools/node_modules/eslint/lib/rules/no-self-assign.js b/tools/node_modules/eslint/lib/rules/no-self-assign.js index 705be324cf..813771e700 100644 --- a/tools/node_modules/eslint/lib/rules/no-self-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-self-assign.js @@ -130,7 +130,6 @@ module.exports = { docs: { description: "disallow assignments where both sides are exactly the same", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-self-assign" }, diff --git a/tools/node_modules/eslint/lib/rules/no-self-compare.js b/tools/node_modules/eslint/lib/rules/no-self-compare.js index 79b6ac7ea0..ee77ff08b2 100644 --- a/tools/node_modules/eslint/lib/rules/no-self-compare.js +++ b/tools/node_modules/eslint/lib/rules/no-self-compare.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow comparisons where both sides are exactly the same", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-self-compare" }, diff --git a/tools/node_modules/eslint/lib/rules/no-sequences.js b/tools/node_modules/eslint/lib/rules/no-sequences.js index fe516975fb..b8941256e6 100644 --- a/tools/node_modules/eslint/lib/rules/no-sequences.js +++ b/tools/node_modules/eslint/lib/rules/no-sequences.js @@ -29,7 +29,6 @@ module.exports = { docs: { description: "disallow comma operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-sequences" }, diff --git a/tools/node_modules/eslint/lib/rules/no-setter-return.js b/tools/node_modules/eslint/lib/rules/no-setter-return.js index 9c79240dda..67114ade82 100644 --- a/tools/node_modules/eslint/lib/rules/no-setter-return.js +++ b/tools/node_modules/eslint/lib/rules/no-setter-return.js @@ -93,6 +93,7 @@ function isSetter(node, scope) { const parent = node.parent; if ( + (parent.type === "Property" || parent.type === "MethodDefinition") && parent.kind === "set" && parent.value === node ) { @@ -141,7 +142,6 @@ module.exports = { docs: { description: "disallow returning values from setters", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-setter-return" }, diff --git a/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js b/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js index 9647e9a1bc..7d4174a104 100644 --- a/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +++ b/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js @@ -27,7 +27,6 @@ module.exports = { docs: { description: "disallow identifiers from shadowing restricted names", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-shadow-restricted-names" }, diff --git a/tools/node_modules/eslint/lib/rules/no-shadow.js b/tools/node_modules/eslint/lib/rules/no-shadow.js index a0b1db50c0..4ec357620b 100644 --- a/tools/node_modules/eslint/lib/rules/no-shadow.js +++ b/tools/node_modules/eslint/lib/rules/no-shadow.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow variable declarations from shadowing variables declared in the outer scope", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-shadow" }, @@ -59,7 +58,7 @@ module.exports = { /** * Check if variable name is allowed. - * @param {ASTNode} variable The variable to check. + * @param {ASTNode} variable The variable to check. * @returns {boolean} Whether or not the variable name is allowed. */ function isAllowed(variable) { diff --git a/tools/node_modules/eslint/lib/rules/no-spaced-func.js b/tools/node_modules/eslint/lib/rules/no-spaced-func.js index 961bc681f7..8f51d5446d 100644 --- a/tools/node_modules/eslint/lib/rules/no-spaced-func.js +++ b/tools/node_modules/eslint/lib/rules/no-spaced-func.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "disallow spacing between function identifiers and their applications (deprecated)", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-spaced-func" }, diff --git a/tools/node_modules/eslint/lib/rules/no-sparse-arrays.js b/tools/node_modules/eslint/lib/rules/no-sparse-arrays.js index e8407c3fae..56ce5dcc87 100644 --- a/tools/node_modules/eslint/lib/rules/no-sparse-arrays.js +++ b/tools/node_modules/eslint/lib/rules/no-sparse-arrays.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow sparse arrays", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-sparse-arrays" }, diff --git a/tools/node_modules/eslint/lib/rules/no-sync.js b/tools/node_modules/eslint/lib/rules/no-sync.js index 06424e0b38..ea40df1293 100644 --- a/tools/node_modules/eslint/lib/rules/no-sync.js +++ b/tools/node_modules/eslint/lib/rules/no-sync.js @@ -1,10 +1,9 @@ /** * @fileoverview Rule to check for properties whose identifier ends with the string Sync * @author Matt DuVall + * @deprecated in ESLint v7.0.0 */ -/* jshint node:true */ - "use strict"; //------------------------------------------------------------------------------ @@ -21,7 +20,6 @@ module.exports = { docs: { description: "disallow synchronous methods", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-sync" }, diff --git a/tools/node_modules/eslint/lib/rules/no-tabs.js b/tools/node_modules/eslint/lib/rules/no-tabs.js index ca7be26165..1f3921a9a7 100644 --- a/tools/node_modules/eslint/lib/rules/no-tabs.js +++ b/tools/node_modules/eslint/lib/rules/no-tabs.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "disallow all tabs", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-tabs" }, diff --git a/tools/node_modules/eslint/lib/rules/no-template-curly-in-string.js b/tools/node_modules/eslint/lib/rules/no-template-curly-in-string.js index 539cd5be5f..e71480fc01 100644 --- a/tools/node_modules/eslint/lib/rules/no-template-curly-in-string.js +++ b/tools/node_modules/eslint/lib/rules/no-template-curly-in-string.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow template literal placeholder syntax in regular strings", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-template-curly-in-string" }, diff --git a/tools/node_modules/eslint/lib/rules/no-ternary.js b/tools/node_modules/eslint/lib/rules/no-ternary.js index b3ced86056..8b2e10a34a 100644 --- a/tools/node_modules/eslint/lib/rules/no-ternary.js +++ b/tools/node_modules/eslint/lib/rules/no-ternary.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow ternary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-ternary" }, diff --git a/tools/node_modules/eslint/lib/rules/no-this-before-super.js b/tools/node_modules/eslint/lib/rules/no-this-before-super.js index 5bfba66fc6..9cc85ebbe2 100644 --- a/tools/node_modules/eslint/lib/rules/no-this-before-super.js +++ b/tools/node_modules/eslint/lib/rules/no-this-before-super.js @@ -40,7 +40,6 @@ module.exports = { docs: { description: "disallow `this`/`super` before calling `super()` in constructors", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-this-before-super" }, diff --git a/tools/node_modules/eslint/lib/rules/no-throw-literal.js b/tools/node_modules/eslint/lib/rules/no-throw-literal.js index 29fb3718b4..311e6d4f07 100644 --- a/tools/node_modules/eslint/lib/rules/no-throw-literal.js +++ b/tools/node_modules/eslint/lib/rules/no-throw-literal.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow throwing literals as exceptions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-throw-literal" }, diff --git a/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js b/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js index 98ae62c896..1930098bea 100644 --- a/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow trailing whitespace at the end of lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-trailing-spaces" }, diff --git a/tools/node_modules/eslint/lib/rules/no-undef-init.js b/tools/node_modules/eslint/lib/rules/no-undef-init.js index 5c240fef74..7298d34494 100644 --- a/tools/node_modules/eslint/lib/rules/no-undef-init.js +++ b/tools/node_modules/eslint/lib/rules/no-undef-init.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "disallow initializing variables to `undefined`", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-undef-init" }, diff --git a/tools/node_modules/eslint/lib/rules/no-undef.js b/tools/node_modules/eslint/lib/rules/no-undef.js index 6b5140819b..ee611f9c86 100644 --- a/tools/node_modules/eslint/lib/rules/no-undef.js +++ b/tools/node_modules/eslint/lib/rules/no-undef.js @@ -29,7 +29,6 @@ module.exports = { docs: { description: "disallow the use of undeclared variables unless mentioned in `/*global */` comments", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-undef" }, diff --git a/tools/node_modules/eslint/lib/rules/no-undefined.js b/tools/node_modules/eslint/lib/rules/no-undefined.js index a075d903e2..ad30225542 100644 --- a/tools/node_modules/eslint/lib/rules/no-undefined.js +++ b/tools/node_modules/eslint/lib/rules/no-undefined.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow the use of `undefined` as an identifier", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-undefined" }, diff --git a/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js b/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js index 87d2336fa4..916b8c01ba 100644 --- a/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js +++ b/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow dangling underscores in identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-underscore-dangle" }, @@ -253,7 +252,9 @@ module.exports = { node, messageId: "unexpectedUnderscore", data: { - identifier + identifier: node.key.type === "PrivateIdentifier" + ? `#${identifier}` + : identifier } }); } @@ -268,6 +269,7 @@ module.exports = { VariableDeclarator: checkForDanglingUnderscoreInVariableExpression, MemberExpression: checkForDanglingUnderscoreInMemberExpression, MethodDefinition: checkForDanglingUnderscoreInMethod, + PropertyDefinition: checkForDanglingUnderscoreInMethod, Property: checkForDanglingUnderscoreInMethod, FunctionExpression: checkForDanglingUnderscoreInFunction, ArrowFunctionExpression: checkForDanglingUnderscoreInFunction diff --git a/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js b/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js index 7af3fe6709..4447959ed9 100644 --- a/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js +++ b/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow confusing multiline expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unexpected-multiline" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js b/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js index 7031a4dd8b..ba321d2c6e 100644 --- a/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js @@ -162,7 +162,6 @@ module.exports = { docs: { description: "disallow unmodified loop conditions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-unmodified-loop-condition" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js b/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js index 06c615f382..e12240d03e 100644 --- a/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js +++ b/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js @@ -29,7 +29,6 @@ module.exports = { docs: { description: "disallow ternary operators when simpler alternatives exist", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-unneeded-ternary" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unreachable-loop.js b/tools/node_modules/eslint/lib/rules/no-unreachable-loop.js index 868a6ff98f..5cbfac46d3 100644 --- a/tools/node_modules/eslint/lib/rules/no-unreachable-loop.js +++ b/tools/node_modules/eslint/lib/rules/no-unreachable-loop.js @@ -59,7 +59,6 @@ module.exports = { docs: { description: "disallow loops with a body that allows only one iteration", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-unreachable-loop" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unreachable.js b/tools/node_modules/eslint/lib/rules/no-unreachable.js index 415631a6f7..ce17a5966a 100644 --- a/tools/node_modules/eslint/lib/rules/no-unreachable.js +++ b/tools/node_modules/eslint/lib/rules/no-unreachable.js @@ -8,6 +8,12 @@ // Helpers //------------------------------------------------------------------------------ +/** + * @typedef {Object} ConstructorInfo + * @property {ConstructorInfo | null} upper Info about the constructor that encloses this constructor. + * @property {boolean} hasSuperCall The flag about having `super()` expressions. + */ + /** * Checks whether or not a given variable declarator has the initializer. * @param {ASTNode} node A VariableDeclarator node to check. @@ -105,7 +111,6 @@ module.exports = { docs: { description: "disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unreachable" }, @@ -120,6 +125,10 @@ module.exports = { create(context) { let currentCodePath = null; + /** @type {ConstructorInfo | null} */ + let constructorInfo = null; + + /** @type {ConsecutiveRange} */ const range = new ConsecutiveRange(context.getSourceCode()); /** @@ -130,7 +139,7 @@ module.exports = { function reportIfUnreachable(node) { let nextNode = null; - if (node && currentCodePath.currentSegments.every(isUnreachable)) { + if (node && (node.type === "PropertyDefinition" || currentCodePath.currentSegments.every(isUnreachable))) { // Store this statement to distinguish consecutive statements. if (range.isEmpty) { @@ -212,6 +221,42 @@ module.exports = { "Program:exit"() { reportIfUnreachable(); + }, + + /* + * Instance fields defined in a subclass are never created if the constructor of the subclass + * doesn't call `super()`, so their definitions are unreachable code. + */ + "MethodDefinition[kind='constructor']"() { + constructorInfo = { + upper: constructorInfo, + hasSuperCall: false + }; + }, + "MethodDefinition[kind='constructor']:exit"(node) { + const { hasSuperCall } = constructorInfo; + + constructorInfo = constructorInfo.upper; + + // skip typescript constructors without the body + if (!node.value.body) { + return; + } + + const classDefinition = node.parent.parent; + + if (classDefinition.superClass && !hasSuperCall) { + for (const element of classDefinition.body.body) { + if (element.type === "PropertyDefinition" && !element.static) { + reportIfUnreachable(element); + } + } + } + }, + "CallExpression > Super.callee"() { + if (constructorInfo) { + constructorInfo.hasSuperCall = true; + } } }; } diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js b/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js index 11bf06e872..4bb7f7fec4 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js @@ -24,7 +24,6 @@ module.exports = { docs: { description: "disallow control flow statements in `finally` blocks", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unsafe-finally" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js index a9c2ee74f2..c681986941 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js @@ -52,12 +52,12 @@ module.exports = { docs: { description: "disallow negating the left operand of relational operators", - category: "Possible Errors", recommended: true, - url: "https://eslint.org/docs/rules/no-unsafe-negation", - suggestion: true + url: "https://eslint.org/docs/rules/no-unsafe-negation" }, + hasSuggestions: true, + schema: [ { type: "object", diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js b/tools/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js index 2eafc1ad8f..cc15c99881 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js @@ -24,8 +24,7 @@ module.exports = { docs: { description: "disallow use of optional chaining in contexts where the `undefined` value is not allowed", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining" }, schema: [{ diff --git a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js index 58c9b33418..3bb816df77 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js @@ -30,7 +30,6 @@ module.exports = { docs: { description: "disallow unused expressions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-unused-expressions" }, @@ -72,8 +71,8 @@ module.exports = { allowTaggedTemplates = config.allowTaggedTemplates || false, enforceForJSX = config.enforceForJSX || false; - // eslint-disable-next-line jsdoc/require-description /** + * Has AST suggesting a directive. * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ @@ -82,8 +81,8 @@ module.exports = { node.expression.type === "Literal" && typeof node.expression.value === "string"; } - // eslint-disable-next-line jsdoc/require-description /** + * Gets the leading sequence of members in a list that pass the predicate. * @param {Function} predicate ([a] -> Boolean) the function used to make the determination * @param {a[]} list the input list * @returns {a[]} the leading sequence of members in the given list that pass the given predicate @@ -97,8 +96,8 @@ module.exports = { return list.slice(); } - // eslint-disable-next-line jsdoc/require-description /** + * Gets leading directives nodes in a Node body. * @param {ASTNode} node a Program or BlockStatement node * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body */ @@ -106,8 +105,8 @@ module.exports = { return takeWhile(looksLikeDirective, node.body); } - // eslint-disable-next-line jsdoc/require-description /** + * Detect if a Node is a directive. * @param {ASTNode} node any node * @param {ASTNode[]} ancestors the given node's ancestors * @returns {boolean} whether the given node is considered a directive in its current position diff --git a/tools/node_modules/eslint/lib/rules/no-unused-labels.js b/tools/node_modules/eslint/lib/rules/no-unused-labels.js index b33fcb7867..f0b09614e0 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-labels.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-labels.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow unused labels", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-unused-labels" }, diff --git a/tools/node_modules/eslint/lib/rules/no-unused-vars.js b/tools/node_modules/eslint/lib/rules/no-unused-vars.js index f04818f8e9..847e21baf5 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-vars.js @@ -33,7 +33,6 @@ module.exports = { docs: { description: "disallow unused variables", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-unused-vars" }, @@ -295,6 +294,31 @@ module.exports = { ); } + /** + * Checks whether a given node is unused expression or not. + * @param {ASTNode} node The node itself + * @returns {boolean} The node is an unused expression. + * @private + */ + function isUnusedExpression(node) { + const parent = node.parent; + + if (parent.type === "ExpressionStatement") { + return true; + } + + if (parent.type === "SequenceExpression") { + const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; + + if (!isLastExpression) { + return true; + } + return isUnusedExpression(parent); + } + + return false; + } + /** * If a given reference is left-hand side of an assignment, this gets * the right-hand side node of the assignment. @@ -313,7 +337,6 @@ module.exports = { function getRhsNode(ref, prevRhsNode) { const id = ref.identifier; const parent = id.parent; - const grandparent = parent.parent; const refScope = ref.from.variableScope; const varScope = ref.resolved.scope.variableScope; const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); @@ -327,7 +350,7 @@ module.exports = { } if (parent.type === "AssignmentExpression" && - grandparent.type === "ExpressionStatement" && + isUnusedExpression(parent) && id === parent.left && !canBeUsedLater ) { @@ -410,31 +433,6 @@ module.exports = { ); } - /** - * Checks whether a given node is unused expression or not. - * @param {ASTNode} node The node itself - * @returns {boolean} The node is an unused expression. - * @private - */ - function isUnusedExpression(node) { - const parent = node.parent; - - if (parent.type === "ExpressionStatement") { - return true; - } - - if (parent.type === "SequenceExpression") { - const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; - - if (!isLastExpression) { - return true; - } - return isUnusedExpression(parent); - } - - return false; - } - /** * Checks whether a given reference is a read to update itself or not. * @param {eslint-scope.Reference} ref A reference to check. diff --git a/tools/node_modules/eslint/lib/rules/no-use-before-define.js b/tools/node_modules/eslint/lib/rules/no-use-before-define.js index c7300567ed..fd8864e5fa 100644 --- a/tools/node_modules/eslint/lib/rules/no-use-before-define.js +++ b/tools/node_modules/eslint/lib/rules/no-use-before-define.js @@ -135,7 +135,6 @@ module.exports = { docs: { description: "disallow the use of variables before they are defined", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-use-before-define" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-backreference.js b/tools/node_modules/eslint/lib/rules/no-useless-backreference.js index 529c16439e..ae49147128 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-backreference.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-backreference.js @@ -64,8 +64,7 @@ module.exports = { docs: { description: "disallow useless backreferences in regular expressions", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-useless-backreference" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-call.js b/tools/node_modules/eslint/lib/rules/no-useless-call.js index b1382a2fa2..89350665fe 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-call.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-call.js @@ -55,7 +55,6 @@ module.exports = { docs: { description: "disallow unnecessary calls to `.call()` and `.apply()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-call" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-catch.js b/tools/node_modules/eslint/lib/rules/no-useless-catch.js index f303c27294..280ba55336 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-catch.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-catch.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow unnecessary `catch` clauses", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-useless-catch" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-computed-key.js b/tools/node_modules/eslint/lib/rules/no-useless-computed-key.js index a1cacc2961..a8769214f5 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-computed-key.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-computed-key.js @@ -10,6 +10,77 @@ const astUtils = require("./utils/ast-utils"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the computed key syntax is unnecessarily used for the given node. + * In particular, it determines whether removing the square brackets and using the content between them + * directly as the key (e.g. ['foo'] -> 'foo') would produce valid syntax and preserve the same behavior. + * Valid non-computed keys are only: identifiers, number literals and string literals. + * Only literals can preserve the same behavior, with a few exceptions for specific node types: + * Property + * - { ["__proto__"]: foo } defines a property named "__proto__" + * { "__proto__": foo } defines object's prototype + * PropertyDefinition + * - class C { ["constructor"]; } defines an instance field named "constructor" + * class C { "constructor"; } produces a parsing error + * - class C { static ["constructor"]; } defines a static field named "constructor" + * class C { static "constructor"; } produces a parsing error + * - class C { static ["prototype"]; } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"; } produces a parsing error (breaks the whole script) + * MethodDefinition + * - class C { ["constructor"]() {} } defines a prototype method named "constructor" + * class C { "constructor"() {} } defines the constructor + * - class C { static ["prototype"]() {} } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"() {} } produces a parsing error (breaks the whole script) + * @param {ASTNode} node The node to check. It can be `Property`, `PropertyDefinition` or `MethodDefinition`. + * @throws {Error} (Unreachable.) + * @returns {void} `true` if the node has useless computed key. + */ +function hasUselessComputedKey(node) { + if (!node.computed) { + return false; + } + + const { key } = node; + + if (key.type !== "Literal") { + return false; + } + + const { value } = key; + + if (typeof value !== "number" && typeof value !== "string") { + return false; + } + + switch (node.type) { + case "Property": + return value !== "__proto__"; + + case "PropertyDefinition": + if (node.static) { + return value !== "constructor" && value !== "prototype"; + } + + return value !== "constructor"; + + case "MethodDefinition": + if (node.static) { + return value !== "prototype"; + } + + return value !== "constructor"; + + /* istanbul ignore next */ + default: + throw new Error(`Unexpected node type: ${node.type}`); + } + +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -20,7 +91,6 @@ module.exports = { docs: { description: "disallow unnecessary computed property keys in objects and classes", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-computed-key" }, @@ -51,22 +121,9 @@ module.exports = { * @returns {void} */ function check(node) { - if (!node.computed) { - return; - } + if (hasUselessComputedKey(node)) { + const { key } = node; - const key = node.key, - nodeType = typeof key.value; - - let allowedKey; - - if (node.type === "MethodDefinition") { - allowedKey = node.static ? "prototype" : "constructor"; - } else { - allowedKey = "__proto__"; - } - - if (key.type === "Literal" && (nodeType === "string" || nodeType === "number") && key.value !== allowedKey) { context.report({ node, messageId: "unnecessarilyComputedProperty", @@ -103,7 +160,8 @@ module.exports = { return { Property: check, - MethodDefinition: enforceForClassMembers ? check : noop + MethodDefinition: enforceForClassMembers ? check : noop, + PropertyDefinition: enforceForClassMembers ? check : noop }; } }; diff --git a/tools/node_modules/eslint/lib/rules/no-useless-concat.js b/tools/node_modules/eslint/lib/rules/no-useless-concat.js index cfc60c8fb5..a0176a7e9d 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-concat.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-concat.js @@ -70,7 +70,6 @@ module.exports = { docs: { description: "disallow unnecessary concatenation of literals or template literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-concat" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js index baabe7ec80..13ec675501 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js @@ -138,7 +138,6 @@ module.exports = { docs: { description: "disallow unnecessary constructors", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-constructor" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-escape.js b/tools/node_modules/eslint/lib/rules/no-useless-escape.js index 512c93a8bc..a780a7a84a 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-escape.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-escape.js @@ -34,16 +34,17 @@ const REGEX_NON_CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("^/.$*+ * @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. * @example * - * parseRegExp('a\\b[cd-]') + * parseRegExp("a\\b[cd-]"); * - * returns: + * // returns: * [ - * {text: 'a', index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false}, - * {text: 'b', index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false}, - * {text: 'c', index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false}, - * {text: 'd', index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false}, - * {text: '-', index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false} - * ] + * { text: "a", index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "b", index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "c", index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false }, + * { text: "d", index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false }, + * { text: "-", index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false } + * ]; + * */ function parseRegExp(regExpText) { const charList = []; @@ -83,12 +84,12 @@ module.exports = { docs: { description: "disallow unnecessary escape characters", - category: "Best Practices", recommended: true, - url: "https://eslint.org/docs/rules/no-useless-escape", - suggestion: true + url: "https://eslint.org/docs/rules/no-useless-escape" }, + hasSuggestions: true, + messages: { unnecessaryEscape: "Unnecessary escape character: \\{{character}}.", removeEscape: "Remove the `\\`. This maintains the current functionality.", diff --git a/tools/node_modules/eslint/lib/rules/no-useless-rename.js b/tools/node_modules/eslint/lib/rules/no-useless-rename.js index a7cec025da..c0d27e600a 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-rename.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-rename.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "disallow renaming import, export, and destructured assignments to the same name", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-rename" }, diff --git a/tools/node_modules/eslint/lib/rules/no-useless-return.js b/tools/node_modules/eslint/lib/rules/no-useless-return.js index 111cb21015..87f05892a9 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-return.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-return.js @@ -67,7 +67,6 @@ module.exports = { docs: { description: "disallow redundant return statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-return" }, diff --git a/tools/node_modules/eslint/lib/rules/no-var.js b/tools/node_modules/eslint/lib/rules/no-var.js index f2cb96b1f7..a821c38a36 100644 --- a/tools/node_modules/eslint/lib/rules/no-var.js +++ b/tools/node_modules/eslint/lib/rules/no-var.js @@ -185,7 +185,6 @@ module.exports = { docs: { description: "require `let` or `const` instead of `var`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-var" }, diff --git a/tools/node_modules/eslint/lib/rules/no-void.js b/tools/node_modules/eslint/lib/rules/no-void.js index 99c8378555..dba4932385 100644 --- a/tools/node_modules/eslint/lib/rules/no-void.js +++ b/tools/node_modules/eslint/lib/rules/no-void.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "disallow `void` operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-void" }, diff --git a/tools/node_modules/eslint/lib/rules/no-warning-comments.js b/tools/node_modules/eslint/lib/rules/no-warning-comments.js index e5f702bc7d..23e3da35e1 100644 --- a/tools/node_modules/eslint/lib/rules/no-warning-comments.js +++ b/tools/node_modules/eslint/lib/rules/no-warning-comments.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow specified warning terms in comments", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-warning-comments" }, diff --git a/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js b/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js index 226f873c5f..9a492997d7 100644 --- a/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js +++ b/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "disallow whitespace before properties", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-whitespace-before-property" }, diff --git a/tools/node_modules/eslint/lib/rules/no-with.js b/tools/node_modules/eslint/lib/rules/no-with.js index d3e52e02f3..219a68094c 100644 --- a/tools/node_modules/eslint/lib/rules/no-with.js +++ b/tools/node_modules/eslint/lib/rules/no-with.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "disallow `with` statements", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-with" }, diff --git a/tools/node_modules/eslint/lib/rules/nonblock-statement-body-position.js b/tools/node_modules/eslint/lib/rules/nonblock-statement-body-position.js index 34e6eeac39..7ed541b380 100644 --- a/tools/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +++ b/tools/node_modules/eslint/lib/rules/nonblock-statement-body-position.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce the location of single-line statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/nonblock-statement-body-position" }, diff --git a/tools/node_modules/eslint/lib/rules/object-curly-newline.js b/tools/node_modules/eslint/lib/rules/object-curly-newline.js index 1fbea00c5d..e160991358 100644 --- a/tools/node_modules/eslint/lib/rules/object-curly-newline.js +++ b/tools/node_modules/eslint/lib/rules/object-curly-newline.js @@ -150,7 +150,6 @@ module.exports = { docs: { description: "enforce consistent line breaks after opening and before closing braces", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-curly-newline" }, diff --git a/tools/node_modules/eslint/lib/rules/object-curly-spacing.js b/tools/node_modules/eslint/lib/rules/object-curly-spacing.js index c0044f5033..b18ef57404 100644 --- a/tools/node_modules/eslint/lib/rules/object-curly-spacing.js +++ b/tools/node_modules/eslint/lib/rules/object-curly-spacing.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce consistent spacing inside braces", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-curly-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/object-property-newline.js b/tools/node_modules/eslint/lib/rules/object-property-newline.js index 0c7f800282..7cca23ff31 100644 --- a/tools/node_modules/eslint/lib/rules/object-property-newline.js +++ b/tools/node_modules/eslint/lib/rules/object-property-newline.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce placing object properties on separate lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-property-newline" }, diff --git a/tools/node_modules/eslint/lib/rules/object-shorthand.js b/tools/node_modules/eslint/lib/rules/object-shorthand.js index 3999ff8b99..10bb07bbb0 100644 --- a/tools/node_modules/eslint/lib/rules/object-shorthand.js +++ b/tools/node_modules/eslint/lib/rules/object-shorthand.js @@ -28,7 +28,6 @@ module.exports = { docs: { description: "require or disallow method and property shorthand syntax for object literals", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/object-shorthand" }, @@ -149,7 +148,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property can have a shorthand form * @private - * */ function canHaveShorthand(property) { return (property.kind !== "set" && property.kind !== "get" && property.type !== "SpreadElement" && property.type !== "SpreadProperty" && property.type !== "ExperimentalSpreadProperty"); @@ -157,7 +155,7 @@ module.exports = { /** * Checks whether a node is a string literal. - * @param {ASTNode} node Any AST node. + * @param {ASTNode} node Any AST node. * @returns {boolean} `true` if it is a string literal. */ function isStringLiteral(node) { @@ -169,7 +167,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property is considered shorthand, false if not. * @private - * */ function isShorthand(property) { @@ -182,7 +179,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the key and value are named equally, false if not. * @private - * */ function isRedundant(property) { const value = property.value; @@ -199,10 +195,9 @@ module.exports = { /** * Ensures that an object's properties are consistently shorthand, or not shorthand at all. - * @param {ASTNode} node Property AST node - * @param {boolean} checkRedundancy Whether to check longform redundancy + * @param {ASTNode} node Property AST node + * @param {boolean} checkRedundancy Whether to check longform redundancy * @returns {void} - * */ function checkConsistency(node, checkRedundancy) { diff --git a/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js b/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js index db4674760a..c0ad70004e 100644 --- a/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +++ b/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "require or disallow newlines around variable declarations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/one-var-declaration-per-line" }, diff --git a/tools/node_modules/eslint/lib/rules/one-var.js b/tools/node_modules/eslint/lib/rules/one-var.js index e3df8320f8..9c78ef87da 100644 --- a/tools/node_modules/eslint/lib/rules/one-var.js +++ b/tools/node_modules/eslint/lib/rules/one-var.js @@ -34,7 +34,6 @@ module.exports = { docs: { description: "enforce variables to be declared either together or separately in functions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/one-var" }, @@ -209,7 +208,7 @@ module.exports = { /** * Determines the current scope (function or block) - * @param {string} statementType node.kind, one of: "var", "let", or "const" + * @param {string} statementType node.kind, one of: "var", "let", or "const" * @returns {Object} The scope associated with statementType */ function getCurrentScope(statementType) { diff --git a/tools/node_modules/eslint/lib/rules/operator-assignment.js b/tools/node_modules/eslint/lib/rules/operator-assignment.js index a48d272519..34bdb861f4 100644 --- a/tools/node_modules/eslint/lib/rules/operator-assignment.js +++ b/tools/node_modules/eslint/lib/rules/operator-assignment.js @@ -17,8 +17,8 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether an operator is commutative and has an operator assignment * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is commutative and has a + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is commutative and has a * shorthand form. */ function isCommutativeOperatorWithShorthand(operator) { @@ -28,8 +28,8 @@ function isCommutativeOperatorWithShorthand(operator) { /** * Checks whether an operator is not commutative and has an operator assignment * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is not commutative and has + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is not commutative and has * a shorthand form. */ function isNonCommutativeOperatorWithShorthand(operator) { @@ -63,7 +63,6 @@ module.exports = { docs: { description: "require or disallow assignment operator shorthand where possible", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/operator-assignment" }, @@ -96,7 +95,7 @@ module.exports = { /** * Ensures that an assignment uses the shorthand form where possible. - * @param {ASTNode} node An AssignmentExpression node. + * @param {ASTNode} node An AssignmentExpression node. * @returns {void} */ function verify(node) { @@ -149,7 +148,7 @@ module.exports = { /** * Warns if an assignment expression uses operator assignment shorthand. - * @param {ASTNode} node An AssignmentExpression node. + * @param {ASTNode} node An AssignmentExpression node. * @returns {void} */ function prohibit(node) { diff --git a/tools/node_modules/eslint/lib/rules/operator-linebreak.js b/tools/node_modules/eslint/lib/rules/operator-linebreak.js index 18da5c55b4..6eab0cccbb 100644 --- a/tools/node_modules/eslint/lib/rules/operator-linebreak.js +++ b/tools/node_modules/eslint/lib/rules/operator-linebreak.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "enforce consistent linebreak style for operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/operator-linebreak" }, @@ -136,23 +135,21 @@ module.exports = { /** * Checks the operator placement * @param {ASTNode} node The node to check - * @param {ASTNode} leftSide The node that comes before the operator in `node` + * @param {ASTNode} rightSide The node that comes after the operator in `node` + * @param {string} operator The operator * @private * @returns {void} */ - function validateNode(node, leftSide) { + function validateNode(node, rightSide, operator) { /* - * When the left part of a binary expression is a single expression wrapped in - * parentheses (ex: `(a) + b`), leftToken will be the last token of the expression - * and operatorToken will be the closing parenthesis. - * The leftToken should be the last closing parenthesis, and the operatorToken - * should be the token right after that. + * Find the operator token by searching from the right side, because between the left side and the operator + * there could be additional tokens from type annotations. Search specifically for the token which + * value equals the operator, in order to skip possible opening parentheses before the right side node. */ - const operatorToken = sourceCode.getTokenAfter(leftSide, astUtils.isNotClosingParenToken); + const operatorToken = sourceCode.getTokenBefore(rightSide, token => token.value === operator); const leftToken = sourceCode.getTokenBefore(operatorToken); const rightToken = sourceCode.getTokenAfter(operatorToken); - const operator = operatorToken.value; const operatorStyleOverride = styleOverrides[operator]; const style = operatorStyleOverride || globalStyle; const fix = getFixer(operatorToken, style); @@ -222,7 +219,7 @@ module.exports = { * @returns {void} */ function validateBinaryExpression(node) { - validateNode(node, node.left); + validateNode(node, node.right, node.operator); } //-------------------------------------------------------------------------- @@ -235,12 +232,17 @@ module.exports = { AssignmentExpression: validateBinaryExpression, VariableDeclarator(node) { if (node.init) { - validateNode(node, node.id); + validateNode(node, node.init, "="); + } + }, + PropertyDefinition(node) { + if (node.value) { + validateNode(node, node.value, "="); } }, ConditionalExpression(node) { - validateNode(node, node.test); - validateNode(node, node.consequent); + validateNode(node, node.consequent, "?"); + validateNode(node, node.alternate, ":"); } }; } diff --git a/tools/node_modules/eslint/lib/rules/padded-blocks.js b/tools/node_modules/eslint/lib/rules/padded-blocks.js index f8b5bd9777..ca83f11fc5 100644 --- a/tools/node_modules/eslint/lib/rules/padded-blocks.js +++ b/tools/node_modules/eslint/lib/rules/padded-blocks.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "require or disallow padding within blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/padded-blocks" }, @@ -167,6 +166,7 @@ module.exports = { /** * Checks if a node should be padded, according to the rule config. * @param {ASTNode} node The AST node to check. + * @throws {Error} (Unreachable) * @returns {boolean} True if the node should be padded, false otherwise. */ function requirePaddingFor(node) { diff --git a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js index c97b9956b7..073940a40e 100644 --- a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js +++ b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js @@ -431,7 +431,6 @@ module.exports = { docs: { description: "require or disallow padding lines between statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/padding-line-between-statements" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js b/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js index a01c034082..518bf4b2da 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js +++ b/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js @@ -60,6 +60,7 @@ function getVariableOfArguments(scope) { /** * Checks whether or not a given node is a callback. * @param {ASTNode} node A node to check. + * @throws {Error} (Unreachable.) * @returns {Object} * {boolean} retv.isCallback - `true` if the node is a callback. * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. @@ -150,7 +151,6 @@ module.exports = { docs: { description: "require using arrow functions for callbacks", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-arrow-callback" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-const.js b/tools/node_modules/eslint/lib/rules/prefer-const.js index f6e79e71c3..b44bd7592b 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-const.js +++ b/tools/node_modules/eslint/lib/rules/prefer-const.js @@ -332,7 +332,6 @@ module.exports = { docs: { description: "require `const` declarations for variables that are never reassigned after declared", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-const" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index f82bb75c12..46986d237d 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "require destructuring from arrays and/or objects", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-destructuring" }, @@ -119,8 +118,8 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- - // eslint-disable-next-line jsdoc/require-description /** + * Checks if destructuring type should be checked. * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator" * @param {string} destructuringType "array" or "object" * @returns {boolean} `true` if the destructuring type should be checked for the given node @@ -221,7 +220,11 @@ module.exports = { * @returns {void} */ function performCheck(leftNode, rightNode, reportNode) { - if (rightNode.type !== "MemberExpression" || rightNode.object.type === "Super") { + if ( + rightNode.type !== "MemberExpression" || + rightNode.object.type === "Super" || + rightNode.property.type === "PrivateIdentifier" + ) { return; } diff --git a/tools/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js b/tools/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js index 6121af8897..de802ce1e1 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +++ b/tools/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js @@ -90,7 +90,6 @@ module.exports = { docs: { description: "disallow the use of `Math.pow` in favor of the `**` operator", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/prefer-exponentiation-operator" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js index 7d0aa3f9dc..41aa549327 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js +++ b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js @@ -33,7 +33,6 @@ module.exports = { docs: { description: "enforce using named capture group in regular expression", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-named-capture-group" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js index cc82e6653c..91bb26724e 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -45,7 +45,6 @@ module.exports = { docs: { description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-numeric-literals" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js index ab252c73ae..3958a51b30 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js @@ -247,7 +247,6 @@ module.exports = { docs: { description: "disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/prefer-object-spread" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js b/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js index ec16e44555..bdc1fef4d7 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +++ b/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "require using Error objects as Promise rejection reasons", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-promise-reject-errors" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-reflect.js b/tools/node_modules/eslint/lib/rules/prefer-reflect.js index 156d61251c..fea88c6782 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-reflect.js +++ b/tools/node_modules/eslint/lib/rules/prefer-reflect.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require `Reflect` methods where applicable", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-reflect" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-regex-literals.js b/tools/node_modules/eslint/lib/rules/prefer-regex-literals.js index 9e8ce02354..fbfeb5636d 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-regex-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-regex-literals.js @@ -54,7 +54,6 @@ module.exports = { docs: { description: "disallow use of the `RegExp` constructor in favor of regular expression literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-regex-literals" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-rest-params.js b/tools/node_modules/eslint/lib/rules/prefer-rest-params.js index 3ecea732af..157f0bbd61 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-rest-params.js +++ b/tools/node_modules/eslint/lib/rules/prefer-rest-params.js @@ -65,7 +65,6 @@ module.exports = { docs: { description: "require rest parameters instead of `arguments`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-rest-params" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-spread.js b/tools/node_modules/eslint/lib/rules/prefer-spread.js index d3c3c4d229..3944fedb12 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-spread.js @@ -49,7 +49,6 @@ module.exports = { docs: { description: "require spread operators instead of `.apply()`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-spread" }, diff --git a/tools/node_modules/eslint/lib/rules/prefer-template.js b/tools/node_modules/eslint/lib/rules/prefer-template.js index cb967660a6..564dd555f8 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-template.js +++ b/tools/node_modules/eslint/lib/rules/prefer-template.js @@ -128,7 +128,6 @@ module.exports = { docs: { description: "require template literals instead of string concatenation", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-template" }, diff --git a/tools/node_modules/eslint/lib/rules/quote-props.js b/tools/node_modules/eslint/lib/rules/quote-props.js index fab7bdc9c1..ce277cdcc9 100644 --- a/tools/node_modules/eslint/lib/rules/quote-props.js +++ b/tools/node_modules/eslint/lib/rules/quote-props.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "require quotes around object literal property names", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/quote-props" }, @@ -91,7 +90,7 @@ module.exports = { /** * Checks whether a certain string constitutes an ES3 token - * @param {string} tokenStr The string to be checked. + * @param {string} tokenStr The string to be checked. * @returns {boolean} `true` if it is an ES3 token. */ function isKeyword(tokenStr) { @@ -100,9 +99,9 @@ module.exports = { /** * Checks if an espree-tokenized key has redundant quotes (i.e. whether quotes are unnecessary) - * @param {string} rawKey The raw key value from the source - * @param {espreeTokens} tokens The espree-tokenized node key - * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked + * @param {string} rawKey The raw key value from the source + * @param {espreeTokens} tokens The espree-tokenized node key + * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked * @returns {boolean} Whether or not a key has redundant quotes. * @private */ @@ -139,7 +138,7 @@ module.exports = { /** * Ensures that a property's key is quoted only when necessary - * @param {ASTNode} node Property AST node + * @param {ASTNode} node Property AST node * @returns {void} */ function checkUnnecessaryQuotes(node) { @@ -195,7 +194,7 @@ module.exports = { /** * Ensures that a property's key is quoted - * @param {ASTNode} node Property AST node + * @param {ASTNode} node Property AST node * @returns {void} */ function checkOmittedQuotes(node) { @@ -213,8 +212,8 @@ module.exports = { /** * Ensures that an object's keys are consistently quoted, optionally checks for redundancy of quotes - * @param {ASTNode} node Property AST node - * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy + * @param {ASTNode} node Property AST node + * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy * @returns {void} */ function checkConsistency(node, checkQuotesRedundancy) { diff --git a/tools/node_modules/eslint/lib/rules/quotes.js b/tools/node_modules/eslint/lib/rules/quotes.js index da7e127493..d7959c0d1f 100644 --- a/tools/node_modules/eslint/lib/rules/quotes.js +++ b/tools/node_modules/eslint/lib/rules/quotes.js @@ -80,7 +80,6 @@ module.exports = { docs: { description: "enforce the consistent use of either backticks, double, or single quotes", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/quotes" }, @@ -216,6 +215,7 @@ module.exports = { // LiteralPropertyName. case "Property": + case "PropertyDefinition": case "MethodDefinition": return parent.key === node && !parent.computed; diff --git a/tools/node_modules/eslint/lib/rules/radix.js b/tools/node_modules/eslint/lib/rules/radix.js index d1b67e5e28..0c6c6ffb1a 100644 --- a/tools/node_modules/eslint/lib/rules/radix.js +++ b/tools/node_modules/eslint/lib/rules/radix.js @@ -80,12 +80,12 @@ module.exports = { docs: { description: "enforce the consistent use of the radix argument when using `parseInt()`", - category: "Best Practices", recommended: false, - url: "https://eslint.org/docs/rules/radix", - suggestion: true + url: "https://eslint.org/docs/rules/radix" }, + hasSuggestions: true, + schema: [ { enum: ["always", "as-needed"] diff --git a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js index b3df907420..9eee4ca38b 100644 --- a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js +++ b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js @@ -79,6 +79,9 @@ function isLocalVariableWithoutEscape(variable, isMemberAccess) { reference.from.variableScope === functionScope); } +/** + * Represents segment information. + */ class SegmentInfo { constructor() { this.info = new WeakMap(); @@ -168,7 +171,6 @@ module.exports = { docs: { description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/require-atomic-updates" }, @@ -177,7 +179,8 @@ module.exports = { schema: [], messages: { - nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`." + nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.", + nonAtomicObjectUpdate: "Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`." } }, @@ -273,13 +276,25 @@ module.exports = { const variable = reference.resolved; if (segmentInfo.isOutdated(codePath.currentSegments, variable)) { - context.report({ - node: node.parent, - messageId: "nonAtomicUpdate", - data: { - value: sourceCode.getText(node.parent.left) - } - }); + if (node.parent.left === reference.identifier) { + context.report({ + node: node.parent, + messageId: "nonAtomicUpdate", + data: { + value: variable.name + } + }); + } else { + context.report({ + node: node.parent, + messageId: "nonAtomicObjectUpdate", + data: { + value: sourceCode.getText(node.parent.left), + object: variable.name + } + }); + } + } } } diff --git a/tools/node_modules/eslint/lib/rules/require-await.js b/tools/node_modules/eslint/lib/rules/require-await.js index 9b5acc78c8..8ec6f547ae 100644 --- a/tools/node_modules/eslint/lib/rules/require-await.js +++ b/tools/node_modules/eslint/lib/rules/require-await.js @@ -34,7 +34,6 @@ module.exports = { docs: { description: "disallow async functions which have no `await` expression", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/require-await" }, diff --git a/tools/node_modules/eslint/lib/rules/require-jsdoc.js b/tools/node_modules/eslint/lib/rules/require-jsdoc.js index e581b2bee4..1d76e3d222 100644 --- a/tools/node_modules/eslint/lib/rules/require-jsdoc.js +++ b/tools/node_modules/eslint/lib/rules/require-jsdoc.js @@ -1,6 +1,7 @@ /** * @fileoverview Rule to check for jsdoc presence. * @author Gyandeep Singh + * @deprecated in ESLint v5.10.0 */ "use strict"; @@ -10,7 +11,6 @@ module.exports = { docs: { description: "require JSDoc comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/require-jsdoc" }, diff --git a/tools/node_modules/eslint/lib/rules/require-unicode-regexp.js b/tools/node_modules/eslint/lib/rules/require-unicode-regexp.js index 880405e9a2..a332b48da6 100644 --- a/tools/node_modules/eslint/lib/rules/require-unicode-regexp.js +++ b/tools/node_modules/eslint/lib/rules/require-unicode-regexp.js @@ -26,7 +26,6 @@ module.exports = { docs: { description: "enforce the use of `u` flag on RegExp", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/require-unicode-regexp" }, diff --git a/tools/node_modules/eslint/lib/rules/require-yield.js b/tools/node_modules/eslint/lib/rules/require-yield.js index af2344dfa6..f5b5d53039 100644 --- a/tools/node_modules/eslint/lib/rules/require-yield.js +++ b/tools/node_modules/eslint/lib/rules/require-yield.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require generator functions to contain `yield`", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/require-yield" }, diff --git a/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js b/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js index 8cb9814f0c..a636defdcd 100644 --- a/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js +++ b/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce spacing between rest and spread operators and their expressions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/rest-spread-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/semi-spacing.js b/tools/node_modules/eslint/lib/rules/semi-spacing.js index 5c546f2902..e5e2ae25cc 100644 --- a/tools/node_modules/eslint/lib/rules/semi-spacing.js +++ b/tools/node_modules/eslint/lib/rules/semi-spacing.js @@ -17,7 +17,6 @@ module.exports = { docs: { description: "enforce consistent spacing before and after semicolons", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi-spacing" }, @@ -238,7 +237,8 @@ module.exports = { if (node.test) { checkSemicolonSpacing(sourceCode.getTokenAfter(node.test), node); } - } + }, + PropertyDefinition: checkNode }; } }; diff --git a/tools/node_modules/eslint/lib/rules/semi-style.js b/tools/node_modules/eslint/lib/rules/semi-style.js index 0c9bec4c85..43d8d51f96 100644 --- a/tools/node_modules/eslint/lib/rules/semi-style.js +++ b/tools/node_modules/eslint/lib/rules/semi-style.js @@ -15,15 +15,13 @@ const astUtils = require("./utils/ast-utils"); // Rule Definition //------------------------------------------------------------------------------ -const SELECTOR = `:matches(${ - [ - "BreakStatement", "ContinueStatement", "DebuggerStatement", - "DoWhileStatement", "ExportAllDeclaration", - "ExportDefaultDeclaration", "ExportNamedDeclaration", - "ExpressionStatement", "ImportDeclaration", "ReturnStatement", - "ThrowStatement", "VariableDeclaration" - ].join(",") -})`; +const SELECTOR = [ + "BreakStatement", "ContinueStatement", "DebuggerStatement", + "DoWhileStatement", "ExportAllDeclaration", + "ExportDefaultDeclaration", "ExportNamedDeclaration", + "ExpressionStatement", "ImportDeclaration", "ReturnStatement", + "ThrowStatement", "VariableDeclaration", "PropertyDefinition" +].join(","); /** * Get the child node list of a given node. @@ -35,7 +33,7 @@ const SELECTOR = `:matches(${ function getChildren(node) { const t = node.type; - if (t === "BlockStatement" || t === "Program") { + if (t === "BlockStatement" || t === "Program" || t === "ClassBody") { return node.body; } if (t === "SwitchCase") { @@ -69,7 +67,6 @@ module.exports = { docs: { description: "enforce location of semicolons", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi-style" }, diff --git a/tools/node_modules/eslint/lib/rules/semi.js b/tools/node_modules/eslint/lib/rules/semi.js index d2f0670427..4124a8c508 100644 --- a/tools/node_modules/eslint/lib/rules/semi.js +++ b/tools/node_modules/eslint/lib/rules/semi.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "require or disallow semicolons instead of ASI", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi" }, @@ -78,6 +77,8 @@ module.exports = { create(context) { const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-` + const unsafeClassFieldNames = new Set(["get", "set", "static"]); + const unsafeClassFieldFollowers = new Set(["*", "in", "instanceof"]); const options = context.options[1]; const never = context.options[0] === "never"; const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); @@ -166,6 +167,55 @@ module.exports = { ); } + /** + * Checks if a given PropertyDefinition node followed by a semicolon + * can safely remove that semicolon. It is not to safe to remove if + * the class field name is "get", "set", or "static", or if + * followed by a generator method. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node cannot have the semicolon + * removed. + */ + function maybeClassFieldAsiHazard(node) { + + if (node.type !== "PropertyDefinition") { + return false; + } + + /* + * Computed property names and non-identifiers are always safe + * as they can be distinguished from keywords easily. + */ + const needsNameCheck = !node.computed && node.key.type === "Identifier"; + + /* + * Certain names are problematic unless they also have a + * a way to distinguish between keywords and property + * names. + */ + if (needsNameCheck && unsafeClassFieldNames.has(node.key.name)) { + + /* + * Special case: If the field name is `static`, + * it is only valid if the field is marked as static, + * so "static static" is okay but "static" is not. + */ + const isStaticStatic = node.static && node.key.name === "static"; + + /* + * For other unsafe names, we only care if there is no + * initializer. No initializer = hazard. + */ + if (!isStaticStatic && !node.value) { + return true; + } + } + + const followingToken = sourceCode.getTokenAfter(node); + + return unsafeClassFieldFollowers.has(followingToken.value); + } + /** * Check whether a given node is on the same line with the next token. * @param {Node} node A statement node to check. @@ -233,10 +283,19 @@ module.exports = { if (isRedundantSemi(sourceCode.getLastToken(node))) { return true; // `;;` or `;}` } + if (maybeClassFieldAsiHazard(node)) { + return false; + } if (isOnSameLineWithNextToken(node)) { return false; // One liner. } - if (beforeStatementContinuationChars === "never" && !maybeAsiHazardAfter(node)) { + + // continuation characters should not apply to class fields + if ( + node.type !== "PropertyDefinition" && + beforeStatementContinuationChars === "never" && + !maybeAsiHazardAfter(node) + ) { return true; // ASI works. This statement doesn't connect to the next. } if (!maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { @@ -276,7 +335,11 @@ module.exports = { if (never) { if (isSemi && canRemoveSemicolon(node)) { report(node, true); - } else if (!isSemi && beforeStatementContinuationChars === "always" && maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { + } else if ( + !isSemi && beforeStatementContinuationChars === "always" && + node.type !== "PropertyDefinition" && + maybeAsiHazardBefore(sourceCode.getTokenAfter(node)) + ) { report(node); } } else { @@ -329,7 +392,8 @@ module.exports = { if (!/(?:Class|Function)Declaration/u.test(node.declaration.type)) { checkForSemicolon(node); } - } + }, + PropertyDefinition: checkForSemicolon }; } diff --git a/tools/node_modules/eslint/lib/rules/sort-imports.js b/tools/node_modules/eslint/lib/rules/sort-imports.js index 4c3ddec766..dd43daddf0 100644 --- a/tools/node_modules/eslint/lib/rules/sort-imports.js +++ b/tools/node_modules/eslint/lib/rules/sort-imports.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "enforce sorted import declarations within modules", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/sort-imports" }, diff --git a/tools/node_modules/eslint/lib/rules/sort-keys.js b/tools/node_modules/eslint/lib/rules/sort-keys.js index 8a95ee25d6..65a9914227 100644 --- a/tools/node_modules/eslint/lib/rules/sort-keys.js +++ b/tools/node_modules/eslint/lib/rules/sort-keys.js @@ -81,7 +81,6 @@ module.exports = { docs: { description: "require object keys to be sorted", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/sort-keys" }, diff --git a/tools/node_modules/eslint/lib/rules/sort-vars.js b/tools/node_modules/eslint/lib/rules/sort-vars.js index 7add2cf74b..0616c44ac6 100644 --- a/tools/node_modules/eslint/lib/rules/sort-vars.js +++ b/tools/node_modules/eslint/lib/rules/sort-vars.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require variables within the same declaration block to be sorted", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/sort-vars" }, diff --git a/tools/node_modules/eslint/lib/rules/space-before-blocks.js b/tools/node_modules/eslint/lib/rules/space-before-blocks.js index 87ef9bfd88..87d5b27aac 100644 --- a/tools/node_modules/eslint/lib/rules/space-before-blocks.js +++ b/tools/node_modules/eslint/lib/rules/space-before-blocks.js @@ -40,7 +40,6 @@ module.exports = { docs: { description: "enforce consistent spacing before blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-before-blocks" }, @@ -108,13 +107,25 @@ module.exports = { * Checks whether the spacing before the given block is already controlled by another rule: * - `arrow-spacing` checks spaces after `=>`. * - `keyword-spacing` checks spaces after keywords in certain contexts. + * - `switch-colon-spacing` checks spaces after `:` of switch cases. * @param {Token} precedingToken first token before the block. * @param {ASTNode|Token} node `BlockStatement` node or `{` token of a `SwitchStatement` node. * @returns {boolean} `true` if requiring or disallowing spaces before the given block could produce conflicts with other rules. */ function isConflicted(precedingToken, node) { - return astUtils.isArrowToken(precedingToken) || - astUtils.isKeywordToken(precedingToken) && !isFunctionBody(node); + return ( + astUtils.isArrowToken(precedingToken) || + ( + astUtils.isKeywordToken(precedingToken) && + !isFunctionBody(node) + ) || + ( + astUtils.isColonToken(precedingToken) && + node.parent && + node.parent.type === "SwitchCase" && + precedingToken === astUtils.getSwitchCaseColonToken(node.parent, sourceCode) + ) + ); } /** diff --git a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js index 1021a110cf..b60bee0409 100644 --- a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js +++ b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce consistent spacing before `function` definition opening parenthesis", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-before-function-paren" }, diff --git a/tools/node_modules/eslint/lib/rules/space-in-parens.js b/tools/node_modules/eslint/lib/rules/space-in-parens.js index b0a604d955..24378b89f0 100644 --- a/tools/node_modules/eslint/lib/rules/space-in-parens.js +++ b/tools/node_modules/eslint/lib/rules/space-in-parens.js @@ -16,7 +16,6 @@ module.exports = { docs: { description: "enforce consistent spacing inside parentheses", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-in-parens" }, diff --git a/tools/node_modules/eslint/lib/rules/space-infix-ops.js b/tools/node_modules/eslint/lib/rules/space-infix-ops.js index 3c550984fc..8065b5240b 100644 --- a/tools/node_modules/eslint/lib/rules/space-infix-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-infix-ops.js @@ -4,6 +4,8 @@ */ "use strict"; +const { isEqToken } = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -14,7 +16,6 @@ module.exports = { docs: { description: "require spacing around infix operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-infix-ops" }, @@ -164,7 +165,29 @@ module.exports = { BinaryExpression: checkBinary, LogicalExpression: checkBinary, ConditionalExpression: checkConditional, - VariableDeclarator: checkVar + VariableDeclarator: checkVar, + + PropertyDefinition(node) { + if (!node.value) { + return; + } + + /* + * Because of computed properties and type annotations, some + * tokens may exist between `node.key` and `=`. + * Therefore, find the `=` from the right. + */ + const operatorToken = sourceCode.getTokenBefore(node.value, isEqToken); + const leftToken = sourceCode.getTokenBefore(operatorToken); + const rightToken = sourceCode.getTokenAfter(operatorToken); + + if ( + !sourceCode.isSpaceBetweenTokens(leftToken, operatorToken) || + !sourceCode.isSpaceBetweenTokens(operatorToken, rightToken) + ) { + report(node, operatorToken); + } + } }; } diff --git a/tools/node_modules/eslint/lib/rules/space-unary-ops.js b/tools/node_modules/eslint/lib/rules/space-unary-ops.js index 57f6e78450..de9018f9b6 100644 --- a/tools/node_modules/eslint/lib/rules/space-unary-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-unary-ops.js @@ -20,7 +20,6 @@ module.exports = { docs: { description: "enforce consistent spacing before or after unary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-unary-ops" }, diff --git a/tools/node_modules/eslint/lib/rules/spaced-comment.js b/tools/node_modules/eslint/lib/rules/spaced-comment.js index 226a2d4479..6f0b432b76 100644 --- a/tools/node_modules/eslint/lib/rules/spaced-comment.js +++ b/tools/node_modules/eslint/lib/rules/spaced-comment.js @@ -152,7 +152,6 @@ module.exports = { docs: { description: "enforce consistent spacing after the `//` or `/*` in a comment", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/spaced-comment" }, diff --git a/tools/node_modules/eslint/lib/rules/strict.js b/tools/node_modules/eslint/lib/rules/strict.js index b0d6cf9172..24af39dabe 100644 --- a/tools/node_modules/eslint/lib/rules/strict.js +++ b/tools/node_modules/eslint/lib/rules/strict.js @@ -69,7 +69,6 @@ module.exports = { docs: { description: "require or disallow strict mode directives", - category: "Strict Mode", recommended: false, url: "https://eslint.org/docs/rules/strict" }, diff --git a/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js b/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js index c90641573c..a4f3ba213e 100644 --- a/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js +++ b/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "enforce spacing around colons of switch statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/switch-colon-spacing" }, @@ -51,18 +50,6 @@ module.exports = { const beforeSpacing = options.before === true; // false by default const afterSpacing = options.after !== false; // true by default - /** - * Get the colon token of the given SwitchCase node. - * @param {ASTNode} node The SwitchCase node to get. - * @returns {Token} The colon token of the node. - */ - function getColonToken(node) { - if (node.test) { - return sourceCode.getTokenAfter(node.test, astUtils.isColonToken); - } - return sourceCode.getFirstToken(node, 1); - } - /** * Check whether the spacing between the given 2 tokens is valid or not. * @param {Token} left The left token to check. @@ -115,7 +102,7 @@ module.exports = { return { SwitchCase(node) { - const colonToken = getColonToken(node); + const colonToken = astUtils.getSwitchCaseColonToken(node, sourceCode); const beforeToken = sourceCode.getTokenBefore(colonToken); const afterToken = sourceCode.getTokenAfter(colonToken); diff --git a/tools/node_modules/eslint/lib/rules/symbol-description.js b/tools/node_modules/eslint/lib/rules/symbol-description.js index 155cea4dc0..9f5d9358f0 100644 --- a/tools/node_modules/eslint/lib/rules/symbol-description.js +++ b/tools/node_modules/eslint/lib/rules/symbol-description.js @@ -22,7 +22,6 @@ module.exports = { docs: { description: "require symbol descriptions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/symbol-description" }, diff --git a/tools/node_modules/eslint/lib/rules/template-curly-spacing.js b/tools/node_modules/eslint/lib/rules/template-curly-spacing.js index 26043bc912..5133a54539 100644 --- a/tools/node_modules/eslint/lib/rules/template-curly-spacing.js +++ b/tools/node_modules/eslint/lib/rules/template-curly-spacing.js @@ -21,7 +21,6 @@ module.exports = { docs: { description: "require or disallow spacing around embedded expressions of template strings", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/template-curly-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/template-tag-spacing.js b/tools/node_modules/eslint/lib/rules/template-tag-spacing.js index 16f586255a..45b66068a8 100644 --- a/tools/node_modules/eslint/lib/rules/template-tag-spacing.js +++ b/tools/node_modules/eslint/lib/rules/template-tag-spacing.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require or disallow spacing between template tags and their literals", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/template-tag-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/unicode-bom.js b/tools/node_modules/eslint/lib/rules/unicode-bom.js index 39642f8519..e80497d19c 100644 --- a/tools/node_modules/eslint/lib/rules/unicode-bom.js +++ b/tools/node_modules/eslint/lib/rules/unicode-bom.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "require or disallow Unicode byte order mark (BOM)", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/unicode-bom" }, diff --git a/tools/node_modules/eslint/lib/rules/use-isnan.js b/tools/node_modules/eslint/lib/rules/use-isnan.js index ef95b21314..cd8331f932 100644 --- a/tools/node_modules/eslint/lib/rules/use-isnan.js +++ b/tools/node_modules/eslint/lib/rules/use-isnan.js @@ -37,7 +37,6 @@ module.exports = { docs: { description: "require calls to `isNaN()` when checking for `NaN`", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/use-isnan" }, diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index 6b85300113..e4fd977c11 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -266,6 +266,7 @@ function getStaticPropertyName(node) { return getStaticPropertyName(node.expression); case "Property": + case "PropertyDefinition": case "MethodDefinition": prop = node.key; break; @@ -407,6 +408,7 @@ function isSameReference(left, right, disableStaticComputedKey = false) { return true; case "Identifier": + case "PrivateIdentifier": return left.name === right.name; case "Literal": return equalLiteralValue(left, right); @@ -516,6 +518,15 @@ function isParenthesised(sourceCode, node) { nextToken.value === ")" && nextToken.range[0] >= node.range[1]; } +/** + * Checks if the given token is a `=` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a `=` token. + */ +function isEqToken(token) { + return token.value === "=" && token.type === "Punctuator"; +} + /** * Checks if the given token is an arrow token or not. * @param {Token} token The token to check. @@ -649,6 +660,16 @@ function isKeywordToken(token) { * @returns {Token} `(` token. */ function getOpeningParenOfParams(node, sourceCode) { + + // If the node is an arrow function and doesn't have parens, this returns the identifier of the first param. + if (node.type === "ArrowFunctionExpression" && node.params.length === 1) { + const argToken = sourceCode.getFirstToken(node.params[0]); + const maybeParenToken = sourceCode.getTokenBefore(argToken); + + return isOpeningParenToken(maybeParenToken) ? maybeParenToken : argToken; + } + + // Otherwise, returns paren. return node.id ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) : sourceCode.getFirstToken(node, isOpeningParenToken); @@ -735,6 +756,19 @@ function isLogicalAssignmentOperator(operator) { return LOGICAL_ASSIGNMENT_OPERATORS.has(operator); } +/** + * Get the colon token of the given SwitchCase node. + * @param {ASTNode} node The SwitchCase node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token} The colon token of the node. + */ +function getSwitchCaseColonToken(node, sourceCode) { + if (node.test) { + return sourceCode.getTokenAfter(node.test, isColonToken); + } + return sourceCode.getFirstToken(node, 1); +} + //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -794,6 +828,7 @@ module.exports = { isOpeningBracketToken, isOpeningParenToken, isSemicolonToken, + isEqToken, /** * Checks whether or not a given node is a string literal. @@ -836,8 +871,8 @@ module.exports = { /** * Validate that a string passed in is surrounded by the specified character - * @param {string} val The text to check. - * @param {string} character The character to see if it's surrounded by. + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. * @returns {boolean} True if the text is surrounded by the character, false if not. * @private */ @@ -923,6 +958,16 @@ module.exports = { * @returns {boolean} The function node is the default `this` binding. */ isDefaultThisBinding(node, sourceCode, { capIsConstructor = true } = {}) { + + /* + * Class field initializers are implicit functions, but ESTree doesn't have the AST node of field initializers. + * Therefore, A expression node at `PropertyDefinition#value` is a function. + * In this case, `this` is always not default binding. + */ + if (node && node.parent && node.parent.type === "PropertyDefinition" && node.value === node) { + return false; + } + if ( (capIsConstructor && isES5Constructor(node)) || hasJSDocThisTag(node, sourceCode) @@ -983,8 +1028,10 @@ module.exports = { * class A { get foo() { ... } } * class A { set foo() { ... } } * class A { static foo() { ... } } + * class A { foo = function() { ... } } */ case "Property": + case "PropertyDefinition": case "MethodDefinition": return parent.value !== currentNode; @@ -1261,7 +1308,8 @@ module.exports = { * 5e1_000 // false * 5n // false * 1_000n // false - * '5' // false + * "5" // false + * */ isDecimalInteger(node) { return node.type === "Literal" && typeof node.value === "number" && @@ -1323,6 +1371,16 @@ module.exports = { * - `class A { static async foo() {} }` .... `static async method 'foo'` * - `class A { static get foo() {} }` ...... `static getter 'foo'` * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` + * - `class A { foo = () => {}; }` .......... `method 'foo'` + * - `class A { foo = function() {}; }` ..... `method 'foo'` + * - `class A { foo = function bar() {}; }` . `method 'foo'` + * - `class A { static foo = () => {}; }` ... `static method 'foo'` + * - `class A { '#foo' = () => {}; }` ....... `method '#foo'` + * - `class A { #foo = () => {}; }` ......... `private method #foo` + * - `class A { static #foo = () => {}; }` .. `static private method #foo` + * - `class A { '#foo'() {} }` .............. `method '#foo'` + * - `class A { #foo() {} }` ................ `private method #foo` + * - `class A { static #foo() {} }` ......... `static private method #foo` * @param {ASTNode} node The function node to get. * @returns {string} The name and kind of the function node. */ @@ -1330,8 +1388,15 @@ module.exports = { const parent = node.parent; const tokens = []; - if (parent.type === "MethodDefinition" && parent.static) { - tokens.push("static"); + if (parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + + // The proposal uses `static` word consistently before visibility words: https://github.com/tc39/proposal-static-class-features + if (parent.static) { + tokens.push("static"); + } + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } } if (node.async) { tokens.push("async"); @@ -1340,9 +1405,7 @@ module.exports = { tokens.push("generator"); } - if (node.type === "ArrowFunctionExpression") { - tokens.push("arrow", "function"); - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { + if (parent.type === "Property" || parent.type === "MethodDefinition") { if (parent.kind === "constructor") { return "constructor"; } @@ -1353,18 +1416,29 @@ module.exports = { } else { tokens.push("method"); } + } else if (parent.type === "PropertyDefinition") { + tokens.push("method"); } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } tokens.push("function"); } - if (node.id) { - tokens.push(`'${node.id.name}'`); - } else { - const name = getStaticPropertyName(parent); + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getStaticPropertyName(parent); - if (name !== null) { - tokens.push(`'${name}'`); + if (name !== null) { + tokens.push(`'${name}'`); + } else if (node.id) { + tokens.push(`'${node.id.name}'`); + } } + } else if (node.id) { + tokens.push(`'${node.id.name}'`); } return tokens.join(" "); @@ -1457,6 +1531,12 @@ module.exports = { * ^^^^^^^^^^^^^^ * - `class A { static set foo(a) {} }` * ^^^^^^^^^^^^^^ + * - `class A { foo = function() {} }` + * ^^^^^^^^^^^^^^ + * - `class A { static foo = function() {} }` + * ^^^^^^^^^^^^^^^^^^^^^ + * - `class A { foo = (a, b) => {} }` + * ^^^^^^ * @param {ASTNode} node The function node to get. * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {string} The location of the function node for reporting. @@ -1466,14 +1546,14 @@ module.exports = { let start = null; let end = null; - if (node.type === "ArrowFunctionExpression") { + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + start = parent.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else if (node.type === "ArrowFunctionExpression") { const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); start = arrowToken.loc.start; end = arrowToken.loc.end; - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { - start = parent.loc.start; - end = getOpeningParenOfParams(node, sourceCode).loc.start; } else { start = node.loc.start; end = getOpeningParenOfParams(node, sourceCode).loc.start; @@ -1573,9 +1653,9 @@ module.exports = { return sourceCode.getText().slice(leftToken.range[0], rightToken.range[1]); }, - /* + /** * Determine if a node has a possibility to be an Error object - * @param {ASTNode} node ASTNode to check + * @param {ASTNode} node ASTNode to check * @returns {boolean} True if there is a chance it contains an Error obj */ couldBeError(node) { @@ -1805,5 +1885,6 @@ module.exports = { isSpecificMemberAccess, equalLiteralValue, isSameReference, - isLogicalAssignmentOperator + isLogicalAssignmentOperator, + getSwitchCaseColonToken }; diff --git a/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js b/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js index d426d85c59..7f116a2684 100644 --- a/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +++ b/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js @@ -14,10 +14,10 @@ const debug = require("debug")("eslint:rules"); * const rules = new LazyLoadingRuleMap([ * ["eqeqeq", () => require("eqeqeq")], * ["semi", () => require("semi")], - * ["no-unused-vars", () => require("no-unused-vars")], - * ]) + * ["no-unused-vars", () => require("no-unused-vars")] + * ]); * - * rules.get("semi") // call `() => require("semi")` here. + * rules.get("semi"); // call `() => require("semi")` here. * * @extends {Map Rule>} */ diff --git a/tools/node_modules/eslint/lib/rules/valid-jsdoc.js b/tools/node_modules/eslint/lib/rules/valid-jsdoc.js index 9ec6938e35..824410b337 100644 --- a/tools/node_modules/eslint/lib/rules/valid-jsdoc.js +++ b/tools/node_modules/eslint/lib/rules/valid-jsdoc.js @@ -1,6 +1,7 @@ /** * @fileoverview Validates JSDoc comments are syntactically correct * @author Nicholas C. Zakas + * @deprecated in ESLint v5.10.0 */ "use strict"; @@ -20,7 +21,6 @@ module.exports = { docs: { description: "enforce valid JSDoc comments", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/valid-jsdoc" }, diff --git a/tools/node_modules/eslint/lib/rules/valid-typeof.js b/tools/node_modules/eslint/lib/rules/valid-typeof.js index a0f20f74d0..33b64f56cc 100644 --- a/tools/node_modules/eslint/lib/rules/valid-typeof.js +++ b/tools/node_modules/eslint/lib/rules/valid-typeof.js @@ -14,7 +14,6 @@ module.exports = { docs: { description: "enforce comparing `typeof` expressions against valid strings", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/valid-typeof" }, diff --git a/tools/node_modules/eslint/lib/rules/vars-on-top.js b/tools/node_modules/eslint/lib/rules/vars-on-top.js index 28ddae442b..6f913dcad9 100644 --- a/tools/node_modules/eslint/lib/rules/vars-on-top.js +++ b/tools/node_modules/eslint/lib/rules/vars-on-top.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require `var` declarations be placed at the top of their containing scope", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/vars-on-top" }, @@ -32,8 +31,8 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- - // eslint-disable-next-line jsdoc/require-description /** + * Has AST suggesting a directive. * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ diff --git a/tools/node_modules/eslint/lib/rules/wrap-iife.js b/tools/node_modules/eslint/lib/rules/wrap-iife.js index 07e5b84a4a..498d7bd284 100644 --- a/tools/node_modules/eslint/lib/rules/wrap-iife.js +++ b/tools/node_modules/eslint/lib/rules/wrap-iife.js @@ -43,7 +43,6 @@ module.exports = { docs: { description: "require parentheses around immediate `function` invocations", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/wrap-iife" }, diff --git a/tools/node_modules/eslint/lib/rules/wrap-regex.js b/tools/node_modules/eslint/lib/rules/wrap-regex.js index 4ecbcecbbe..945eb5ecea 100644 --- a/tools/node_modules/eslint/lib/rules/wrap-regex.js +++ b/tools/node_modules/eslint/lib/rules/wrap-regex.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require parenthesis around regex literals", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/wrap-regex" }, diff --git a/tools/node_modules/eslint/lib/rules/yield-star-spacing.js b/tools/node_modules/eslint/lib/rules/yield-star-spacing.js index 20b8e9ea91..8c3eefa4ac 100644 --- a/tools/node_modules/eslint/lib/rules/yield-star-spacing.js +++ b/tools/node_modules/eslint/lib/rules/yield-star-spacing.js @@ -15,7 +15,6 @@ module.exports = { docs: { description: "require or disallow spacing around the `*` in `yield*` expressions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/yield-star-spacing" }, diff --git a/tools/node_modules/eslint/lib/rules/yoda.js b/tools/node_modules/eslint/lib/rules/yoda.js index 2fca757111..2d018dc3df 100644 --- a/tools/node_modules/eslint/lib/rules/yoda.js +++ b/tools/node_modules/eslint/lib/rules/yoda.js @@ -121,7 +121,6 @@ module.exports = { docs: { description: 'require or disallow "Yoda" conditions', - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/yoda" }, diff --git a/tools/node_modules/eslint/lib/shared/ajv.js b/tools/node_modules/eslint/lib/shared/ajv.js index 3fb0fbdd33..f4f6a62183 100644 --- a/tools/node_modules/eslint/lib/shared/ajv.js +++ b/tools/node_modules/eslint/lib/shared/ajv.js @@ -27,7 +27,7 @@ module.exports = (additionalOptions = {}) => { }); ajv.addMetaSchema(metaSchema); - // eslint-disable-next-line no-underscore-dangle + // eslint-disable-next-line no-underscore-dangle -- Ajv's API ajv._opts.defaultMeta = metaSchema.id; return ajv; diff --git a/tools/node_modules/eslint/lib/shared/config-validator.js b/tools/node_modules/eslint/lib/shared/config-validator.js index 03b32f1c91..47353ac481 100644 --- a/tools/node_modules/eslint/lib/shared/config-validator.js +++ b/tools/node_modules/eslint/lib/shared/config-validator.js @@ -24,9 +24,13 @@ const util = require("util"), configSchema = require("../../conf/config-schema"), - BuiltInEnvironments = require("@eslint/eslintrc/conf/environments"), BuiltInRules = require("../rules"), - ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"), + { + Legacy: { + ConfigOps, + environments: BuiltInEnvironments + } + } = require("@eslint/eslintrc"), { emitDeprecationWarning } = require("./deprecation-warnings"); const ajv = require("./ajv")(); @@ -80,6 +84,7 @@ function getRuleOptionsSchema(rule) { /** * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. * @param {options} options The given options for the rule. + * @throws {Error} Wrong severity value. * @returns {number|string} The rule's severity value */ function validateRuleSeverity(options) { @@ -98,6 +103,7 @@ function validateRuleSeverity(options) { * Validates the non-severity options passed to a rule, based on its schema. * @param {{create: Function}} rule The rule to validate * @param {Array} localOptions The options for the rule, excluding severity + * @throws {Error} Any rule validation errors. * @returns {void} */ function validateRuleSchema(rule, localOptions) { @@ -128,6 +134,7 @@ function validateRuleSchema(rule, localOptions) { * @param {Array|number} options The given options for the rule. * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, * no source is prepended to the message. + * @throws {Error} Upon any bad rule configuration. * @returns {void} */ function validateRuleOptions(rule, ruleId, options, source = null) { @@ -152,7 +159,7 @@ function validateRuleOptions(rule, ruleId, options, source = null) { * Validates an environment object * @param {Object} environment The environment config object to validate. * @param {string} source The name of the configuration source to report in any errors. - * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments. * @returns {void} */ function validateEnvironment( @@ -181,7 +188,7 @@ function validateEnvironment( * Validates a rules config object * @param {Object} rulesConfig The rules config object to validate. * @param {string} source The name of the configuration source to report in any errors. - * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules * @returns {void} */ function validateRules( @@ -225,7 +232,8 @@ function validateGlobals(globalsConfig, source = null) { * Validate `processor` configuration. * @param {string|undefined} processorName The processor name. * @param {string} source The name of config file. - * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @param {(id:string) => Processor} getProcessor The getter of defined processors. + * @throws {Error} For invalid processor configuration. * @returns {void} */ function validateProcessor(processorName, source, getProcessor) { @@ -264,6 +272,7 @@ function formatErrors(errors) { * Validates the top level properties of the config object. * @param {Object} config The config object to validate. * @param {string} source The name of the configuration source to report in any errors. + * @throws {Error} For any config invalid per the schema. * @returns {void} */ function validateConfigSchema(config, source = null) { @@ -282,8 +291,8 @@ function validateConfigSchema(config, source = null) { * Validates an entire config object. * @param {Object} config The config object to validate. * @param {string} source The name of the configuration source to report in any errors. - * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. - * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs. * @returns {void} */ function validate(config, source, getAdditionalRule, getAdditionalEnv) { diff --git a/tools/node_modules/eslint/lib/shared/logging.js b/tools/node_modules/eslint/lib/shared/logging.js index 6aa1f5a1e5..7f06a74e14 100644 --- a/tools/node_modules/eslint/lib/shared/logging.js +++ b/tools/node_modules/eslint/lib/shared/logging.js @@ -5,7 +5,7 @@ "use strict"; -/* eslint no-console: "off" */ +/* eslint no-console: "off" -- Logging util */ /* istanbul ignore next */ module.exports = { diff --git a/tools/node_modules/eslint/lib/shared/relative-module-resolver.js b/tools/node_modules/eslint/lib/shared/relative-module-resolver.js index cd743f3795..18a694983c 100644 --- a/tools/node_modules/eslint/lib/shared/relative-module-resolver.js +++ b/tools/node_modules/eslint/lib/shared/relative-module-resolver.js @@ -17,14 +17,7 @@ "use strict"; -const Module = require("module"); - -/* - * `Module.createRequire` is added in v12.2.0. It supports URL as well. - * We only support the case where the argument is a filepath, not a URL. - */ -// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api -const createRequire = Module.createRequire || Module.createRequireFromPath; +const { createRequire } = require("module"); module.exports = { @@ -33,6 +26,7 @@ module.exports = { * @param {string} moduleName The name of a Node module, or a path to a Node module. * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be * a file rather than a directory, but the file need not actually exist. + * @throws {Error} Any error from `module.createRequire` or its `resolve`. * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` */ resolve(moduleName, relativeToPath) { diff --git a/tools/node_modules/eslint/lib/shared/runtime-info.js b/tools/node_modules/eslint/lib/shared/runtime-info.js index aa5eff756a..56c0898be5 100644 --- a/tools/node_modules/eslint/lib/shared/runtime-info.js +++ b/tools/node_modules/eslint/lib/shared/runtime-info.js @@ -40,6 +40,7 @@ function environment() { * Synchronously executes a shell command and formats the result. * @param {string} cmd The command to execute. * @param {Array} args The arguments to be executed with the command. + * @throws {Error} As may be collected by `cross-spawn.sync`. * @returns {string} The version returned by the command. */ function execCommand(cmd, args) { @@ -73,6 +74,7 @@ function environment() { /** * Gets bin version. * @param {string} bin The bin to check. + * @throws {Error} As may be collected by `cross-spawn.sync`. * @returns {string} The normalized version returned by the command. */ function getBinVersion(bin) { @@ -90,6 +92,7 @@ function environment() { * Gets installed npm package version. * @param {string} pkg The package to check. * @param {boolean} global Whether to check globally or not. + * @throws {Error} As may be collected by `cross-spawn.sync`. * @returns {string} The normalized version returned by the command. */ function getNpmPackageVersion(pkg, { global = false } = {}) { diff --git a/tools/node_modules/eslint/lib/shared/traverser.js b/tools/node_modules/eslint/lib/shared/traverser.js index 32f7677950..be0ed59a4f 100644 --- a/tools/node_modules/eslint/lib/shared/traverser.js +++ b/tools/node_modules/eslint/lib/shared/traverser.js @@ -65,16 +65,16 @@ class Traverser { this._leave = null; } - // eslint-disable-next-line jsdoc/require-description /** + * Gives current node. * @returns {ASTNode} The current node. */ current() { return this._current; } - // eslint-disable-next-line jsdoc/require-description /** + * Gives a a copy of the ancestor nodes. * @returns {ASTNode[]} The ancestor nodes. */ parents() { diff --git a/tools/node_modules/eslint/lib/shared/types.js b/tools/node_modules/eslint/lib/shared/types.js index c3b76e42d5..bbfd2ed9a9 100644 --- a/tools/node_modules/eslint/lib/shared/types.js +++ b/tools/node_modules/eslint/lib/shared/types.js @@ -83,12 +83,12 @@ module.exports = {}; /** * @typedef {Object} LintMessage - * @property {number} column The 1-based column number. + * @property {number|undefined} column The 1-based column number. * @property {number} [endColumn] The 1-based column number of the end location. * @property {number} [endLine] The 1-based line number of the end location. * @property {boolean} fatal If `true` then this is a fatal error. * @property {{range:[number,number], text:string}} [fix] Information for autofix. - * @property {number} line The 1-based line number. + * @property {number|undefined} line The 1-based line number. * @property {string} message The error message. * @property {string|null} ruleId The ID of the rule which makes this message. * @property {0|1|2} severity The severity of this message. diff --git a/tools/node_modules/eslint/lib/source-code/source-code.js b/tools/node_modules/eslint/lib/source-code/source-code.js index cc4524fa74..49b2820a84 100644 --- a/tools/node_modules/eslint/lib/source-code/source-code.js +++ b/tools/node_modules/eslint/lib/source-code/source-code.js @@ -143,10 +143,12 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { // Public Interface //------------------------------------------------------------------------------ +/** + * Represents parsed source code. + */ class SourceCode extends TokenStore { /** - * Represents parsed source code. * @param {string|Object} textOrConfig The source code text or config object. * @param {string} textOrConfig.text The source code text. * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. @@ -175,20 +177,20 @@ class SourceCode extends TokenStore { /** * The flag to indicate that the source code has Unicode BOM. - * @type boolean + * @type {boolean} */ this.hasBOM = (text.charCodeAt(0) === 0xFEFF); /** * The original text source code. * BOM was stripped from this text. - * @type string + * @type {string} */ this.text = (this.hasBOM ? text.slice(1) : text); /** * The parsed AST for the source code. - * @type ASTNode + * @type {ASTNode} */ this.ast = ast; @@ -223,7 +225,7 @@ class SourceCode extends TokenStore { /** * The source code split into lines according to ECMA-262 specification. * This is done to avoid each rule needing to do so separately. - * @type string[] + * @type {string[]} */ this.lines = []; this.lineStartIndices = [0]; @@ -506,6 +508,7 @@ class SourceCode extends TokenStore { /** * Converts a source text index into a (line, column) pair. * @param {number} index The index of a character in a file + * @throws {TypeError} If non-numeric index or index out of range. * @returns {Object} A {line, column} location object with a 0-indexed column * @public */ @@ -545,6 +548,9 @@ class SourceCode extends TokenStore { * @param {Object} loc A line/column location * @param {number} loc.line The line number of the location (1-indexed) * @param {number} loc.column The column number of the location (0-indexed) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the line or column is out of the expected range. * @returns {number} The range index of the location in the file. * @public */ diff --git a/tools/node_modules/eslint/lib/source-code/token-store/cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/cursor.js index 4e1595c6dc..494762acdf 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/cursor.js @@ -70,7 +70,7 @@ module.exports = class Cursor { * @abstract */ /* istanbul ignore next */ - moveNext() { // eslint-disable-line class-methods-use-this + moveNext() { // eslint-disable-line class-methods-use-this -- Unused throw new Error("Not implemented."); } }; diff --git a/tools/node_modules/eslint/lib/unsupported-api.js b/tools/node_modules/eslint/lib/unsupported-api.js new file mode 100644 index 0000000000..110b35a47a --- /dev/null +++ b/tools/node_modules/eslint/lib/unsupported-api.js @@ -0,0 +1,23 @@ +/** + * @fileoverview APIs that are not officially supported by ESLint. + * These APIs may change or be removed at any time. Use at your + * own risk. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const { FileEnumerator } = require("./cli-engine/file-enumerator"); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +module.exports = { + builtinRules: require("./rules"), + FileEnumerator +}; diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE b/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE deleted file mode 100644 index f31575ec77..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md b/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md deleted file mode 100644 index 08cacb0477..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/code-frame - -> Generate errors that contain a code frame that point to source locations. - -See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/code-frame -``` - -or using yarn: - -```sh -yarn add @babel/code-frame --dev -``` diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js deleted file mode 100644 index 28d86f7bc1..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js +++ /dev/null @@ -1,167 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codeFrameColumns = codeFrameColumns; -exports.default = _default; - -var _highlight = _interopRequireWildcard(require("@babel/highlight")); - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -let deprecationWarningShown = false; - -function getDefs(chalk) { - return { - gutter: chalk.grey, - marker: chalk.red.bold, - message: chalk.red.bold - }; -} - -const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; - -function getMarkerLines(loc, source, opts) { - const startLoc = Object.assign({ - column: 0, - line: -1 - }, loc.start); - const endLoc = Object.assign({}, startLoc, loc.end); - const { - linesAbove = 2, - linesBelow = 3 - } = opts || {}; - const startLine = startLoc.line; - const startColumn = startLoc.column; - const endLine = endLoc.line; - const endColumn = endLoc.column; - let start = Math.max(startLine - (linesAbove + 1), 0); - let end = Math.min(source.length, endLine + linesBelow); - - if (startLine === -1) { - start = 0; - } - - if (endLine === -1) { - end = source.length; - } - - const lineDiff = endLine - startLine; - const markerLines = {}; - - if (lineDiff) { - for (let i = 0; i <= lineDiff; i++) { - const lineNumber = i + startLine; - - if (!startColumn) { - markerLines[lineNumber] = true; - } else if (i === 0) { - const sourceLength = source[lineNumber - 1].length; - markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]; - } else if (i === lineDiff) { - markerLines[lineNumber] = [0, endColumn]; - } else { - const sourceLength = source[lineNumber - i].length; - markerLines[lineNumber] = [0, sourceLength]; - } - } - } else { - if (startColumn === endColumn) { - if (startColumn) { - markerLines[startLine] = [startColumn, 0]; - } else { - markerLines[startLine] = true; - } - } else { - markerLines[startLine] = [startColumn, endColumn - startColumn]; - } - } - - return { - start, - end, - markerLines - }; -} - -function codeFrameColumns(rawLines, loc, opts = {}) { - const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); - const chalk = (0, _highlight.getChalk)(opts); - const defs = getDefs(chalk); - - const maybeHighlight = (chalkFn, string) => { - return highlighted ? chalkFn(string) : string; - }; - - const lines = rawLines.split(NEWLINE); - const { - start, - end, - markerLines - } = getMarkerLines(loc, lines, opts); - const hasColumns = loc.start && typeof loc.start.column === "number"; - const numberMaxWidth = String(end).length; - const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; - let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => { - const number = start + 1 + index; - const paddedNumber = ` ${number}`.slice(-numberMaxWidth); - const gutter = ` ${paddedNumber} | `; - const hasMarker = markerLines[number]; - const lastMarkerLine = !markerLines[number + 1]; - - if (hasMarker) { - let markerLine = ""; - - if (Array.isArray(hasMarker)) { - const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); - const numberOfMarkers = hasMarker[1] || 1; - markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); - - if (lastMarkerLine && opts.message) { - markerLine += " " + maybeHighlight(defs.message, opts.message); - } - } - - return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); - } else { - return ` ${maybeHighlight(defs.gutter, gutter)}${line}`; - } - }).join("\n"); - - if (opts.message && !hasColumns) { - frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; - } - - if (highlighted) { - return chalk.reset(frame); - } else { - return frame; - } -} - -function _default(rawLines, lineNumber, colNumber, opts = {}) { - if (!deprecationWarningShown) { - deprecationWarningShown = true; - const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; - - if (process.emitWarning) { - process.emitWarning(message, "DeprecationWarning"); - } else { - const deprecationError = new Error(message); - deprecationError.name = "DeprecationWarning"; - console.warn(new Error(message)); - } - } - - colNumber = Math.max(colNumber, 0); - const location = { - start: { - column: colNumber, - line: lineNumber - } - }; - return codeFrameColumns(rawLines, location, opts); -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json b/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json deleted file mode 100644 index 07a28a6bda..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@babel/code-frame", - "version": "7.12.11", - "description": "Generate errors that contain a code frame that point to source locations.", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-code-frame" - }, - "main": "lib/index.js", - "dependencies": { - "@babel/highlight": "^7.10.4" - }, - "devDependencies": { - "@types/chalk": "^2.0.0", - "chalk": "^2.0.0", - "strip-ansi": "^4.0.0" - } -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE deleted file mode 100644 index f31575ec77..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md deleted file mode 100644 index 6733576a8c..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/helper-validator-identifier - -> Validate identifier/keywords name - -See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/helper-validator-identifier -``` - -or using yarn: - -```sh -yarn add @babel/helper-validator-identifier --dev -``` diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js deleted file mode 100644 index 71310db1f3..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isIdentifierStart = isIdentifierStart; -exports.isIdentifierChar = isIdentifierChar; -exports.isIdentifierName = isIdentifierName; -let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; -let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; -const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; -const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; -const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; - -function isInAstralSet(code, set) { - let pos = 0x10000; - - for (let i = 0, length = set.length; i < length; i += 2) { - pos += set[i]; - if (pos > code) return false; - pos += set[i + 1]; - if (pos >= code) return true; - } - - return false; -} - -function isIdentifierStart(code) { - if (code < 65) return code === 36; - if (code <= 90) return true; - if (code < 97) return code === 95; - if (code <= 122) return true; - - if (code <= 0xffff) { - return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - } - - return isInAstralSet(code, astralIdentifierStartCodes); -} - -function isIdentifierChar(code) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code <= 90) return true; - if (code < 97) return code === 95; - if (code <= 122) return true; - - if (code <= 0xffff) { - return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - } - - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} - -function isIdentifierName(name) { - let isFirst = true; - - for (let i = 0; i < name.length; i++) { - let cp = name.charCodeAt(i); - - if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { - const trail = name.charCodeAt(++i); - - if ((trail & 0xfc00) === 0xdc00) { - cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); - } - } - - if (isFirst) { - isFirst = false; - - if (!isIdentifierStart(cp)) { - return false; - } - } else if (!isIdentifierChar(cp)) { - return false; - } - } - - return !isFirst; -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js deleted file mode 100644 index 7b623c90a6..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "isIdentifierName", { - enumerable: true, - get: function () { - return _identifier.isIdentifierName; - } -}); -Object.defineProperty(exports, "isIdentifierChar", { - enumerable: true, - get: function () { - return _identifier.isIdentifierChar; - } -}); -Object.defineProperty(exports, "isIdentifierStart", { - enumerable: true, - get: function () { - return _identifier.isIdentifierStart; - } -}); -Object.defineProperty(exports, "isReservedWord", { - enumerable: true, - get: function () { - return _keyword.isReservedWord; - } -}); -Object.defineProperty(exports, "isStrictBindOnlyReservedWord", { - enumerable: true, - get: function () { - return _keyword.isStrictBindOnlyReservedWord; - } -}); -Object.defineProperty(exports, "isStrictBindReservedWord", { - enumerable: true, - get: function () { - return _keyword.isStrictBindReservedWord; - } -}); -Object.defineProperty(exports, "isStrictReservedWord", { - enumerable: true, - get: function () { - return _keyword.isStrictReservedWord; - } -}); -Object.defineProperty(exports, "isKeyword", { - enumerable: true, - get: function () { - return _keyword.isKeyword; - } -}); - -var _identifier = require("./identifier"); - -var _keyword = require("./keyword"); \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js deleted file mode 100644 index 110cee4002..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isReservedWord = isReservedWord; -exports.isStrictReservedWord = isStrictReservedWord; -exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; -exports.isStrictBindReservedWord = isStrictBindReservedWord; -exports.isKeyword = isKeyword; -const reservedWords = { - keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], - strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], - strictBind: ["eval", "arguments"] -}; -const keywords = new Set(reservedWords.keyword); -const reservedWordsStrictSet = new Set(reservedWords.strict); -const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); - -function isReservedWord(word, inModule) { - return inModule && word === "await" || word === "enum"; -} - -function isStrictReservedWord(word, inModule) { - return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); -} - -function isStrictBindOnlyReservedWord(word) { - return reservedWordsStrictBindSet.has(word); -} - -function isStrictBindReservedWord(word, inModule) { - return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); -} - -function isKeyword(word) { - return keywords.has(word); -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json deleted file mode 100644 index cf138d6f2c..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@babel/helper-validator-identifier", - "version": "7.14.8", - "description": "Validate identifier/keywords name", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-helper-validator-identifier" - }, - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "./lib/index.js", - "exports": "./lib/index.js", - "devDependencies": { - "@babel/helper-validator-identifier-baseline": "npm:@babel/helper-validator-identifier@7.10.4", - "@unicode/unicode-13.0.0": "^1.0.6", - "benchmark": "^2.1.4", - "charcodes": "^0.2.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "author": "The Babel Team (https://babel.dev/team)" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js deleted file mode 100644 index 45276d51b2..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -// Always use the latest available version of Unicode! -// https://tc39.github.io/ecma262/#sec-conformance -const version = "13.0.0"; - -const start = require("@unicode/unicode-" + - version + - "/Binary_Property/ID_Start/code-points.js").filter(function (ch) { - return ch > 0x7f; -}); -let last = -1; -const cont = [0x200c, 0x200d].concat( - require("@unicode/unicode-" + - version + - "/Binary_Property/ID_Continue/code-points.js").filter(function (ch) { - return ch > 0x7f && search(start, ch, last + 1) == -1; - }) -); - -function search(arr, ch, starting) { - for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) { - if (arr[i] === ch) return i; - } - return -1; -} - -function pad(str, width) { - while (str.length < width) str = "0" + str; - return str; -} - -function esc(code) { - const hex = code.toString(16); - if (hex.length <= 2) return "\\x" + pad(hex, 2); - else return "\\u" + pad(hex, 4); -} - -function generate(chars) { - const astral = []; - let re = ""; - for (let i = 0, at = 0x10000; i < chars.length; i++) { - const from = chars[i]; - let to = from; - while (i < chars.length - 1 && chars[i + 1] == to + 1) { - i++; - to++; - } - if (to <= 0xffff) { - if (from == to) re += esc(from); - else if (from + 1 == to) re += esc(from) + esc(to); - else re += esc(from) + "-" + esc(to); - } else { - astral.push(from - at, to - from); - at = to; - } - } - return { nonASCII: re, astral: astral }; -} - -const startData = generate(start); -const contData = generate(cont); - -console.log("/* prettier-ignore */"); -console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";'); -console.log("/* prettier-ignore */"); -console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";'); -console.log("/* prettier-ignore */"); -console.log( - "const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";" -); -console.log("/* prettier-ignore */"); -console.log( - "const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";" -); diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE b/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE deleted file mode 100644 index f31575ec77..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/README.md b/tools/node_modules/eslint/node_modules/@babel/highlight/README.md deleted file mode 100644 index f8887ad2ca..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/highlight - -> Syntax highlight JavaScript strings for output in terminals. - -See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/highlight -``` - -or using yarn: - -```sh -yarn add @babel/highlight --dev -``` diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js deleted file mode 100644 index 34e308f4ef..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shouldHighlight = shouldHighlight; -exports.getChalk = getChalk; -exports.default = highlight; - -var _jsTokens = require("js-tokens"); - -var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); - -var _chalk = require("chalk"); - -const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); - -function getDefs(chalk) { - return { - keyword: chalk.cyan, - capitalized: chalk.yellow, - jsxIdentifier: chalk.yellow, - punctuator: chalk.yellow, - number: chalk.magenta, - string: chalk.green, - regex: chalk.magenta, - comment: chalk.grey, - invalid: chalk.white.bgRed.bold - }; -} - -const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; -const BRACKET = /^[()[\]{}]$/; -let tokenize; -{ - const JSX_TAG = /^[a-z][\w-]*$/i; - - const getTokenType = function (token, offset, text) { - if (token.type === "name") { - if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) { - return "keyword"; - } - - if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == " colorize(str)).join("\n"); - } else { - highlighted += value; - } - } - - return highlighted; -} - -function shouldHighlight(options) { - return !!_chalk.supportsColor || options.forceColor; -} - -function getChalk(options) { - return options.forceColor ? new _chalk.constructor({ - enabled: true, - level: 1 - }) : _chalk; -} - -function highlight(code, options = {}) { - if (shouldHighlight(options)) { - const chalk = getChalk(options); - const defs = getDefs(chalk); - return highlightTokens(defs, code); - } else { - return code; - } -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/index.js b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/index.js deleted file mode 100644 index 90a871c4d7..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/index.js +++ /dev/null @@ -1,165 +0,0 @@ -'use strict'; -const colorConvert = require('color-convert'); - -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${code + offset}m`; -}; - -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};5;${code}m`; -}; - -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - - // Bright color - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Fix humans - styles.color.grey = styles.color.gray; - - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; - - for (const styleName of Object.keys(group)) { - const style = group[styleName]; - - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - } - - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; - - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; - - styles.color.ansi = { - ansi: wrapAnsi16(ansi2ansi, 0) - }; - styles.color.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 0) - }; - styles.color.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 0) - }; - - styles.bgColor.ansi = { - ansi: wrapAnsi16(ansi2ansi, 10) - }; - styles.bgColor.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 10) - }; - styles.bgColor.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 10) - }; - - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { - continue; - } - - const suite = colorConvert[key]; - - if (key === 'ansi16') { - key = 'ansi'; - } - - if ('ansi16' in suite) { - styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); - styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); - } - - if ('ansi256' in suite) { - styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); - styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); - } - - if ('rgb' in suite) { - styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); - styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); - } - } - - return styles; -} - -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/license b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/package.json b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/package.json deleted file mode 100644 index 65edb48c39..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "ansi-styles", - "version": "3.2.1", - "description": "ANSI escape codes for styling strings in the terminal", - "license": "MIT", - "repository": "chalk/ansi-styles", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "color-convert": "^1.9.0" - }, - "devDependencies": { - "ava": "*", - "babel-polyfill": "^6.23.0", - "svg-term-cli": "^2.1.1", - "xo": "*" - }, - "ava": { - "require": "babel-polyfill" - } -} diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md deleted file mode 100644 index 3158e2df59..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md +++ /dev/null @@ -1,147 +0,0 @@ -# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) - -> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal - -You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. - - - - -## Install - -``` -$ npm install ansi-styles -``` - - -## Usage - -```js -const style = require('ansi-styles'); - -console.log(`${style.green.open}Hello world!${style.green.close}`); - - -// Color conversion between 16/256/truecolor -// NOTE: If conversion goes to 16 colors or 256 colors, the original color -// may be degraded to fit that color palette. This means terminals -// that do not support 16 million colors will best-match the -// original color. -console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); -console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); -console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); -``` - -## API - -Each style has an `open` and `close` property. - - -## Styles - -### Modifiers - -- `reset` -- `bold` -- `dim` -- `italic` *(Not widely supported)* -- `underline` -- `inverse` -- `hidden` -- `strikethrough` *(Not widely supported)* - -### Colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `gray` ("bright black") -- `redBright` -- `greenBright` -- `yellowBright` -- `blueBright` -- `magentaBright` -- `cyanBright` -- `whiteBright` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` -- `bgBlackBright` -- `bgRedBright` -- `bgGreenBright` -- `bgYellowBright` -- `bgBlueBright` -- `bgMagentaBright` -- `bgCyanBright` -- `bgWhiteBright` - - -## Advanced usage - -By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. - -- `style.modifier` -- `style.color` -- `style.bgColor` - -###### Example - -```js -console.log(style.color.green.open); -``` - -Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. - -###### Example - -```js -console.log(style.codes.get(36)); -//=> 39 -``` - - -## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) - -`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. - -To use these, call the associated conversion function with the intended output, for example: - -```js -style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code -style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code - -style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code -style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code - -style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code -style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code -``` - - -## Related - -- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - -## License - -MIT diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js deleted file mode 100644 index 1cc5fa89a9..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); -const ansiStyles = require('ansi-styles'); -const stdoutColor = require('supports-color').stdout; - -const template = require('./templates.js'); - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); - -const styles = Object.create(null); - -function applyOptions(obj, options) { - options = options || {}; - - // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; -} - -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = Chalk; - - return chalk.template; - } - - applyOptions(this, options); -} - -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; -} - -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { - get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); - } - }; -} - -styles.visible = { - get() { - return build.call(this, this._styles || [], true, 'visible'); - } -}; - -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } - - styles[model] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { - enumerable: true, - get() { - return self.level; - }, - set(level) { - self.level = level; - } - }); - - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); - - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; - - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto - - return builder; -} - -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); - - if (argsLen === 0) { - return ''; - } - - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } - - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; - } - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } - - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; - - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); - } - - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; - - return str; -} - -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); - } - - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; - - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); - } - - return template(chalk, parts.join('')); -} - -Object.defineProperties(Chalk.prototype, styles); - -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js.flow b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js.flow deleted file mode 100644 index 622caaa2e8..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/index.js.flow +++ /dev/null @@ -1,93 +0,0 @@ -// @flow strict - -type TemplateStringsArray = $ReadOnlyArray; - -export type Level = $Values<{ - None: 0, - Basic: 1, - Ansi256: 2, - TrueColor: 3 -}>; - -export type ChalkOptions = {| - enabled?: boolean, - level?: Level -|}; - -export type ColorSupport = {| - level: Level, - hasBasic: boolean, - has256: boolean, - has16m: boolean -|}; - -export interface Chalk { - (...text: string[]): string, - (text: TemplateStringsArray, ...placeholders: string[]): string, - constructor(options?: ChalkOptions): Chalk, - enabled: boolean, - level: Level, - rgb(r: number, g: number, b: number): Chalk, - hsl(h: number, s: number, l: number): Chalk, - hsv(h: number, s: number, v: number): Chalk, - hwb(h: number, w: number, b: number): Chalk, - bgHex(color: string): Chalk, - bgKeyword(color: string): Chalk, - bgRgb(r: number, g: number, b: number): Chalk, - bgHsl(h: number, s: number, l: number): Chalk, - bgHsv(h: number, s: number, v: number): Chalk, - bgHwb(h: number, w: number, b: number): Chalk, - hex(color: string): Chalk, - keyword(color: string): Chalk, - - +reset: Chalk, - +bold: Chalk, - +dim: Chalk, - +italic: Chalk, - +underline: Chalk, - +inverse: Chalk, - +hidden: Chalk, - +strikethrough: Chalk, - - +visible: Chalk, - - +black: Chalk, - +red: Chalk, - +green: Chalk, - +yellow: Chalk, - +blue: Chalk, - +magenta: Chalk, - +cyan: Chalk, - +white: Chalk, - +gray: Chalk, - +grey: Chalk, - +blackBright: Chalk, - +redBright: Chalk, - +greenBright: Chalk, - +yellowBright: Chalk, - +blueBright: Chalk, - +magentaBright: Chalk, - +cyanBright: Chalk, - +whiteBright: Chalk, - - +bgBlack: Chalk, - +bgRed: Chalk, - +bgGreen: Chalk, - +bgYellow: Chalk, - +bgBlue: Chalk, - +bgMagenta: Chalk, - +bgCyan: Chalk, - +bgWhite: Chalk, - +bgBlackBright: Chalk, - +bgRedBright: Chalk, - +bgGreenBright: Chalk, - +bgYellowBright: Chalk, - +bgBlueBright: Chalk, - +bgMagentaBright: Chalk, - +bgCyanBright: Chalk, - +bgWhiteBrigh: Chalk, - - supportsColor: ColorSupport -}; - -declare module.exports: Chalk; diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/license b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/package.json deleted file mode 100644 index bc324685a7..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "chalk", - "version": "2.4.2", - "description": "Terminal string styling done right", - "license": "MIT", - "repository": "chalk/chalk", - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava", - "bench": "matcha benchmark.js", - "coveralls": "nyc report --reporter=text-lcov | coveralls" - }, - "files": [ - "index.js", - "templates.js", - "types/index.d.ts", - "index.js.flow" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "devDependencies": { - "ava": "*", - "coveralls": "^3.0.0", - "execa": "^0.9.0", - "flow-bin": "^0.68.0", - "import-fresh": "^2.0.0", - "matcha": "^0.7.0", - "nyc": "^11.0.2", - "resolve-from": "^4.0.0", - "typescript": "^2.5.3", - "xo": "*" - }, - "types": "types/index.d.ts", - "xo": { - "envs": [ - "node", - "mocha" - ], - "ignores": [ - "test/_flow.js" - ] - } -} diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/readme.md deleted file mode 100644 index d298e2c48d..0000000000 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/node_modules/chalk/readme.md +++ /dev/null @@ -1,314 +0,0 @@ -

-
-
- Chalk -
-
-
-

- -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs) - -### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0) - - - - -## Highlights - -- Expressive API -- Highly performant -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017 - - -## Install - -```console -$ npm install chalk -``` - - - - - - -## Usage - -```js -const chalk = require('chalk'); - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -const chalk = require('chalk'); -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// ES2015 tagged template literal -log(chalk` -CPU: {red ${cpu.totalPercent}%} -RAM: {green ${ram.used / ram.total * 100}%} -DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.keyword('orange')('Yay for orange colored text!')); -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -const chalk = require('chalk'); - -const error = chalk.bold.red; -const warning = chalk.keyword('orange'); - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - - -## API - -### chalk.`