@alexlit/lint-kit 176.0.1 → 177.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/config-stylelint/package.json +5 -5
- package/packages/config-stylelint/plugins/color-format.js +1 -5
- package/packages/config-stylelint/plugins/logical-css.js +1 -4
- package/packages/config-eslint/node_modules/@eslint/core/LICENSE +0 -201
- package/packages/config-eslint/node_modules/@eslint/core/README.md +0 -29
- package/packages/config-eslint/node_modules/@eslint/core/dist/cjs/types.d.cts +0 -1179
- package/packages/config-eslint/node_modules/@eslint/core/dist/esm/types.d.ts +0 -1179
- package/packages/config-eslint/node_modules/@eslint/core/package.json +0 -49
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/LICENSE +0 -201
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/README.md +0 -273
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +0 -884
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +0 -328
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/types.cts +0 -7
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +0 -328
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.js +0 -879
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +0 -6
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.ts +0 -7
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/package.json +0 -61
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/configs/flat-config-base.js +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/index.d.ts +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/index.js +0 -91
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/license +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/globals.json +0 -3345
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/index.d.ts +0 -3452
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/index.js +0 -2
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/license +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/package.json +0 -117
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/readme.md +0 -42
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/package.json +0 -128
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/readme.md +0 -261
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/call-or-new-expression.js +0 -120
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/function-types.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/index.js +0 -30
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-arrow-function-body.js +0 -3
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-directive.js +0 -4
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-array-expression.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-expression-statement.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-function.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-member-expression.js +0 -98
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-method-call.js +0 -62
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-negative-one.js +0 -8
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-reference-identifier.js +0 -159
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-static-require.js +0 -10
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-tagged-template-literal.js +0 -24
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-undefined.js +0 -3
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/literal.js +0 -24
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/better-regex.js +0 -146
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/catch-error-name.js +0 -138
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-assert.js +0 -98
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-date-clone.js +0 -54
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-destructuring.js +0 -168
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-empty-array-spread.js +0 -127
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-existence-index-check.js +0 -137
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-function-scoping.js +0 -265
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/custom-error-definition.js +0 -218
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/empty-brace-spaces.js +0 -62
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/error-message.js +0 -98
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/escape-case.js +0 -86
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js +0 -584
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/explicit-length-check.js +0 -236
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/filename-case.js +0 -276
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/add-parenthesizes-to-return-or-throw-expression.js +0 -29
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/append-argument.js +0 -30
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/extend-fix-range.js +0 -11
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/fix-space-around-keywords.js +0 -43
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/index.js +0 -23
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-argument.js +0 -40
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-expression-statement.js +0 -34
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js +0 -28
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-object-property.js +0 -21
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-parentheses.js +0 -19
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-spaces-after.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-specifier.js +0 -59
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/rename-variable.js +0 -8
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-argument.js +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-member-expression-property.js +0 -25
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-node-or-token-and-spaces-before.js +0 -31
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-reference-identifier.js +0 -32
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-raw.js +0 -12
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-template-element.js +0 -10
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/switch-call-expression-to-new-expression.js +0 -29
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/switch-new-expression-to-call-expression.js +0 -42
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/import-style.js +0 -375
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/index.js +0 -143
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/new-for-builtins.js +0 -112
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-abusive-eslint-disable.js +0 -63
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-accessor-recursion.js +0 -160
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-anonymous-default-export.js +0 -210
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-callback-reference.js +0 -285
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-for-each.js +0 -496
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-method-this-argument.js +0 -223
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-reduce.js +0 -128
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-reverse.js +0 -6
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-sort.js +0 -6
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-await-expression-member.js +0 -85
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-await-in-promise-methods.js +0 -69
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-console-spaces.js +0 -89
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-document-cookie.js +0 -27
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-empty-file.js +0 -58
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-for-loop.js +0 -419
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-hex-escape.js +0 -54
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-immediate-mutation.js +0 -778
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-instanceof-builtins.js +0 -216
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-invalid-fetch-options.js +0 -112
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-invalid-remove-event-listener.js +0 -61
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-keyword-prefix.js +0 -202
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-lonely-if.js +0 -155
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-magic-array-flat-depth.js +0 -55
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-named-default.js +0 -101
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-negated-condition.js +0 -145
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-negation-in-equality-check.js +0 -99
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-nested-ternary.js +0 -60
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-new-array.js +0 -106
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-new-buffer.js +0 -100
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-null.js +0 -153
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-object-as-default-parameter.js +0 -52
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-process-exit.js +0 -106
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-single-promise-in-promise-methods.js +0 -179
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-static-only-class.js +0 -226
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-thenable.js +0 -194
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-this-assignment.js +0 -40
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-typeof-undefined.js +0 -146
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-array-flat-depth.js +0 -49
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-array-splice-count.js +0 -23
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-await.js +0 -110
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-polyfills.js +0 -174
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-slice-end.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unreadable-array-destructuring.js +0 -85
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js +0 -43
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unused-properties.js +0 -240
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-collection-argument.js +0 -101
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-error-capture-stack-trace.js +0 -146
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-fallback-in-spread.js +0 -66
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-length-check.js +0 -150
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-promise-resolve-reject.js +0 -210
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-spread.js +0 -389
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-switch-case.js +0 -59
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-undefined.js +0 -275
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-zero-fractions.js +0 -81
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/number-literal-case.js +0 -82
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/numeric-separators-style.js +0 -189
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-add-event-listener.js +0 -191
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-find.js +0 -458
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat-map.js +0 -86
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat.js +0 -279
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-index-of.js +0 -34
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-some.js +0 -219
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-at.js +0 -380
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-bigint-literals.js +0 -129
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-blob-reading-methods.js +0 -47
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-class-fields.js +0 -158
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-classlist-toggle.js +0 -255
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js +0 -56
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-date-now.js +0 -133
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js +0 -218
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js +0 -50
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-dataset.js +0 -135
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-remove.js +0 -124
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-text-content.js +0 -77
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-event-target.js +0 -119
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-export-from.js +0 -367
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-global-this.js +0 -222
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-import-meta-properties.js +0 -320
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-includes.js +0 -111
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-json-parse-buffer.js +0 -161
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-keyboard-event-key.js +0 -188
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-logical-operator-over-ternary.js +0 -162
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-math-min-max.js +0 -205
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-math-trunc.js +0 -111
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-modern-dom-apis.js +0 -145
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-modern-math-apis.js +0 -210
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-module.js +0 -377
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-native-coercion-functions.js +0 -187
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-negative-index.js +0 -211
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-node-protocol.js +0 -86
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-number-properties.js +0 -142
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-object-from-entries.js +0 -256
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-optional-catch-binding.js +0 -77
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-prototype-methods.js +0 -162
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-query-selector.js +0 -170
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-reflect-apply.js +0 -99
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-regexp-test.js +0 -155
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-response-static-json.js +0 -85
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-set-has.js +0 -181
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-set-size.js +0 -106
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-single-call.js +0 -188
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-spread.js +0 -521
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-raw.js +0 -149
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-replace-all.js +0 -180
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-slice.js +0 -180
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-starts-ends-with.js +0 -201
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-trim-start-end.js +0 -46
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-structured-clone.js +0 -149
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-switch.js +0 -357
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-ternary.js +0 -288
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-top-level-await.js +0 -154
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-type-error.js +0 -169
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js +0 -655
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/relative-url-style.js +0 -171
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-array-join-separator.js +0 -65
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-module-attributes.js +0 -120
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-module-specifiers.js +0 -158
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-number-to-fixed-digits-argument.js +0 -55
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-post-message-target-origin.js +0 -74
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/get-documentation-url.js +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/index.js +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-create.js +0 -51
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-listener.js +0 -40
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-problem.js +0 -38
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rule-fixer.js +0 -49
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rule.js +0 -38
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rules.js +0 -13
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/unicorn-context.js +0 -36
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/unicorn-listeners.js +0 -65
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/utilities.js +0 -27
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/abbreviations.js +0 -270
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/builtin-errors.js +0 -14
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/dom-events.js +0 -275
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/event-keys.js +0 -54
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/negative-index.js +0 -52
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/no-array-mutate-rule.js +0 -139
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/no-unnecessary-length-or-infinity-rule.js +0 -80
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/package-json.js +0 -42
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/simple-array-search-rule.js +0 -126
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/typed-array.js +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/string-content.js +0 -192
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/switch-case-braces.js +0 -114
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/template-indent.js +0 -219
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/text-encoding-identifier-case.js +0 -130
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/throw-new-error.js +0 -60
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/array-or-object-prototype-property.js +0 -57
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/assert-token.js +0 -29
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/boolean.js +0 -88
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/builtins.js +0 -30
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/cartesian-product-samples.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js +0 -29
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/escape-string.js +0 -24
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/escape-template-element-raw.js +0 -6
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-ancestor.js +0 -15
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-available-variable-name.js +0 -147
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-builtin-rule.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-arguments-text.js +0 -36
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-call-or-new-expression-tokens.js +0 -67
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-class-head-location.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-documentation-url.js +0 -9
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js +0 -18
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-references.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-scopes.js +0 -12
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-sibling-node.js +0 -38
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-switch-case-head-location.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-token-store.js +0 -24
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-variable-identifiers.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/global-reference-tracker.js +0 -68
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/has-optional-chain-element.js +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/has-same-range.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/index.js +0 -59
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-function-self-used-inside.js +0 -39
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-left-hand-side.js +0 -20
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-logical-expression.js +0 -14
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-method-named.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-new-expression-with-parentheses.js +0 -28
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-matches.js +0 -58
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-dom-node.js +0 -20
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-function.js +0 -40
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-number.js +0 -224
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js +0 -10
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-on-same-line.js +0 -7
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-same-identifier.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js +0 -170
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-export-local.js +0 -8
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-import-local.js +0 -8
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-assignment-pattern-left.js +0 -8
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-value.js +0 -6
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-unresolved-variable.js +0 -14
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-value-not-usable.js +0 -5
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js +0 -118
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/numeric.js +0 -49
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/parentheses.js +0 -71
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/resolve-variable-name.js +0 -18
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/rule.js +0 -27
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-await-expression-argument.js +0 -17
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-call-expression-callee.js +0 -18
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-conditional-expression-child.js +0 -13
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-expression-statement-expression.js +0 -22
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-logical-expression-child.js +0 -43
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-member-expression-object.js +0 -47
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-new-expression-callee.js +0 -28
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-unary-expression.js +0 -24
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/singular.js +0 -16
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/string-cases.js +0 -2
- package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/to-location.js +0 -25
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import {getStaticValue} from '@eslint-community/eslint-utils';
|
|
2
|
-
import {isNumericLiteral} from '../ast/index.js';
|
|
3
|
-
|
|
4
|
-
const isStaticProperties = (node, object, properties) =>
|
|
5
|
-
node.type === 'MemberExpression'
|
|
6
|
-
&& !node.computed
|
|
7
|
-
&& !node.optional
|
|
8
|
-
&& node.object.type === 'Identifier'
|
|
9
|
-
&& node.object.name === object
|
|
10
|
-
&& node.property.type === 'Identifier'
|
|
11
|
-
&& properties.has(node.property.name);
|
|
12
|
-
|
|
13
|
-
const isFunctionCall = (node, functionName) => node.type === 'CallExpression'
|
|
14
|
-
&& !node.optional
|
|
15
|
-
&& node.callee.type === 'Identifier'
|
|
16
|
-
&& node.callee.name === functionName;
|
|
17
|
-
|
|
18
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math#static_properties
|
|
19
|
-
const mathProperties = new Set([
|
|
20
|
-
'E',
|
|
21
|
-
'LN2',
|
|
22
|
-
'LN10',
|
|
23
|
-
'LOG2E',
|
|
24
|
-
'LOG10E',
|
|
25
|
-
'PI',
|
|
26
|
-
'SQRT1_2',
|
|
27
|
-
'SQRT2',
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
// `Math.{E,LN2,LN10,LOG2E,LOG10E,PI,SQRT1_2,SQRT2}`
|
|
31
|
-
const isMathProperty = node => isStaticProperties(node, 'Math', mathProperties);
|
|
32
|
-
|
|
33
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math#static_methods
|
|
34
|
-
const mathMethods = new Set([
|
|
35
|
-
'abs',
|
|
36
|
-
'acos',
|
|
37
|
-
'acosh',
|
|
38
|
-
'asin',
|
|
39
|
-
'asinh',
|
|
40
|
-
'atan',
|
|
41
|
-
'atanh',
|
|
42
|
-
'atan2',
|
|
43
|
-
'cbrt',
|
|
44
|
-
'ceil',
|
|
45
|
-
'clz32',
|
|
46
|
-
'cos',
|
|
47
|
-
'cosh',
|
|
48
|
-
'exp',
|
|
49
|
-
'expm1',
|
|
50
|
-
'floor',
|
|
51
|
-
'fround',
|
|
52
|
-
'hypot',
|
|
53
|
-
'imul',
|
|
54
|
-
'log',
|
|
55
|
-
'log1p',
|
|
56
|
-
'log10',
|
|
57
|
-
'log2',
|
|
58
|
-
'max',
|
|
59
|
-
'min',
|
|
60
|
-
'pow',
|
|
61
|
-
'random',
|
|
62
|
-
'round',
|
|
63
|
-
'sign',
|
|
64
|
-
'sin',
|
|
65
|
-
'sinh',
|
|
66
|
-
'sqrt',
|
|
67
|
-
'tan',
|
|
68
|
-
'tanh',
|
|
69
|
-
'trunc',
|
|
70
|
-
]);
|
|
71
|
-
// `Math.{abs, …, trunc}(…)`
|
|
72
|
-
const isMathMethodCall = node =>
|
|
73
|
-
node.type === 'CallExpression'
|
|
74
|
-
&& !node.optional
|
|
75
|
-
&& isStaticProperties(node.callee, 'Math', mathMethods);
|
|
76
|
-
|
|
77
|
-
// `Number(…)`
|
|
78
|
-
const isNumberCall = node => isFunctionCall(node, 'Number');
|
|
79
|
-
|
|
80
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#static_properties
|
|
81
|
-
const numberProperties = new Set([
|
|
82
|
-
'EPSILON',
|
|
83
|
-
'MAX_SAFE_INTEGER',
|
|
84
|
-
'MAX_VALUE',
|
|
85
|
-
'MIN_SAFE_INTEGER',
|
|
86
|
-
'MIN_VALUE',
|
|
87
|
-
'NaN',
|
|
88
|
-
'NEGATIVE_INFINITY',
|
|
89
|
-
'POSITIVE_INFINITY',
|
|
90
|
-
]);
|
|
91
|
-
const isNumberProperty = node => isStaticProperties(node, 'Number', numberProperties);
|
|
92
|
-
|
|
93
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#static_methods
|
|
94
|
-
const numberMethods = new Set([
|
|
95
|
-
'parseFloat',
|
|
96
|
-
'parseInt',
|
|
97
|
-
]);
|
|
98
|
-
const isNumberMethodCall = node =>
|
|
99
|
-
node.type === 'CallExpression'
|
|
100
|
-
&& !node.optional
|
|
101
|
-
&& isStaticProperties(node.callee, 'Number', numberMethods);
|
|
102
|
-
const isGlobalParseToNumberFunctionCall = node => isFunctionCall(node, 'parseInt') || isFunctionCall(node, 'parseFloat');
|
|
103
|
-
|
|
104
|
-
const isStaticNumber = (node, scope) =>
|
|
105
|
-
typeof getStaticValue(node, scope)?.value === 'number';
|
|
106
|
-
|
|
107
|
-
const isLengthProperty = node =>
|
|
108
|
-
node.type === 'MemberExpression'
|
|
109
|
-
&& !node.computed
|
|
110
|
-
&& !node.optional
|
|
111
|
-
&& node.property.type === 'Identifier'
|
|
112
|
-
&& node.property.name === 'length';
|
|
113
|
-
|
|
114
|
-
// `+` and `>>>` operators are handled separately
|
|
115
|
-
const mathOperators = new Set(['-', '*', '/', '%', '**', '<<', '>>', '|', '^', '&']);
|
|
116
|
-
|
|
117
|
-
// eslint-disable-next-line complexity
|
|
118
|
-
export default function isNumber(node, scope) {
|
|
119
|
-
if (
|
|
120
|
-
isNumericLiteral(node)
|
|
121
|
-
|| isMathProperty(node)
|
|
122
|
-
|| isMathMethodCall(node)
|
|
123
|
-
|| isNumberCall(node)
|
|
124
|
-
|| isNumberProperty(node)
|
|
125
|
-
|| isNumberMethodCall(node)
|
|
126
|
-
|| isGlobalParseToNumberFunctionCall(node)
|
|
127
|
-
|| isLengthProperty(node)
|
|
128
|
-
) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
switch (node.type) {
|
|
133
|
-
case 'AssignmentExpression': {
|
|
134
|
-
const {operator} = node;
|
|
135
|
-
if (operator === '=' && isNumber(node.right, scope)) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Fall through
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
case 'BinaryExpression': {
|
|
143
|
-
let {operator} = node;
|
|
144
|
-
|
|
145
|
-
if (node.type === 'AssignmentExpression') {
|
|
146
|
-
operator = operator.slice(0, -1);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (operator === '+' && isNumber(node.left, scope) && isNumber(node.right, scope)) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// `>>>` (zero-fill right shift) can't use on `BigInt`
|
|
154
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#operators
|
|
155
|
-
if (operator === '>>>') {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// `a * b` can be `BigInt`, we need make sure at least one side is number
|
|
160
|
-
if (mathOperators.has(operator) && (isNumber(node.left, scope) || isNumber(node.right, scope))) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
case 'UnaryExpression': {
|
|
168
|
-
const {operator} = node;
|
|
169
|
-
|
|
170
|
-
// `+` can't use on `BigInt`
|
|
171
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#operators
|
|
172
|
-
if (operator === '+') {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if ((operator === '-' || operator === '~') && isNumber(node.argument, scope)) {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
case 'UpdateExpression': {
|
|
184
|
-
if (isNumber(node.argument, scope)) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
case 'ConditionalExpression': {
|
|
192
|
-
const isConsequentNumber = isNumber(node.consequent, scope);
|
|
193
|
-
const isAlternateNumber = isNumber(node.alternate, scope);
|
|
194
|
-
|
|
195
|
-
if (isConsequentNumber && isAlternateNumber) {
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const testStaticValueResult = getStaticValue(node.test, scope);
|
|
200
|
-
if (
|
|
201
|
-
testStaticValueResult !== null
|
|
202
|
-
&& (
|
|
203
|
-
(testStaticValueResult.value && isConsequentNumber)
|
|
204
|
-
|| (!testStaticValueResult.value && isAlternateNumber)
|
|
205
|
-
)
|
|
206
|
-
) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
case 'SequenceExpression': {
|
|
214
|
-
if (isNumber(node.expressions.at(-1), scope)) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
// No default
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return isStaticNumber(node, scope);
|
|
224
|
-
}
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function isObjectMethod(node, object, method) {
|
|
2
|
-
const {callee} = node;
|
|
3
|
-
return (
|
|
4
|
-
callee.type === 'MemberExpression'
|
|
5
|
-
&& callee.object.type === 'Identifier'
|
|
6
|
-
&& callee.object.name === object
|
|
7
|
-
&& callee.property.type === 'Identifier'
|
|
8
|
-
&& callee.property.name === method
|
|
9
|
-
);
|
|
10
|
-
}
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import {getStaticValue} from '@eslint-community/eslint-utils';
|
|
2
|
-
|
|
3
|
-
// Copied from https://github.com/eslint/eslint/blob/94ba68d76a6940f68ff82eea7332c6505f93df76/lib/rules/utils/ast-utils.js#L392
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
Gets the property name of a given node.
|
|
7
|
-
The node can be a MemberExpression, a Property, or a MethodDefinition.
|
|
8
|
-
|
|
9
|
-
If the name is dynamic, this returns `null`.
|
|
10
|
-
|
|
11
|
-
For examples:
|
|
12
|
-
|
|
13
|
-
a.b // => "b"
|
|
14
|
-
a["b"] // => "b"
|
|
15
|
-
a['b'] // => "b"
|
|
16
|
-
a[`b`] // => "b"
|
|
17
|
-
a[100] // => "100"
|
|
18
|
-
a[b] // => null
|
|
19
|
-
a["a" + "b"] // => null
|
|
20
|
-
a[tag`b`] // => null
|
|
21
|
-
a[`${b}`] // => null
|
|
22
|
-
|
|
23
|
-
let a = {b: 1} // => "b"
|
|
24
|
-
let a = {["b"]: 1} // => "b"
|
|
25
|
-
let a = {['b']: 1} // => "b"
|
|
26
|
-
let a = {[`b`]: 1} // => "b"
|
|
27
|
-
let a = {[100]: 1} // => "100"
|
|
28
|
-
let a = {[b]: 1} // => null
|
|
29
|
-
let a = {["a" + "b"]: 1} // => null
|
|
30
|
-
let a = {[tag`b`]: 1} // => null
|
|
31
|
-
let a = {[`${b}`]: 1} // => null
|
|
32
|
-
@param {ASTNode} node The node to get.
|
|
33
|
-
@returns {string|undefined} The property name if static. Otherwise, undefined.
|
|
34
|
-
*/
|
|
35
|
-
function getStaticPropertyName(node) {
|
|
36
|
-
let property;
|
|
37
|
-
|
|
38
|
-
switch (node?.type) {
|
|
39
|
-
case 'MemberExpression': {
|
|
40
|
-
property = node.property;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* c8 ignore next 2 */
|
|
45
|
-
case 'ChainExpression': {
|
|
46
|
-
return getStaticPropertyName(node.expression);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Only reachable when use this to get class/object member key
|
|
50
|
-
/* c8 ignore next */
|
|
51
|
-
case 'Property':
|
|
52
|
-
case 'MethodDefinition': {
|
|
53
|
-
/* c8 ignore next 2 */
|
|
54
|
-
property = node.key;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// No default
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (property) {
|
|
62
|
-
if (property.type === 'Identifier' && !node.computed) {
|
|
63
|
-
return property.name;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const staticResult = getStaticValue(property);
|
|
67
|
-
if (!staticResult) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return String(staticResult.value);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
Check if two literal nodes are the same value.
|
|
77
|
-
@param {ASTNode} left The Literal node to compare.
|
|
78
|
-
@param {ASTNode} right The other Literal node to compare.
|
|
79
|
-
@returns {boolean} `true` if the two literal nodes are the same value.
|
|
80
|
-
*/
|
|
81
|
-
function equalLiteralValue(left, right) {
|
|
82
|
-
// RegExp literal.
|
|
83
|
-
if (left.regex || right.regex) {
|
|
84
|
-
return Boolean(
|
|
85
|
-
left.regex
|
|
86
|
-
&& right.regex
|
|
87
|
-
&& left.regex.pattern === right.regex.pattern
|
|
88
|
-
&& left.regex.flags === right.regex.flags,
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// BigInt literal.
|
|
93
|
-
if (left.bigint || right.bigint) {
|
|
94
|
-
return left.bigint === right.bigint;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return left.value === right.value;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
Check if two expressions reference the same value. For example:
|
|
102
|
-
a = a
|
|
103
|
-
a.b = a.b
|
|
104
|
-
a[0] = a[0]
|
|
105
|
-
a['b'] = a['b']
|
|
106
|
-
@param {ASTNode} left The left side of the comparison.
|
|
107
|
-
@param {ASTNode} right The right side of the comparison.
|
|
108
|
-
@returns {boolean} `true` if both sides match and reference the same value.
|
|
109
|
-
*/
|
|
110
|
-
export default function isSameReference(left, right) {
|
|
111
|
-
if (left.type !== right.type) {
|
|
112
|
-
// Handle `a.b` and `a?.b` are samely.
|
|
113
|
-
if (left.type === 'ChainExpression') {
|
|
114
|
-
return isSameReference(left.expression, right);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (right.type === 'ChainExpression') {
|
|
118
|
-
return isSameReference(left, right.expression);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
switch (left.type) {
|
|
125
|
-
case 'Super':
|
|
126
|
-
case 'ThisExpression': {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
case 'Identifier':
|
|
131
|
-
case 'PrivateIdentifier': {
|
|
132
|
-
return left.name === right.name;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
case 'Literal': {
|
|
136
|
-
return equalLiteralValue(left, right);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
case 'ChainExpression': {
|
|
140
|
-
return isSameReference(left.expression, right.expression);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
case 'MemberExpression': {
|
|
144
|
-
const nameA = getStaticPropertyName(left);
|
|
145
|
-
|
|
146
|
-
// `x.y = x["y"]`
|
|
147
|
-
if (nameA !== undefined) {
|
|
148
|
-
return (
|
|
149
|
-
isSameReference(left.object, right.object)
|
|
150
|
-
&& nameA === getStaticPropertyName(right)
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/*
|
|
155
|
-
`x[0] = x[0]`
|
|
156
|
-
`x[y] = x[y]`
|
|
157
|
-
`x.y = x.y`
|
|
158
|
-
*/
|
|
159
|
-
return (
|
|
160
|
-
left.computed === right.computed
|
|
161
|
-
&& isSameReference(left.object, right.object)
|
|
162
|
-
&& isSameReference(left.property, right.property)
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
default: {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import hasSameRange from './has-same-range.js';
|
|
2
|
-
|
|
3
|
-
const isShorthandExportLocal = (node, context) => {
|
|
4
|
-
const {type, local, exported} = node.parent;
|
|
5
|
-
return type === 'ExportSpecifier' && hasSameRange(local, exported, context) && local === node;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default isShorthandExportLocal;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import hasSameRange from './has-same-range.js';
|
|
2
|
-
|
|
3
|
-
const isShorthandImportLocal = (node, context) => {
|
|
4
|
-
const {type, local, imported} = node.parent;
|
|
5
|
-
return type === 'ImportSpecifier' && hasSameRange(local, imported, context) && local === node;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default isShorthandImportLocal;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import isShorthandPropertyValue from './is-shorthand-property-value.js';
|
|
2
|
-
|
|
3
|
-
const isShorthandPropertyAssignmentPatternLeft = identifier =>
|
|
4
|
-
identifier.parent.type === 'AssignmentPattern'
|
|
5
|
-
&& identifier.parent.left === identifier
|
|
6
|
-
&& isShorthandPropertyValue(identifier.parent);
|
|
7
|
-
|
|
8
|
-
export default isShorthandPropertyAssignmentPatternLeft;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {findVariable} from '@eslint-community/eslint-utils';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
Checks if the given identifier node is shadowed in the given scope.
|
|
5
|
-
|
|
6
|
-
@param {string} node - The identifier node to check
|
|
7
|
-
@param {import('eslint').Rule.RuleContext} context - The ESLint rule context.
|
|
8
|
-
@returns {boolean} Whether or not the name is unresolved.
|
|
9
|
-
*/
|
|
10
|
-
export default function isUnresolvedVariable(node, context) {
|
|
11
|
-
const scope = context.sourceCode.getScope(node);
|
|
12
|
-
const variable = findVariable(scope, node);
|
|
13
|
-
return !variable;
|
|
14
|
-
}
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
@import {TSESTree as ESTree} from '@typescript-eslint/types';
|
|
5
|
-
@import * as ESLint from 'eslint';
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// https://github.com/eslint/espree/blob/6b7d0b8100537dcd5c84a7fb17bbe28edcabe05d/lib/token-translator.js#L20
|
|
9
|
-
const tokenTypesNeedsSemicolon = new Set([
|
|
10
|
-
'String',
|
|
11
|
-
'Null',
|
|
12
|
-
'Boolean',
|
|
13
|
-
'Numeric',
|
|
14
|
-
'RegularExpression',
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
const charactersMightNeedsSemicolon = new Set([
|
|
18
|
-
'[',
|
|
19
|
-
'(',
|
|
20
|
-
'/',
|
|
21
|
-
'`',
|
|
22
|
-
'+',
|
|
23
|
-
'-',
|
|
24
|
-
'*',
|
|
25
|
-
',',
|
|
26
|
-
'.',
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
Determines if a semicolon needs to be inserted before `code`, in order to avoid a SyntaxError.
|
|
31
|
-
|
|
32
|
-
@param {ESTree.Token} tokenBefore Token before `code`.
|
|
33
|
-
@param {ESLint.Rule.RuleContext} context - The ESLint rule context object.
|
|
34
|
-
@param {String} [code] Code text to determine.
|
|
35
|
-
@returns {boolean} `true` if a semicolon needs to be inserted before `code`.
|
|
36
|
-
*/
|
|
37
|
-
export default function needsSemicolon(tokenBefore, context, code) {
|
|
38
|
-
if (
|
|
39
|
-
code === ''
|
|
40
|
-
|| (code && !charactersMightNeedsSemicolon.has(code.charAt(0)))
|
|
41
|
-
) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!tokenBefore) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const {sourceCode} = context;
|
|
50
|
-
const {type, value} = tokenBefore;
|
|
51
|
-
const range = sourceCode.getRange(tokenBefore);
|
|
52
|
-
const lastBlockNode = sourceCode.getNodeByRangeIndex(range[0]);
|
|
53
|
-
if (type === 'Punctuator') {
|
|
54
|
-
if (value === ';') {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (value === ']') {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (value === ')') {
|
|
63
|
-
switch (lastBlockNode.type) {
|
|
64
|
-
case 'IfStatement': {
|
|
65
|
-
if (sourceCode.getTokenBefore(lastBlockNode.consequent) === tokenBefore) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
case 'ForStatement':
|
|
73
|
-
case 'ForInStatement':
|
|
74
|
-
case 'ForOfStatement':
|
|
75
|
-
case 'WhileStatement':
|
|
76
|
-
case 'DoWhileStatement':
|
|
77
|
-
case 'WithStatement': {
|
|
78
|
-
if (lastBlockNode.body && sourceCode.getTokenBefore(lastBlockNode.body) === tokenBefore) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
// No default
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (tokenTypesNeedsSemicolon.has(type)) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (type === 'Template') {
|
|
96
|
-
return value.endsWith('`');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (lastBlockNode.type === 'ObjectExpression') {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (type === 'Identifier') {
|
|
104
|
-
// `for...of`
|
|
105
|
-
if (value === 'of' && lastBlockNode.type === 'ForOfStatement') {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// `await`
|
|
110
|
-
if (value === 'await' && lastBlockNode.type === 'AwaitExpression') {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {isNumericLiteral, isBigIntLiteral} from '../ast/index.js';
|
|
2
|
-
|
|
3
|
-
// Determine whether this node is a decimal integer literal.
|
|
4
|
-
// Copied from https://github.com/eslint/eslint/blob/cc4871369645c3409dc56ded7a555af8a9f63d51/lib/rules/utils/ast-utils.js#L1237
|
|
5
|
-
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
|
|
6
|
-
|
|
7
|
-
export const isDecimalInteger = text => DECIMAL_INTEGER_PATTERN.test(text);
|
|
8
|
-
|
|
9
|
-
export const isDecimalIntegerNode = node => isNumericLiteral(node) && isDecimalInteger(node.raw);
|
|
10
|
-
|
|
11
|
-
export const isNumeric = node => isNumericLiteral(node) || isBigIntLiteral(node);
|
|
12
|
-
|
|
13
|
-
export const isLegacyOctal = node => isNumericLiteral(node) && /^0\d+$/.test(node.raw);
|
|
14
|
-
|
|
15
|
-
export function getPrefix(text) {
|
|
16
|
-
let prefix = '';
|
|
17
|
-
let data = text;
|
|
18
|
-
|
|
19
|
-
if (/^0[box]/i.test(text)) {
|
|
20
|
-
prefix = text.slice(0, 2);
|
|
21
|
-
data = text.slice(2);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {prefix, data};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function parseNumber(text) {
|
|
28
|
-
const {
|
|
29
|
-
number,
|
|
30
|
-
mark = '',
|
|
31
|
-
sign = '',
|
|
32
|
-
power = '',
|
|
33
|
-
} = text.match(/^(?<number>[\d._]*?)(?:(?<mark>[Ee])(?<sign>[+-])?(?<power>[\d_]+))?$/).groups;
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
number,
|
|
37
|
-
mark,
|
|
38
|
-
sign,
|
|
39
|
-
power,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function parseFloatNumber(text) {
|
|
44
|
-
const parts = text.split('.');
|
|
45
|
-
const [integer, fractional = ''] = parts;
|
|
46
|
-
const dot = parts.length === 2 ? '.' : '';
|
|
47
|
-
|
|
48
|
-
return {integer, dot, fractional};
|
|
49
|
-
}
|