@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
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-classlist-toggle.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isMethodCall,
|
|
3
|
-
isMemberExpression,
|
|
4
|
-
isStringLiteral,
|
|
5
|
-
isCallExpression,
|
|
6
|
-
isExpressionStatement,
|
|
7
|
-
} from './ast/index.js';
|
|
8
|
-
import {
|
|
9
|
-
replaceMemberExpressionProperty,
|
|
10
|
-
fixSpaceAroundKeyword,
|
|
11
|
-
} from './fix/index.js';
|
|
12
|
-
import {
|
|
13
|
-
isSameReference,
|
|
14
|
-
isParenthesized,
|
|
15
|
-
getParenthesizedText,
|
|
16
|
-
shouldAddParenthesesToUnaryExpressionArgument,
|
|
17
|
-
needsSemicolon,
|
|
18
|
-
} from './utils/index.js';
|
|
19
|
-
|
|
20
|
-
const MESSAGE_ID_ERROR = 'prefer-classlist-toggle/error';
|
|
21
|
-
const MESSAGE_ID_SUGGESTION = 'prefer-classlist-toggle/suggestion';
|
|
22
|
-
const messages = {
|
|
23
|
-
[MESSAGE_ID_ERROR]: 'Prefer using `Element#classList.toggle()` to toggle class names.',
|
|
24
|
-
[MESSAGE_ID_SUGGESTION]: 'Replace with `Element#classList.toggle()`.',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const isClassList = node => isMemberExpression(node, {
|
|
28
|
-
property: 'classList',
|
|
29
|
-
computed: false,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const getProblem = (valueNode, fix, reportNode) => {
|
|
33
|
-
const problem = {
|
|
34
|
-
node: reportNode ?? valueNode,
|
|
35
|
-
messageId: MESSAGE_ID_ERROR,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const shouldUseSuggestion = valueNode.type !== 'IfStatement'
|
|
39
|
-
&& !(isExpressionStatement(valueNode) || isExpressionStatement(valueNode.parent));
|
|
40
|
-
|
|
41
|
-
if (shouldUseSuggestion) {
|
|
42
|
-
problem.suggest = [
|
|
43
|
-
{
|
|
44
|
-
messageId: MESSAGE_ID_SUGGESTION,
|
|
45
|
-
fix,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
} else {
|
|
49
|
-
problem.fix = fix;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return problem;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const getConditionText = (node, context, isNegative) => {
|
|
56
|
-
const {sourceCode} = context;
|
|
57
|
-
let text = getParenthesizedText(node, context);
|
|
58
|
-
|
|
59
|
-
if (isNegative) {
|
|
60
|
-
if (
|
|
61
|
-
!isParenthesized(node, sourceCode)
|
|
62
|
-
&& shouldAddParenthesesToUnaryExpressionArgument(node, '!')
|
|
63
|
-
) {
|
|
64
|
-
text = `(${text})`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
text = `!${text}`;
|
|
68
|
-
return text;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
!isParenthesized(node, sourceCode)
|
|
73
|
-
&& node.type === 'SequenceExpression'
|
|
74
|
-
) {
|
|
75
|
-
text = `(${text})`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return text;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const isClassListMethodCall = (node, methods) =>
|
|
82
|
-
isMethodCall(node, {
|
|
83
|
-
methods,
|
|
84
|
-
argumentsLength: 1,
|
|
85
|
-
optionalCall: false,
|
|
86
|
-
optionalMember: false,
|
|
87
|
-
})
|
|
88
|
-
&& isClassList(node.callee.object);
|
|
89
|
-
|
|
90
|
-
const isSameElementAndClassName = (callExpressionA, callExpressionB) =>
|
|
91
|
-
isSameReference(callExpressionA.callee.object, callExpressionB.callee.object)
|
|
92
|
-
&& isSameReference(callExpressionA.arguments[0], callExpressionB.arguments[0]);
|
|
93
|
-
|
|
94
|
-
const getClassListContainsCall = (conditionNode, isNegative, addOrRemoveCall) => {
|
|
95
|
-
if (!isNegative) {
|
|
96
|
-
if (conditionNode.type === 'UnaryExpression' && conditionNode.operator === '!' && conditionNode.prefix) {
|
|
97
|
-
return getClassListContainsCall(conditionNode.argument, !isNegative, addOrRemoveCall);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (conditionNode.type === 'ChainExpression') {
|
|
104
|
-
conditionNode = conditionNode.expression;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
isClassListMethodCall(conditionNode, ['contains'])
|
|
109
|
-
&& isSameElementAndClassName(conditionNode, addOrRemoveCall)
|
|
110
|
-
) {
|
|
111
|
-
return conditionNode;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/** @param {import('eslint').Rule.RuleContext} context */
|
|
116
|
-
const create = context => {
|
|
117
|
-
const {sourceCode} = context;
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
```js
|
|
121
|
-
if (condition) {
|
|
122
|
-
element.classList.add('className');
|
|
123
|
-
} else {
|
|
124
|
-
element.classList.remove('className');
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
```js
|
|
129
|
-
condition
|
|
130
|
-
? element.classList.add('className');
|
|
131
|
-
: element.classList.remove('className');
|
|
132
|
-
```
|
|
133
|
-
*/
|
|
134
|
-
context.on(['IfStatement', 'ConditionalExpression'], node => {
|
|
135
|
-
const clauses = [node.consequent, node.alternate]
|
|
136
|
-
.map(node => {
|
|
137
|
-
if (!node) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (node.type === 'BlockStatement' && node.body.length === 1) {
|
|
142
|
-
node = node.body[0];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (node.type === 'ExpressionStatement') {
|
|
146
|
-
node = node.expression;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (node.type === 'ChainExpression') {
|
|
150
|
-
node = node.expression;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return node;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// `element.classList.add('className');`
|
|
157
|
-
// `element.classList.remove('className');`
|
|
158
|
-
if (!clauses.every(node => isClassListMethodCall(node, ['add', 'remove']))) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const [consequent, alternate] = clauses;
|
|
163
|
-
if (
|
|
164
|
-
(consequent.callee.property.name === alternate.callee.property.name)
|
|
165
|
-
|| !isSameElementAndClassName(consequent, alternate)
|
|
166
|
-
) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/** @param {import('eslint').Rule.RuleFixer} fixer */
|
|
171
|
-
function * fix(fixer) {
|
|
172
|
-
const elementText = getParenthesizedText(consequent.callee.object.object, context);
|
|
173
|
-
const classNameText = getParenthesizedText(consequent.arguments[0], context);
|
|
174
|
-
const isExpression = node.type === 'ConditionalExpression';
|
|
175
|
-
const isNegative = consequent.callee.property.name === 'remove';
|
|
176
|
-
const conditionNode = node.test;
|
|
177
|
-
const classListContainsCall = getClassListContainsCall(conditionNode, isNegative, consequent);
|
|
178
|
-
const conditionText = classListContainsCall ? '' : getConditionText(conditionNode, context, isNegative);
|
|
179
|
-
const isOptional = consequent.callee.object.optional || alternate.callee.object.optional || classListContainsCall?.callee.object.optional;
|
|
180
|
-
|
|
181
|
-
let text = `${elementText}${isOptional ? '?' : ''}.classList.toggle(${classNameText}${conditionText ? `, ${conditionText}` : ''})`;
|
|
182
|
-
|
|
183
|
-
if (!isExpression) {
|
|
184
|
-
text = `${text};`;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (needsSemicolon(sourceCode.getTokenBefore(node), context, text)) {
|
|
188
|
-
text = `;${text}`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
yield fixer.replaceText(node, text);
|
|
192
|
-
|
|
193
|
-
if (isExpression) {
|
|
194
|
-
yield fixSpaceAroundKeyword(fixer, node, context);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return getProblem(node, fix);
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// `element.classList[condition ? 'add' : 'remove']('className')`
|
|
202
|
-
context.on('ConditionalExpression', conditionalExpression => {
|
|
203
|
-
const clauses = [conditionalExpression.consequent, conditionalExpression.alternate];
|
|
204
|
-
|
|
205
|
-
if (!(
|
|
206
|
-
clauses.every(node => isStringLiteral(node) && (node.value === 'add' || node.value === 'remove'))
|
|
207
|
-
&& clauses[0].value !== clauses[1].value
|
|
208
|
-
&& conditionalExpression.parent.type === 'MemberExpression'
|
|
209
|
-
&& conditionalExpression.parent.computed
|
|
210
|
-
&& !conditionalExpression.parent.optional
|
|
211
|
-
&& conditionalExpression.parent.property === conditionalExpression
|
|
212
|
-
&& isClassList(conditionalExpression.parent.object)
|
|
213
|
-
&& isCallExpression(conditionalExpression.parent.parent, {optional: false, argumentsLength: 1})
|
|
214
|
-
&& conditionalExpression.parent.parent.callee === conditionalExpression.parent
|
|
215
|
-
)) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const classListMethod = conditionalExpression.parent;
|
|
220
|
-
const callExpression = classListMethod.parent;
|
|
221
|
-
|
|
222
|
-
/** @param {import('eslint').Rule.RuleFixer} fixer */
|
|
223
|
-
function * fix(fixer) {
|
|
224
|
-
const isNegative = conditionalExpression.consequent.value === 'remove';
|
|
225
|
-
const conditionNode = conditionalExpression.test;
|
|
226
|
-
const classListContainsCall = getClassListContainsCall(conditionNode, isNegative, callExpression);
|
|
227
|
-
const conditionText = classListContainsCall ? '' : getConditionText(conditionNode, context, isNegative);
|
|
228
|
-
|
|
229
|
-
if (conditionText) {
|
|
230
|
-
yield fixer.insertTextAfter(callExpression.arguments[0], `, ${conditionText}`);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
yield replaceMemberExpressionProperty(fixer, classListMethod, context, '.toggle');
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return getProblem(callExpression, fix, conditionalExpression);
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
241
|
-
const config = {
|
|
242
|
-
create,
|
|
243
|
-
meta: {
|
|
244
|
-
type: 'suggestion',
|
|
245
|
-
docs: {
|
|
246
|
-
description: 'Prefer using `Element#classList.toggle()` to toggle class names.',
|
|
247
|
-
recommended: 'unopinionated',
|
|
248
|
-
},
|
|
249
|
-
fixable: 'code',
|
|
250
|
-
hasSuggestions: true,
|
|
251
|
-
messages,
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export default config;
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {isMemberExpression, isMethodCall} from './ast/index.js';
|
|
2
|
-
|
|
3
|
-
const messages = {
|
|
4
|
-
'error/charCodeAt': 'Prefer `String#codePointAt()` over `String#charCodeAt()`.',
|
|
5
|
-
'error/fromCharCode': 'Prefer `String.fromCodePoint()` over `String.fromCharCode()`.',
|
|
6
|
-
'suggestion/codePointAt': 'Use `String#codePointAt()`.',
|
|
7
|
-
'suggestion/fromCodePoint': 'Use `String.fromCodePoint()`.',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const getProblem = (node, replacement) => ({
|
|
11
|
-
node,
|
|
12
|
-
messageId: `error/${node.name}`,
|
|
13
|
-
suggest: [
|
|
14
|
-
{
|
|
15
|
-
messageId: `suggestion/${replacement}`,
|
|
16
|
-
fix: fixer => fixer.replaceText(node, replacement),
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
/** @param {import('eslint').Rule.RuleContext} context */
|
|
22
|
-
const create = () => ({
|
|
23
|
-
CallExpression(node) {
|
|
24
|
-
if (isMethodCall(node, {
|
|
25
|
-
method: 'charCodeAt',
|
|
26
|
-
optionalCall: false,
|
|
27
|
-
})) {
|
|
28
|
-
return getProblem(node.callee.property, 'codePointAt');
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
MemberExpression(node) {
|
|
32
|
-
if (isMemberExpression(node, {
|
|
33
|
-
object: 'String',
|
|
34
|
-
property: 'fromCharCode',
|
|
35
|
-
optional: false,
|
|
36
|
-
})) {
|
|
37
|
-
return getProblem(node.property, 'fromCodePoint');
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
43
|
-
const config = {
|
|
44
|
-
create,
|
|
45
|
-
meta: {
|
|
46
|
-
type: 'suggestion',
|
|
47
|
-
docs: {
|
|
48
|
-
description: 'Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.',
|
|
49
|
-
recommended: 'unopinionated',
|
|
50
|
-
},
|
|
51
|
-
hasSuggestions: true,
|
|
52
|
-
messages,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default config;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {isMethodCall, isCallExpression, isNewExpression} from './ast/index.js';
|
|
2
|
-
import {fixSpaceAroundKeyword} from './fix/index.js';
|
|
3
|
-
|
|
4
|
-
const MESSAGE_ID_DEFAULT = 'prefer-date';
|
|
5
|
-
const MESSAGE_ID_METHOD = 'prefer-date-now-over-methods';
|
|
6
|
-
const MESSAGE_ID_NUMBER = 'prefer-date-now-over-number-data-object';
|
|
7
|
-
const messages = {
|
|
8
|
-
[MESSAGE_ID_DEFAULT]: 'Prefer `Date.now()` over `new Date()`.',
|
|
9
|
-
[MESSAGE_ID_METHOD]: 'Prefer `Date.now()` over `Date#{{method}}()`.',
|
|
10
|
-
[MESSAGE_ID_NUMBER]: 'Prefer `Date.now()` over `Number(new Date())`.',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const isNewDate = node => isNewExpression(node, {name: 'Date', argumentsLength: 0});
|
|
14
|
-
|
|
15
|
-
const getProblem = (node, problem, context) => ({
|
|
16
|
-
node,
|
|
17
|
-
messageId: MESSAGE_ID_DEFAULT,
|
|
18
|
-
* fix(fixer) {
|
|
19
|
-
yield fixer.replaceText(node, 'Date.now()');
|
|
20
|
-
|
|
21
|
-
if (node.type === 'UnaryExpression') {
|
|
22
|
-
yield fixSpaceAroundKeyword(fixer, node, context);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
...problem,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
/** @param {import('eslint').Rule.RuleContext} context */
|
|
29
|
-
const create = context => ({
|
|
30
|
-
CallExpression(callExpression) {
|
|
31
|
-
// `new Date().{getTime,valueOf}()`
|
|
32
|
-
if (
|
|
33
|
-
isMethodCall(callExpression, {
|
|
34
|
-
methods: ['getTime', 'valueOf'],
|
|
35
|
-
argumentsLength: 0,
|
|
36
|
-
optionalCall: false,
|
|
37
|
-
optionalMember: false,
|
|
38
|
-
})
|
|
39
|
-
&& isNewDate(callExpression.callee.object)
|
|
40
|
-
) {
|
|
41
|
-
const method = callExpression.callee.property;
|
|
42
|
-
return getProblem(callExpression, {
|
|
43
|
-
node: method,
|
|
44
|
-
messageId: MESSAGE_ID_METHOD,
|
|
45
|
-
data: {method: method.name},
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// `{Number,BigInt}(new Date())`
|
|
50
|
-
if (
|
|
51
|
-
isCallExpression(callExpression, {
|
|
52
|
-
names: ['Number', 'BigInt'],
|
|
53
|
-
argumentsLength: 1,
|
|
54
|
-
optional: false,
|
|
55
|
-
})
|
|
56
|
-
&& isNewDate(callExpression.arguments[0])
|
|
57
|
-
) {
|
|
58
|
-
const {name} = callExpression.callee;
|
|
59
|
-
if (name === 'Number') {
|
|
60
|
-
return getProblem(callExpression, {
|
|
61
|
-
messageId: MESSAGE_ID_NUMBER,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return getProblem(callExpression.arguments[0]);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
UnaryExpression(unaryExpression) {
|
|
69
|
-
// https://github.com/estree/estree/blob/master/es5.md#unaryoperator
|
|
70
|
-
if (
|
|
71
|
-
unaryExpression.operator !== '+'
|
|
72
|
-
&& unaryExpression.operator !== '-'
|
|
73
|
-
) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (isNewDate(unaryExpression.argument)) {
|
|
78
|
-
return getProblem(
|
|
79
|
-
unaryExpression.operator === '-' ? unaryExpression.argument : unaryExpression,
|
|
80
|
-
{},
|
|
81
|
-
context,
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
AssignmentExpression(assignmentExpression) {
|
|
86
|
-
if (
|
|
87
|
-
assignmentExpression.operator !== '-='
|
|
88
|
-
&& assignmentExpression.operator !== '*='
|
|
89
|
-
&& assignmentExpression.operator !== '/='
|
|
90
|
-
&& assignmentExpression.operator !== '%='
|
|
91
|
-
&& assignmentExpression.operator !== '**='
|
|
92
|
-
) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (isNewDate(assignmentExpression.right)) {
|
|
97
|
-
return getProblem(assignmentExpression.right);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
* BinaryExpression(binaryExpression) {
|
|
101
|
-
if (
|
|
102
|
-
binaryExpression.operator !== '-'
|
|
103
|
-
&& binaryExpression.operator !== '*'
|
|
104
|
-
&& binaryExpression.operator !== '/'
|
|
105
|
-
&& binaryExpression.operator !== '%'
|
|
106
|
-
&& binaryExpression.operator !== '**'
|
|
107
|
-
) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (const node of [binaryExpression.left, binaryExpression.right]) {
|
|
112
|
-
if (isNewDate(node)) {
|
|
113
|
-
yield getProblem(node);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
120
|
-
const config = {
|
|
121
|
-
create,
|
|
122
|
-
meta: {
|
|
123
|
-
type: 'suggestion',
|
|
124
|
-
docs: {
|
|
125
|
-
description: 'Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.',
|
|
126
|
-
recommended: 'unopinionated',
|
|
127
|
-
},
|
|
128
|
-
fixable: 'code',
|
|
129
|
-
messages,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export default config;
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import {findVariable} from '@eslint-community/eslint-utils';
|
|
2
|
-
import {functionTypes} from './ast/index.js';
|
|
3
|
-
|
|
4
|
-
const MESSAGE_ID = 'preferDefaultParameters';
|
|
5
|
-
const MESSAGE_ID_SUGGEST = 'preferDefaultParametersSuggest';
|
|
6
|
-
|
|
7
|
-
const isDefaultExpression = (left, right) =>
|
|
8
|
-
left
|
|
9
|
-
&& right
|
|
10
|
-
&& left.type === 'Identifier'
|
|
11
|
-
&& right.type === 'LogicalExpression'
|
|
12
|
-
&& (right.operator === '||' || right.operator === '??')
|
|
13
|
-
&& right.left.type === 'Identifier'
|
|
14
|
-
&& right.right.type === 'Literal';
|
|
15
|
-
|
|
16
|
-
const containsCallExpression = (sourceCode, node) => {
|
|
17
|
-
if (!node) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (node.type === 'CallExpression') {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const keys = sourceCode.visitorKeys[node.type];
|
|
26
|
-
|
|
27
|
-
for (const key of keys) {
|
|
28
|
-
const value = node[key];
|
|
29
|
-
|
|
30
|
-
if (Array.isArray(value)) {
|
|
31
|
-
for (const element of value) {
|
|
32
|
-
if (containsCallExpression(sourceCode, element)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
} else if (containsCallExpression(sourceCode, value)) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return false;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const hasSideEffects = (sourceCode, function_, node) => {
|
|
45
|
-
for (const element of function_.body.body) {
|
|
46
|
-
if (element === node) {
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Function call before default-assignment
|
|
51
|
-
if (containsCallExpression(sourceCode, element)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return false;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const hasExtraReferences = (assignment, references, left) => {
|
|
60
|
-
// Parameter is referenced prior to default-assignment
|
|
61
|
-
if (assignment && references[0].identifier !== left) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Old parameter is still referenced somewhere else
|
|
66
|
-
if (!assignment && references.length > 1) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return false;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const isLastParameter = (parameters, parameter) => {
|
|
74
|
-
const lastParameter = parameters.at(-1);
|
|
75
|
-
|
|
76
|
-
// See 'default-param-last' rule
|
|
77
|
-
return parameter && parameter === lastParameter;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const needsParentheses = (sourceCode, function_) => {
|
|
81
|
-
if (function_.type !== 'ArrowFunctionExpression' || function_.params.length > 1) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const [parameter] = function_.params;
|
|
86
|
-
const before = sourceCode.getTokenBefore(parameter);
|
|
87
|
-
const after = sourceCode.getTokenAfter(parameter);
|
|
88
|
-
|
|
89
|
-
return !after || !before || before.value !== '(' || after.value !== ')';
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/** @param {import('eslint').Rule.RuleFixer} fixer */
|
|
93
|
-
const fixDefaultExpression = (fixer, sourceCode, node) => {
|
|
94
|
-
const {line} = sourceCode.getLoc(node).start;
|
|
95
|
-
const {column} = sourceCode.getLoc(node).end;
|
|
96
|
-
const nodeText = sourceCode.getText(node);
|
|
97
|
-
const lineText = sourceCode.lines[line - 1];
|
|
98
|
-
const isOnlyNodeOnLine = lineText.trim() === nodeText;
|
|
99
|
-
const endsWithWhitespace = lineText[column] === ' ';
|
|
100
|
-
|
|
101
|
-
if (isOnlyNodeOnLine) {
|
|
102
|
-
return fixer.removeRange([
|
|
103
|
-
sourceCode.getIndexFromLoc({line, column: 0}),
|
|
104
|
-
sourceCode.getIndexFromLoc({line: line + 1, column: 0}),
|
|
105
|
-
]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (endsWithWhitespace) {
|
|
109
|
-
const [start, end] = sourceCode.getRange(node);
|
|
110
|
-
return fixer.removeRange([start, end + 1]);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return fixer.remove(node);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/** @param {import('eslint').Rule.RuleContext} context */
|
|
117
|
-
const create = context => {
|
|
118
|
-
const {sourceCode} = context;
|
|
119
|
-
const functionStack = [];
|
|
120
|
-
|
|
121
|
-
const checkExpression = (node, left, right, assignment) => {
|
|
122
|
-
const currentFunction = functionStack.at(-1);
|
|
123
|
-
|
|
124
|
-
if (!currentFunction || !isDefaultExpression(left, right)) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const {name: firstId} = left;
|
|
129
|
-
const {
|
|
130
|
-
left: {name: secondId},
|
|
131
|
-
right: {raw: literal},
|
|
132
|
-
} = right;
|
|
133
|
-
|
|
134
|
-
// Parameter is reassigned to a different identifier
|
|
135
|
-
if (assignment && firstId !== secondId) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const variable = findVariable(sourceCode.getScope(node), secondId);
|
|
140
|
-
|
|
141
|
-
// This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1122
|
|
142
|
-
// But can't reproduce, just ignore this case
|
|
143
|
-
/* c8 ignore next 3 */
|
|
144
|
-
if (!variable) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const {references} = variable;
|
|
149
|
-
const {params} = currentFunction;
|
|
150
|
-
const parameter = params.find(parameter =>
|
|
151
|
-
parameter.type === 'Identifier'
|
|
152
|
-
&& parameter.name === secondId,
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
hasSideEffects(sourceCode, currentFunction, node)
|
|
157
|
-
|| hasExtraReferences(assignment, references, left)
|
|
158
|
-
|| !isLastParameter(params, parameter)
|
|
159
|
-
) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const replacement = needsParentheses(sourceCode, currentFunction)
|
|
164
|
-
? `(${firstId} = ${literal})`
|
|
165
|
-
: `${firstId} = ${literal}`;
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
node,
|
|
169
|
-
messageId: MESSAGE_ID,
|
|
170
|
-
suggest: [{
|
|
171
|
-
messageId: MESSAGE_ID_SUGGEST,
|
|
172
|
-
fix: fixer => [
|
|
173
|
-
fixer.replaceText(parameter, replacement),
|
|
174
|
-
fixDefaultExpression(fixer, sourceCode, node),
|
|
175
|
-
],
|
|
176
|
-
}],
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
context.on(functionTypes, node => {
|
|
181
|
-
functionStack.push(node);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
context.onExit(functionTypes, () => {
|
|
185
|
-
functionStack.pop();
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
context.on('AssignmentExpression', node => {
|
|
189
|
-
if (node.parent.type === 'ExpressionStatement' && node.parent.expression === node) {
|
|
190
|
-
return checkExpression(node.parent, node.left, node.right, true);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
context.on('VariableDeclarator', node => {
|
|
195
|
-
if (node.parent.type === 'VariableDeclaration' && node.parent.declarations[0] === node) {
|
|
196
|
-
return checkExpression(node.parent, node.id, node.init, false);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
202
|
-
const config = {
|
|
203
|
-
create,
|
|
204
|
-
meta: {
|
|
205
|
-
type: 'suggestion',
|
|
206
|
-
docs: {
|
|
207
|
-
description: 'Prefer default parameters over reassignment.',
|
|
208
|
-
recommended: 'unopinionated',
|
|
209
|
-
},
|
|
210
|
-
hasSuggestions: true,
|
|
211
|
-
messages: {
|
|
212
|
-
[MESSAGE_ID]: 'Prefer default parameters over reassignment.',
|
|
213
|
-
[MESSAGE_ID_SUGGEST]: 'Replace reassignment with default parameter.',
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export default config;
|
package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {isMethodCall} from './ast/index.js';
|
|
2
|
-
import {isNodeValueNotDomNode, isValueNotUsable} from './utils/index.js';
|
|
3
|
-
|
|
4
|
-
const MESSAGE_ID = 'prefer-dom-node-append';
|
|
5
|
-
const messages = {
|
|
6
|
-
[MESSAGE_ID]: 'Prefer `Node#append()` over `Node#appendChild()`.',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/** @param {import('eslint').Rule.RuleContext} context */
|
|
10
|
-
const create = () => ({
|
|
11
|
-
CallExpression(node) {
|
|
12
|
-
if (
|
|
13
|
-
!isMethodCall(node, {
|
|
14
|
-
method: 'appendChild',
|
|
15
|
-
argumentsLength: 1,
|
|
16
|
-
optionalCall: false,
|
|
17
|
-
})
|
|
18
|
-
|| isNodeValueNotDomNode(node.callee.object)
|
|
19
|
-
|| isNodeValueNotDomNode(node.arguments[0])
|
|
20
|
-
) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const fix = isValueNotUsable(node)
|
|
25
|
-
? fixer => fixer.replaceText(node.callee.property, 'append')
|
|
26
|
-
: undefined;
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
node,
|
|
30
|
-
messageId: MESSAGE_ID,
|
|
31
|
-
fix,
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
37
|
-
const config = {
|
|
38
|
-
create,
|
|
39
|
-
meta: {
|
|
40
|
-
type: 'suggestion',
|
|
41
|
-
docs: {
|
|
42
|
-
description: 'Prefer `Node#append()` over `Node#appendChild()`.',
|
|
43
|
-
recommended: 'unopinionated',
|
|
44
|
-
},
|
|
45
|
-
fixable: 'code',
|
|
46
|
-
messages,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default config;
|