oxlint-plugin-eslint 1.52.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/LICENSE +22 -0
- package/README.md +36 -0
- package/common/ast-utils.cjs +5843 -0
- package/common/chunk.cjs +9 -0
- package/common/eslint-utils.cjs +1633 -0
- package/common/fix-tracker.cjs +89 -0
- package/common/ignore.cjs +123 -0
- package/common/keywords.cjs +15 -0
- package/common/regexpp.cjs +1720 -0
- package/common/regular-expressions.cjs +40 -0
- package/common/string-utils.cjs +39 -0
- package/index.js +7477 -0
- package/package.json +34 -0
- package/rules/accessor-pairs.cjs +233 -0
- package/rules/array-bracket-newline.cjs +172 -0
- package/rules/array-bracket-spacing.cjs +184 -0
- package/rules/array-callback-return.cjs +262 -0
- package/rules/array-element-newline.cjs +178 -0
- package/rules/arrow-body-style.cjs +135 -0
- package/rules/arrow-parens.cjs +130 -0
- package/rules/arrow-spacing.cjs +129 -0
- package/rules/block-scoped-var.cjs +101 -0
- package/rules/block-spacing.cjs +125 -0
- package/rules/brace-style.cjs +141 -0
- package/rules/callback-return.cjs +117 -0
- package/rules/camelcase.cjs +194 -0
- package/rules/capitalized-comments.cjs +168 -0
- package/rules/class-methods-use-this.cjs +155 -0
- package/rules/comma-dangle.cjs +274 -0
- package/rules/comma-spacing.cjs +111 -0
- package/rules/comma-style.cjs +180 -0
- package/rules/complexity.cjs +100 -0
- package/rules/computed-property-spacing.cjs +155 -0
- package/rules/consistent-return.cjs +113 -0
- package/rules/consistent-this.cjs +109 -0
- package/rules/constructor-super.cjs +207 -0
- package/rules/curly.cjs +173 -0
- package/rules/default-case-last.cjs +36 -0
- package/rules/default-case.cjs +50 -0
- package/rules/default-param-last.cjs +61 -0
- package/rules/dot-location.cjs +87 -0
- package/rules/dot-notation.cjs +77 -0
- package/rules/eol-last.cjs +91 -0
- package/rules/eqeqeq.cjs +127 -0
- package/rules/for-direction.cjs +94 -0
- package/rules/func-call-spacing.cjs +127 -0
- package/rules/func-name-matching.cjs +138 -0
- package/rules/func-names.cjs +121 -0
- package/rules/func-style.cjs +103 -0
- package/rules/function-call-argument-newline.cjs +109 -0
- package/rules/function-paren-newline.cjs +173 -0
- package/rules/generator-star-spacing.cjs +174 -0
- package/rules/getter-return.cjs +129 -0
- package/rules/global-require.cjs +84 -0
- package/rules/grouped-accessor-pairs.cjs +146 -0
- package/rules/guard-for-in.cjs +39 -0
- package/rules/handle-callback-err.cjs +86 -0
- package/rules/id-blacklist.cjs +135 -0
- package/rules/id-denylist.cjs +126 -0
- package/rules/id-length.cjs +119 -0
- package/rules/id-match.cjs +139 -0
- package/rules/implicit-arrow-linebreak.cjs +76 -0
- package/rules/indent-legacy.cjs +520 -0
- package/rules/indent.cjs +842 -0
- package/rules/init-declarations.cjs +88 -0
- package/rules/jsx-quotes.cjs +84 -0
- package/rules/key-spacing.cjs +399 -0
- package/rules/keyword-spacing.cjs +464 -0
- package/rules/line-comment-position.cjs +75 -0
- package/rules/linebreak-style.cjs +89 -0
- package/rules/lines-around-comment.cjs +290 -0
- package/rules/lines-around-directive.cjs +129 -0
- package/rules/lines-between-class-members.cjs +212 -0
- package/rules/logical-assignment-operators.cjs +305 -0
- package/rules/max-classes-per-file.cjs +61 -0
- package/rules/max-depth.cjs +117 -0
- package/rules/max-len.cjs +256 -0
- package/rules/max-lines-per-function.cjs +116 -0
- package/rules/max-lines.cjs +109 -0
- package/rules/max-nested-callbacks.cjs +78 -0
- package/rules/max-params.cjs +78 -0
- package/rules/max-statements-per-line.cjs +147 -0
- package/rules/max-statements.cjs +119 -0
- package/rules/multiline-comment-style.cjs +319 -0
- package/rules/multiline-ternary.cjs +106 -0
- package/rules/new-cap.cjs +139 -0
- package/rules/new-parens.cjs +70 -0
- package/rules/newline-after-var.cjs +159 -0
- package/rules/newline-before-return.cjs +128 -0
- package/rules/newline-per-chained-call.cjs +100 -0
- package/rules/no-alert.cjs +84 -0
- package/rules/no-array-constructor.cjs +91 -0
- package/rules/no-async-promise-executor.cjs +33 -0
- package/rules/no-await-in-loop.cjs +75 -0
- package/rules/no-bitwise.cjs +106 -0
- package/rules/no-buffer-constructor.cjs +51 -0
- package/rules/no-caller.cjs +34 -0
- package/rules/no-case-declarations.cjs +56 -0
- package/rules/no-catch-shadow.cjs +57 -0
- package/rules/no-class-assign.cjs +55 -0
- package/rules/no-compare-neg-zero.cjs +52 -0
- package/rules/no-cond-assign.cjs +104 -0
- package/rules/no-confusing-arrow.cjs +87 -0
- package/rules/no-console.cjs +138 -0
- package/rules/no-const-assign.cjs +50 -0
- package/rules/no-constant-binary-expression.cjs +284 -0
- package/rules/no-constant-condition.cjs +119 -0
- package/rules/no-constructor-return.cjs +43 -0
- package/rules/no-continue.cjs +33 -0
- package/rules/no-control-regex.cjs +74 -0
- package/rules/no-debugger.cjs +33 -0
- package/rules/no-delete-var.cjs +32 -0
- package/rules/no-div-regex.cjs +39 -0
- package/rules/no-dupe-args.cjs +61 -0
- package/rules/no-dupe-class-members.cjs +77 -0
- package/rules/no-dupe-else-if.cjs +74 -0
- package/rules/no-dupe-keys.cjs +88 -0
- package/rules/no-duplicate-case.cjs +49 -0
- package/rules/no-duplicate-imports.cjs +166 -0
- package/rules/no-else-return.cjs +182 -0
- package/rules/no-empty-character-class.cjs +47 -0
- package/rules/no-empty-function.cjs +141 -0
- package/rules/no-empty-pattern.cjs +50 -0
- package/rules/no-empty-static-block.cjs +50 -0
- package/rules/no-empty.cjs +78 -0
- package/rules/no-eq-null.cjs +34 -0
- package/rules/no-eval.cjs +165 -0
- package/rules/no-ex-assign.cjs +45 -0
- package/rules/no-extend-native.cjs +103 -0
- package/rules/no-extra-bind.cjs +127 -0
- package/rules/no-extra-boolean-cast.cjs +159 -0
- package/rules/no-extra-label.cjs +116 -0
- package/rules/no-extra-parens.cjs +665 -0
- package/rules/no-extra-semi.cjs +103 -0
- package/rules/no-fallthrough.cjs +136 -0
- package/rules/no-floating-decimal.cjs +66 -0
- package/rules/no-func-assign.cjs +63 -0
- package/rules/no-global-assign.cjs +62 -0
- package/rules/no-implicit-coercion.cjs +219 -0
- package/rules/no-implicit-globals.cjs +77 -0
- package/rules/no-implied-eval.cjs +87 -0
- package/rules/no-import-assign.cjs +123 -0
- package/rules/no-inline-comments.cjs +57 -0
- package/rules/no-inner-declarations.cjs +82 -0
- package/rules/no-invalid-regexp.cjs +130 -0
- package/rules/no-invalid-this.cjs +90 -0
- package/rules/no-irregular-whitespace.cjs +157 -0
- package/rules/no-iterator.cjs +34 -0
- package/rules/no-label-var.cjs +46 -0
- package/rules/no-labels.cjs +106 -0
- package/rules/no-lone-blocks.cjs +75 -0
- package/rules/no-lonely-if.cjs +42 -0
- package/rules/no-loop-func.cjs +143 -0
- package/rules/no-loss-of-precision.cjs +160 -0
- package/rules/no-magic-numbers.cjs +222 -0
- package/rules/no-misleading-character-class.cjs +500 -0
- package/rules/no-mixed-operators.cjs +197 -0
- package/rules/no-mixed-requires.cjs +117 -0
- package/rules/no-mixed-spaces-and-tabs.cjs +87 -0
- package/rules/no-multi-assign.cjs +38 -0
- package/rules/no-multi-spaces.cjs +95 -0
- package/rules/no-multi-str.cjs +44 -0
- package/rules/no-multiple-empty-lines.cjs +112 -0
- package/rules/no-native-reassign.cjs +72 -0
- package/rules/no-negated-condition.cjs +77 -0
- package/rules/no-negated-in-lhs.cjs +43 -0
- package/rules/no-nested-ternary.cjs +33 -0
- package/rules/no-new-func.cjs +50 -0
- package/rules/no-new-native-nonconstructor.cjs +42 -0
- package/rules/no-new-object.cjs +47 -0
- package/rules/no-new-require.cjs +50 -0
- package/rules/no-new-symbol.cjs +48 -0
- package/rules/no-new-wrappers.cjs +44 -0
- package/rules/no-new.cjs +33 -0
- package/rules/no-nonoctal-decimal-escape.cjs +80 -0
- package/rules/no-obj-calls.cjs +64 -0
- package/rules/no-object-constructor.cjs +69 -0
- package/rules/no-octal-escape.cjs +35 -0
- package/rules/no-octal.cjs +32 -0
- package/rules/no-param-reassign.cjs +135 -0
- package/rules/no-path-concat.cjs +52 -0
- package/rules/no-plusplus.cjs +64 -0
- package/rules/no-process-env.cjs +51 -0
- package/rules/no-process-exit.cjs +50 -0
- package/rules/no-promise-executor-return.cjs +131 -0
- package/rules/no-proto.cjs +34 -0
- package/rules/no-prototype-builtins.cjs +85 -0
- package/rules/no-redeclare.cjs +103 -0
- package/rules/no-regex-spaces.cjs +115 -0
- package/rules/no-restricted-exports.cjs +117 -0
- package/rules/no-restricted-globals.cjs +147 -0
- package/rules/no-restricted-imports.cjs +421 -0
- package/rules/no-restricted-modules.cjs +144 -0
- package/rules/no-restricted-properties.cjs +123 -0
- package/rules/no-restricted-syntax.cjs +49 -0
- package/rules/no-return-assign.cjs +45 -0
- package/rules/no-return-await.cjs +88 -0
- package/rules/no-script-url.cjs +49 -0
- package/rules/no-self-assign.cjs +88 -0
- package/rules/no-self-compare.cjs +53 -0
- package/rules/no-sequences.cjs +81 -0
- package/rules/no-setter-return.cjs +110 -0
- package/rules/no-shadow-restricted-names.cjs +60 -0
- package/rules/no-shadow.cjs +302 -0
- package/rules/no-spaced-func.cjs +69 -0
- package/rules/no-sparse-arrays.cjs +40 -0
- package/rules/no-sync.cjs +58 -0
- package/rules/no-tabs.cjs +73 -0
- package/rules/no-template-curly-in-string.cjs +33 -0
- package/rules/no-ternary.cjs +33 -0
- package/rules/no-this-before-super.cjs +177 -0
- package/rules/no-throw-literal.cjs +40 -0
- package/rules/no-trailing-spaces.cjs +123 -0
- package/rules/no-unassigned-vars.cjs +54 -0
- package/rules/no-undef-init.cjs +46 -0
- package/rules/no-undef.cjs +51 -0
- package/rules/no-undefined.cjs +58 -0
- package/rules/no-underscore-dangle.cjs +211 -0
- package/rules/no-unexpected-multiline.cjs +76 -0
- package/rules/no-unmodified-loop-condition.cjs +849 -0
- package/rules/no-unneeded-ternary.cjs +112 -0
- package/rules/no-unreachable-loop.cjs +128 -0
- package/rules/no-unreachable.cjs +195 -0
- package/rules/no-unsafe-finally.cjs +67 -0
- package/rules/no-unsafe-negation.cjs +86 -0
- package/rules/no-unsafe-optional-chaining.cjs +164 -0
- package/rules/no-unused-expressions.cjs +163 -0
- package/rules/no-unused-labels.cjs +97 -0
- package/rules/no-unused-private-class-members.cjs +69 -0
- package/rules/no-unused-vars.cjs +639 -0
- package/rules/no-use-before-define.cjs +245 -0
- package/rules/no-useless-assignment.cjs +250 -0
- package/rules/no-useless-backreference.cjs +137 -0
- package/rules/no-useless-call.cjs +57 -0
- package/rules/no-useless-catch.cjs +38 -0
- package/rules/no-useless-computed-key.cjs +106 -0
- package/rules/no-useless-concat.cjs +78 -0
- package/rules/no-useless-constructor.cjs +152 -0
- package/rules/no-useless-escape.cjs +164 -0
- package/rules/no-useless-rename.cjs +94 -0
- package/rules/no-useless-return.cjs +229 -0
- package/rules/no-var.cjs +235 -0
- package/rules/no-void.cjs +39 -0
- package/rules/no-warning-comments.cjs +112 -0
- package/rules/no-whitespace-before-property.cjs +72 -0
- package/rules/no-with.cjs +32 -0
- package/rules/nonblock-statement-body-position.cjs +107 -0
- package/rules/object-curly-newline.cjs +194 -0
- package/rules/object-curly-spacing.cjs +225 -0
- package/rules/object-property-newline.cjs +81 -0
- package/rules/object-shorthand.cjs +284 -0
- package/rules/one-var-declaration-per-line.cjs +75 -0
- package/rules/one-var.cjs +378 -0
- package/rules/operator-assignment.cjs +146 -0
- package/rules/operator-linebreak.cjs +150 -0
- package/rules/padded-blocks.cjs +192 -0
- package/rules/padding-line-between-statements.cjs +377 -0
- package/rules/prefer-arrow-callback.cjs +185 -0
- package/rules/prefer-const.cjs +240 -0
- package/rules/prefer-destructuring.cjs +188 -0
- package/rules/prefer-exponentiation-operator.cjs +100 -0
- package/rules/prefer-named-capture-group.cjs +111 -0
- package/rules/prefer-numeric-literals.cjs +75 -0
- package/rules/prefer-object-has-own.cjs +54 -0
- package/rules/prefer-object-spread.cjs +170 -0
- package/rules/prefer-promise-reject-errors.cjs +62 -0
- package/rules/prefer-reflect.cjs +100 -0
- package/rules/prefer-regex-literals.cjs +256 -0
- package/rules/prefer-rest-params.cjs +80 -0
- package/rules/prefer-spread.cjs +57 -0
- package/rules/prefer-template.cjs +147 -0
- package/rules/preserve-caught-error.cjs +196 -0
- package/rules/quote-props.cjs +224 -0
- package/rules/quotes.cjs +187 -0
- package/rules/radix.cjs +124 -0
- package/rules/require-atomic-updates.cjs +197 -0
- package/rules/require-await.cjs +90 -0
- package/rules/require-unicode-regexp.cjs +101 -0
- package/rules/require-yield.cjs +56 -0
- package/rules/rest-spread-spacing.cjs +99 -0
- package/rules/semi-spacing.cjs +215 -0
- package/rules/semi-style.cjs +116 -0
- package/rules/semi.cjs +239 -0
- package/rules/sort-imports.cjs +140 -0
- package/rules/sort-keys.cjs +165 -0
- package/rules/sort-vars.cjs +50 -0
- package/rules/space-before-blocks.cjs +132 -0
- package/rules/space-before-function-paren.cjs +126 -0
- package/rules/space-in-parens.cjs +175 -0
- package/rules/space-infix-ops.cjs +133 -0
- package/rules/space-unary-ops.cjs +237 -0
- package/rules/spaced-comment.cjs +233 -0
- package/rules/strict.cjs +206 -0
- package/rules/switch-colon-spacing.cjs +114 -0
- package/rules/symbol-description.cjs +49 -0
- package/rules/template-curly-spacing.cjs +112 -0
- package/rules/template-tag-spacing.cjs +82 -0
- package/rules/unicode-bom.cjs +52 -0
- package/rules/use-isnan.cjs +144 -0
- package/rules/valid-typeof.cjs +104 -0
- package/rules/vars-on-top.cjs +94 -0
- package/rules/wrap-iife.cjs +131 -0
- package/rules/wrap-regex.cjs +57 -0
- package/rules/yield-star-spacing.cjs +115 -0
- package/rules/yoda.cjs +185 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs");
|
|
2
|
+
//#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/computed-property-spacing.js
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Disallows or enforces spaces inside computed properties.
|
|
5
|
+
* @author Jamund Ferguson
|
|
6
|
+
* @deprecated in ESLint v8.53.0
|
|
7
|
+
*/
|
|
8
|
+
var require_computed_property_spacing = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
9
|
+
let astUtils = require_ast_utils$1.t();
|
|
10
|
+
/** @type {import('../types').Rule.RuleModule} */
|
|
11
|
+
module.exports = {
|
|
12
|
+
meta: {
|
|
13
|
+
deprecated: {
|
|
14
|
+
message: "Formatting rules are being moved out of ESLint core.",
|
|
15
|
+
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
|
16
|
+
deprecatedSince: "8.53.0",
|
|
17
|
+
availableUntil: "11.0.0",
|
|
18
|
+
replacedBy: [{
|
|
19
|
+
message: "ESLint Stylistic now maintains deprecated stylistic core rules.",
|
|
20
|
+
url: "https://eslint.style/guide/migration",
|
|
21
|
+
plugin: {
|
|
22
|
+
name: "@stylistic/eslint-plugin",
|
|
23
|
+
url: "https://eslint.style"
|
|
24
|
+
},
|
|
25
|
+
rule: {
|
|
26
|
+
name: "computed-property-spacing",
|
|
27
|
+
url: "https://eslint.style/rules/computed-property-spacing"
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
30
|
+
},
|
|
31
|
+
type: "layout",
|
|
32
|
+
docs: {
|
|
33
|
+
description: "Enforce consistent spacing inside computed property brackets",
|
|
34
|
+
recommended: !1,
|
|
35
|
+
url: "https://eslint.org/docs/latest/rules/computed-property-spacing"
|
|
36
|
+
},
|
|
37
|
+
fixable: "whitespace",
|
|
38
|
+
schema: [{ enum: ["always", "never"] }, {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: { enforceForClassMembers: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
default: !0
|
|
43
|
+
} },
|
|
44
|
+
additionalProperties: !1
|
|
45
|
+
}],
|
|
46
|
+
messages: {
|
|
47
|
+
unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.",
|
|
48
|
+
unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.",
|
|
49
|
+
missingSpaceBefore: "A space is required before '{{tokenValue}}'.",
|
|
50
|
+
missingSpaceAfter: "A space is required after '{{tokenValue}}'."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
create(context) {
|
|
54
|
+
let sourceCode = context.sourceCode, propertyNameMustBeSpaced = context.options[0] === "always", enforceForClassMembers = !context.options[1] || context.options[1].enforceForClassMembers;
|
|
55
|
+
/**
|
|
56
|
+
* Reports that there shouldn't be a space after the first token
|
|
57
|
+
* @param {ASTNode} node The node to report in the event of an error.
|
|
58
|
+
* @param {Token} token The token to use for the report.
|
|
59
|
+
* @param {Token} tokenAfter The token after `token`.
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
function reportNoBeginningSpace(node, token, tokenAfter) {
|
|
63
|
+
context.report({
|
|
64
|
+
node,
|
|
65
|
+
loc: {
|
|
66
|
+
start: token.loc.end,
|
|
67
|
+
end: tokenAfter.loc.start
|
|
68
|
+
},
|
|
69
|
+
messageId: "unexpectedSpaceAfter",
|
|
70
|
+
data: { tokenValue: token.value },
|
|
71
|
+
fix(fixer) {
|
|
72
|
+
return fixer.removeRange([token.range[1], tokenAfter.range[0]]);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Reports that there shouldn't be a space before the last token
|
|
78
|
+
* @param {ASTNode} node The node to report in the event of an error.
|
|
79
|
+
* @param {Token} token The token to use for the report.
|
|
80
|
+
* @param {Token} tokenBefore The token before `token`.
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
function reportNoEndingSpace(node, token, tokenBefore) {
|
|
84
|
+
context.report({
|
|
85
|
+
node,
|
|
86
|
+
loc: {
|
|
87
|
+
start: tokenBefore.loc.end,
|
|
88
|
+
end: token.loc.start
|
|
89
|
+
},
|
|
90
|
+
messageId: "unexpectedSpaceBefore",
|
|
91
|
+
data: { tokenValue: token.value },
|
|
92
|
+
fix(fixer) {
|
|
93
|
+
return fixer.removeRange([tokenBefore.range[1], token.range[0]]);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reports that there should be a space after the first token
|
|
99
|
+
* @param {ASTNode} node The node to report in the event of an error.
|
|
100
|
+
* @param {Token} token The token to use for the report.
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
function reportRequiredBeginningSpace(node, token) {
|
|
104
|
+
context.report({
|
|
105
|
+
node,
|
|
106
|
+
loc: token.loc,
|
|
107
|
+
messageId: "missingSpaceAfter",
|
|
108
|
+
data: { tokenValue: token.value },
|
|
109
|
+
fix(fixer) {
|
|
110
|
+
return fixer.insertTextAfter(token, " ");
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Reports that there should be a space before the last token
|
|
116
|
+
* @param {ASTNode} node The node to report in the event of an error.
|
|
117
|
+
* @param {Token} token The token to use for the report.
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
function reportRequiredEndingSpace(node, token) {
|
|
121
|
+
context.report({
|
|
122
|
+
node,
|
|
123
|
+
loc: token.loc,
|
|
124
|
+
messageId: "missingSpaceBefore",
|
|
125
|
+
data: { tokenValue: token.value },
|
|
126
|
+
fix(fixer) {
|
|
127
|
+
return fixer.insertTextBefore(token, " ");
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Returns a function that checks the spacing of a node on the property name
|
|
133
|
+
* that was passed in.
|
|
134
|
+
* @param {string} propertyName The property on the node to check for spacing
|
|
135
|
+
* @returns {Function} A function that will check spacing on a node
|
|
136
|
+
*/
|
|
137
|
+
function checkSpacing(propertyName) {
|
|
138
|
+
return function(node) {
|
|
139
|
+
if (!node.computed) return;
|
|
140
|
+
let property = node[propertyName], before = sourceCode.getTokenBefore(property, astUtils.isOpeningBracketToken), first = sourceCode.getTokenAfter(before, { includeComments: !0 }), after = sourceCode.getTokenAfter(property, astUtils.isClosingBracketToken), last = sourceCode.getTokenBefore(after, { includeComments: !0 });
|
|
141
|
+
astUtils.isTokenOnSameLine(before, first) && (propertyNameMustBeSpaced ? !sourceCode.isSpaceBetweenTokens(before, first) && astUtils.isTokenOnSameLine(before, first) && reportRequiredBeginningSpace(node, before) : sourceCode.isSpaceBetweenTokens(before, first) && reportNoBeginningSpace(node, before, first)), astUtils.isTokenOnSameLine(last, after) && (propertyNameMustBeSpaced ? !sourceCode.isSpaceBetweenTokens(last, after) && astUtils.isTokenOnSameLine(last, after) && reportRequiredEndingSpace(node, after) : sourceCode.isSpaceBetweenTokens(last, after) && reportNoEndingSpace(node, after, last));
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
let listeners = {
|
|
145
|
+
Property: checkSpacing("key"),
|
|
146
|
+
MemberExpression: checkSpacing("property")
|
|
147
|
+
};
|
|
148
|
+
return enforceForClassMembers && (listeners.MethodDefinition = listeners.PropertyDefinition = listeners.Property), listeners;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}));
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src-js/generated/plugin-eslint/rules/computed-property-spacing.cjs
|
|
154
|
+
module.exports = require_computed_property_spacing().create;
|
|
155
|
+
//#endregion
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs"), require_string_utils$1 = require("../common/string-utils.cjs");
|
|
2
|
+
//#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/consistent-return.js
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Rule to flag consistent return values
|
|
5
|
+
* @author Nicholas C. Zakas
|
|
6
|
+
*/
|
|
7
|
+
var require_consistent_return = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
8
|
+
let astUtils = require_ast_utils$1.t(), { upperCaseFirst } = require_string_utils$1.t();
|
|
9
|
+
/**
|
|
10
|
+
* Checks all segments in a set and returns true if all are unreachable.
|
|
11
|
+
* @param {Set<CodePathSegment>} segments The segments to check.
|
|
12
|
+
* @returns {boolean} True if all segments are unreachable; false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
function areAllSegmentsUnreachable(segments) {
|
|
15
|
+
for (let segment of segments) if (segment.reachable) return !1;
|
|
16
|
+
return !0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Checks whether a given node is a `constructor` method in an ES6 class
|
|
20
|
+
* @param {ASTNode} node A node to check
|
|
21
|
+
* @returns {boolean} `true` if the node is a `constructor` method
|
|
22
|
+
*/
|
|
23
|
+
function isClassConstructor(node) {
|
|
24
|
+
return node.type === "FunctionExpression" && node.parent && node.parent.type === "MethodDefinition" && node.parent.kind === "constructor";
|
|
25
|
+
}
|
|
26
|
+
/** @type {import('../types').Rule.RuleModule} */
|
|
27
|
+
module.exports = {
|
|
28
|
+
meta: {
|
|
29
|
+
type: "suggestion",
|
|
30
|
+
docs: {
|
|
31
|
+
description: "Require `return` statements to either always or never specify values",
|
|
32
|
+
recommended: !1,
|
|
33
|
+
url: "https://eslint.org/docs/latest/rules/consistent-return"
|
|
34
|
+
},
|
|
35
|
+
schema: [{
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: { treatUndefinedAsUnspecified: { type: "boolean" } },
|
|
38
|
+
additionalProperties: !1
|
|
39
|
+
}],
|
|
40
|
+
defaultOptions: [{ treatUndefinedAsUnspecified: !1 }],
|
|
41
|
+
messages: {
|
|
42
|
+
missingReturn: "Expected to return a value at the end of {{name}}.",
|
|
43
|
+
missingReturnValue: "{{name}} expected a return value.",
|
|
44
|
+
unexpectedReturnValue: "{{name}} expected no return value."
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
create(context) {
|
|
48
|
+
let [{ treatUndefinedAsUnspecified }] = context.options, funcInfo = null;
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether of not the implicit returning is consistent if the last
|
|
51
|
+
* code path segment is reachable.
|
|
52
|
+
* @param {ASTNode} node A program/function node to check.
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
function checkLastSegment(node) {
|
|
56
|
+
let loc, name;
|
|
57
|
+
!funcInfo.hasReturnValue || areAllSegmentsUnreachable(funcInfo.currentSegments) || astUtils.isES5Constructor(node) || isClassConstructor(node) || (node.type === "Program" ? (loc = {
|
|
58
|
+
line: 1,
|
|
59
|
+
column: 0
|
|
60
|
+
}, name = "program") : loc = node.type === "ArrowFunctionExpression" ? context.sourceCode.getTokenBefore(node.body, astUtils.isArrowToken).loc : node.parent.type === "MethodDefinition" || node.parent.type === "Property" && node.parent.method ? node.parent.key.loc : (node.id || context.sourceCode.getFirstToken(node)).loc, name ||= astUtils.getFunctionNameWithKind(node), context.report({
|
|
61
|
+
node,
|
|
62
|
+
loc,
|
|
63
|
+
messageId: "missingReturn",
|
|
64
|
+
data: { name }
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
onCodePathStart(codePath, node) {
|
|
69
|
+
funcInfo = {
|
|
70
|
+
upper: funcInfo,
|
|
71
|
+
codePath,
|
|
72
|
+
hasReturn: !1,
|
|
73
|
+
hasReturnValue: !1,
|
|
74
|
+
messageId: "",
|
|
75
|
+
node,
|
|
76
|
+
currentSegments: /* @__PURE__ */ new Set()
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
onCodePathEnd() {
|
|
80
|
+
funcInfo = funcInfo.upper;
|
|
81
|
+
},
|
|
82
|
+
onUnreachableCodePathSegmentStart(segment) {
|
|
83
|
+
funcInfo.currentSegments.add(segment);
|
|
84
|
+
},
|
|
85
|
+
onUnreachableCodePathSegmentEnd(segment) {
|
|
86
|
+
funcInfo.currentSegments.delete(segment);
|
|
87
|
+
},
|
|
88
|
+
onCodePathSegmentStart(segment) {
|
|
89
|
+
funcInfo.currentSegments.add(segment);
|
|
90
|
+
},
|
|
91
|
+
onCodePathSegmentEnd(segment) {
|
|
92
|
+
funcInfo.currentSegments.delete(segment);
|
|
93
|
+
},
|
|
94
|
+
ReturnStatement(node) {
|
|
95
|
+
let argument = node.argument, hasReturnValue = !!argument;
|
|
96
|
+
treatUndefinedAsUnspecified && hasReturnValue && (hasReturnValue = !astUtils.isSpecificId(argument, "undefined") && argument.operator !== "void"), funcInfo.hasReturn ? funcInfo.hasReturnValue !== hasReturnValue && context.report({
|
|
97
|
+
node,
|
|
98
|
+
messageId: funcInfo.messageId,
|
|
99
|
+
data: funcInfo.data
|
|
100
|
+
}) : (funcInfo.hasReturn = !0, funcInfo.hasReturnValue = hasReturnValue, funcInfo.messageId = hasReturnValue ? "missingReturnValue" : "unexpectedReturnValue", funcInfo.data = { name: funcInfo.node.type === "Program" ? "Program" : upperCaseFirst(astUtils.getFunctionNameWithKind(funcInfo.node)) });
|
|
101
|
+
},
|
|
102
|
+
"Program:exit": checkLastSegment,
|
|
103
|
+
"FunctionDeclaration:exit": checkLastSegment,
|
|
104
|
+
"FunctionExpression:exit": checkLastSegment,
|
|
105
|
+
"ArrowFunctionExpression:exit": checkLastSegment
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}));
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src-js/generated/plugin-eslint/rules/consistent-return.cjs
|
|
112
|
+
module.exports = require_consistent_return().create;
|
|
113
|
+
//#endregion
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/consistent-this.js
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Rule to enforce consistent naming of "this" context variables
|
|
4
|
+
* @author Raphael Pigulla
|
|
5
|
+
*/
|
|
6
|
+
var require_consistent_this = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
|
|
7
|
+
/** @type {import('../types').Rule.RuleModule} */
|
|
8
|
+
module.exports = {
|
|
9
|
+
meta: {
|
|
10
|
+
type: "suggestion",
|
|
11
|
+
docs: {
|
|
12
|
+
description: "Enforce consistent naming when capturing the current execution context",
|
|
13
|
+
recommended: !1,
|
|
14
|
+
frozen: !0,
|
|
15
|
+
url: "https://eslint.org/docs/latest/rules/consistent-this"
|
|
16
|
+
},
|
|
17
|
+
schema: {
|
|
18
|
+
type: "array",
|
|
19
|
+
items: {
|
|
20
|
+
type: "string",
|
|
21
|
+
minLength: 1
|
|
22
|
+
},
|
|
23
|
+
uniqueItems: !0
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: ["that"],
|
|
26
|
+
messages: {
|
|
27
|
+
aliasNotAssignedToThis: "Designated alias '{{name}}' is not assigned to 'this'.",
|
|
28
|
+
unexpectedAlias: "Unexpected alias '{{name}}' for 'this'."
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
create(context) {
|
|
32
|
+
let aliases = context.options, sourceCode = context.sourceCode;
|
|
33
|
+
/**
|
|
34
|
+
* Reports that a variable declarator or assignment expression is assigning
|
|
35
|
+
* a non-'this' value to the specified alias.
|
|
36
|
+
* @param {ASTNode} node The assigning node.
|
|
37
|
+
* @param {string} name the name of the alias that was incorrectly used.
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
function reportBadAssignment(node, name) {
|
|
41
|
+
context.report({
|
|
42
|
+
node,
|
|
43
|
+
messageId: "aliasNotAssignedToThis",
|
|
44
|
+
data: { name }
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks that an assignment to an identifier only assigns 'this' to the
|
|
49
|
+
* appropriate alias, and the alias is only assigned to 'this'.
|
|
50
|
+
* @param {ASTNode} node The assigning node.
|
|
51
|
+
* @param {Identifier} name The name of the variable assigned to.
|
|
52
|
+
* @param {Expression} value The value of the assignment.
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
function checkAssignment(node, name, value) {
|
|
56
|
+
let isThis = value.type === "ThisExpression";
|
|
57
|
+
aliases.includes(name) ? (!isThis || node.operator && node.operator !== "=") && reportBadAssignment(node, name) : isThis && context.report({
|
|
58
|
+
node,
|
|
59
|
+
messageId: "unexpectedAlias",
|
|
60
|
+
data: { name }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Ensures that a variable declaration of the alias in a program or function
|
|
65
|
+
* is assigned to the correct value.
|
|
66
|
+
* @param {string} alias alias the check the assignment of.
|
|
67
|
+
* @param {Object} scope scope of the current code we are checking.
|
|
68
|
+
* @private
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
function checkWasAssigned(alias, scope) {
|
|
72
|
+
let variable = scope.set.get(alias);
|
|
73
|
+
variable && (variable.defs.some((def) => def.node.type === "VariableDeclarator" && def.node.init !== null) || variable.references.some((reference) => {
|
|
74
|
+
let write = reference.writeExpr;
|
|
75
|
+
return reference.from === scope && write && write.type === "ThisExpression" && write.parent.operator === "=";
|
|
76
|
+
}) || variable.defs.map((def) => def.node).forEach((node) => {
|
|
77
|
+
reportBadAssignment(node, alias);
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check each alias to ensure that is was assigned to the correct value.
|
|
82
|
+
* @param {ASTNode} node The node that represents the scope to check.
|
|
83
|
+
* @returns {void}
|
|
84
|
+
*/
|
|
85
|
+
function ensureWasAssigned(node) {
|
|
86
|
+
let scope = sourceCode.getScope(node), extraScope = node.type === "Program" && node.sourceType === "module" ? scope.childScopes[0] : null;
|
|
87
|
+
aliases.forEach((alias) => {
|
|
88
|
+
checkWasAssigned(alias, scope), extraScope && checkWasAssigned(alias, extraScope);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
"Program:exit": ensureWasAssigned,
|
|
93
|
+
"FunctionExpression:exit": ensureWasAssigned,
|
|
94
|
+
"FunctionDeclaration:exit": ensureWasAssigned,
|
|
95
|
+
VariableDeclarator(node) {
|
|
96
|
+
let id = node.id, isDestructuring = id.type === "ArrayPattern" || id.type === "ObjectPattern";
|
|
97
|
+
node.init !== null && !isDestructuring && checkAssignment(node, id.name, node.init);
|
|
98
|
+
},
|
|
99
|
+
AssignmentExpression(node) {
|
|
100
|
+
node.left.type === "Identifier" && checkAssignment(node, node.left.name, node.right);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}));
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src-js/generated/plugin-eslint/rules/consistent-this.cjs
|
|
108
|
+
module.exports = require_consistent_this().create;
|
|
109
|
+
//#endregion
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/constructor-super.js
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview A rule to verify `super()` callings in constructor.
|
|
4
|
+
* @author Toru Nagashima
|
|
5
|
+
*/
|
|
6
|
+
var require_constructor_super = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether or not a given node is a constructor.
|
|
9
|
+
* @param {ASTNode} node A node to check. This node type is one of
|
|
10
|
+
* `Program`, `FunctionDeclaration`, `FunctionExpression`, and
|
|
11
|
+
* `ArrowFunctionExpression`.
|
|
12
|
+
* @returns {boolean} `true` if the node is a constructor.
|
|
13
|
+
*/
|
|
14
|
+
function isConstructorFunction(node) {
|
|
15
|
+
return node.type === "FunctionExpression" && node.parent.type === "MethodDefinition" && node.parent.kind === "constructor";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks whether a given node can be a constructor or not.
|
|
19
|
+
* @param {ASTNode} node A node to check.
|
|
20
|
+
* @returns {boolean} `true` if the node can be a constructor.
|
|
21
|
+
*/
|
|
22
|
+
function isPossibleConstructor(node) {
|
|
23
|
+
if (!node) return !1;
|
|
24
|
+
switch (node.type) {
|
|
25
|
+
case "ClassExpression":
|
|
26
|
+
case "FunctionExpression":
|
|
27
|
+
case "ThisExpression":
|
|
28
|
+
case "MemberExpression":
|
|
29
|
+
case "CallExpression":
|
|
30
|
+
case "NewExpression":
|
|
31
|
+
case "ChainExpression":
|
|
32
|
+
case "YieldExpression":
|
|
33
|
+
case "TaggedTemplateExpression":
|
|
34
|
+
case "MetaProperty": return !0;
|
|
35
|
+
case "Identifier": return node.name !== "undefined";
|
|
36
|
+
case "AssignmentExpression":
|
|
37
|
+
/**
|
|
38
|
+
* All other assignment operators are mathematical assignment operators (arithmetic or bitwise).
|
|
39
|
+
* An assignment expression with a mathematical operator can either evaluate to a primitive value,
|
|
40
|
+
* or throw, depending on the operands. Thus, it cannot evaluate to a constructor function.
|
|
41
|
+
*/
|
|
42
|
+
return ["=", "&&="].includes(node.operator) ? isPossibleConstructor(node.right) : ["||=", "??="].includes(node.operator) ? isPossibleConstructor(node.left) || isPossibleConstructor(node.right) : !1;
|
|
43
|
+
case "LogicalExpression": return node.operator === "&&" ? isPossibleConstructor(node.right) : isPossibleConstructor(node.left) || isPossibleConstructor(node.right);
|
|
44
|
+
case "ConditionalExpression": return isPossibleConstructor(node.alternate) || isPossibleConstructor(node.consequent);
|
|
45
|
+
case "SequenceExpression": return isPossibleConstructor(node.expressions.at(-1));
|
|
46
|
+
default: return !1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A class to store information about a code path segment.
|
|
51
|
+
*/
|
|
52
|
+
var SegmentInfo = class {
|
|
53
|
+
/**
|
|
54
|
+
* Indicates if super() is called in all code paths.
|
|
55
|
+
* @type {boolean}
|
|
56
|
+
*/
|
|
57
|
+
calledInEveryPaths = !1;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates if super() is called in any code paths.
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
*/
|
|
62
|
+
calledInSomePaths = !1;
|
|
63
|
+
/**
|
|
64
|
+
* The nodes which have been validated and don't need to be reconsidered.
|
|
65
|
+
* @type {ASTNode[]}
|
|
66
|
+
*/
|
|
67
|
+
validNodes = [];
|
|
68
|
+
};
|
|
69
|
+
/** @type {import('../types').Rule.RuleModule} */
|
|
70
|
+
module.exports = {
|
|
71
|
+
meta: {
|
|
72
|
+
type: "problem",
|
|
73
|
+
docs: {
|
|
74
|
+
description: "Require `super()` calls in constructors",
|
|
75
|
+
recommended: !0,
|
|
76
|
+
url: "https://eslint.org/docs/latest/rules/constructor-super"
|
|
77
|
+
},
|
|
78
|
+
schema: [],
|
|
79
|
+
messages: {
|
|
80
|
+
missingSome: "Lacked a call of 'super()' in some code paths.",
|
|
81
|
+
missingAll: "Expected to call 'super()'.",
|
|
82
|
+
duplicate: "Unexpected duplicate 'super()'.",
|
|
83
|
+
badSuper: "Unexpected 'super()' because 'super' is not a constructor."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
create(context) {
|
|
87
|
+
let funcInfo = null, segInfoMap = Object.create(null);
|
|
88
|
+
/**
|
|
89
|
+
* Gets the flag which shows `super()` is called in some paths.
|
|
90
|
+
* @param {CodePathSegment} segment A code path segment to get.
|
|
91
|
+
* @returns {boolean} The flag which shows `super()` is called in some paths
|
|
92
|
+
*/
|
|
93
|
+
function isCalledInSomePath(segment) {
|
|
94
|
+
return segment.reachable && segInfoMap[segment.id].calledInSomePaths;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Determines if a segment has been seen in the traversal.
|
|
98
|
+
* @param {CodePathSegment} segment A code path segment to check.
|
|
99
|
+
* @returns {boolean} `true` if the segment has been seen.
|
|
100
|
+
*/
|
|
101
|
+
function hasSegmentBeenSeen(segment) {
|
|
102
|
+
return !!segInfoMap[segment.id];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the flag which shows `super()` is called in all paths.
|
|
106
|
+
* @param {CodePathSegment} segment A code path segment to get.
|
|
107
|
+
* @returns {boolean} The flag which shows `super()` is called in all paths.
|
|
108
|
+
*/
|
|
109
|
+
function isCalledInEveryPath(segment) {
|
|
110
|
+
return segment.reachable && segInfoMap[segment.id].calledInEveryPaths;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
onCodePathStart(codePath, node) {
|
|
114
|
+
if (isConstructorFunction(node)) {
|
|
115
|
+
let superClass = node.parent.parent.parent.superClass;
|
|
116
|
+
funcInfo = {
|
|
117
|
+
upper: funcInfo,
|
|
118
|
+
isConstructor: !0,
|
|
119
|
+
hasExtends: !!superClass,
|
|
120
|
+
superIsConstructor: isPossibleConstructor(superClass),
|
|
121
|
+
codePath,
|
|
122
|
+
currentSegments: /* @__PURE__ */ new Set()
|
|
123
|
+
};
|
|
124
|
+
} else funcInfo = {
|
|
125
|
+
upper: funcInfo,
|
|
126
|
+
isConstructor: !1,
|
|
127
|
+
hasExtends: !1,
|
|
128
|
+
superIsConstructor: !1,
|
|
129
|
+
codePath,
|
|
130
|
+
currentSegments: /* @__PURE__ */ new Set()
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
onCodePathEnd(codePath, node) {
|
|
134
|
+
let hasExtends = funcInfo.hasExtends;
|
|
135
|
+
if (funcInfo = funcInfo.upper, !hasExtends) return;
|
|
136
|
+
let returnedSegments = codePath.returnedSegments, calledInEveryPaths = returnedSegments.every(isCalledInEveryPath), calledInSomePaths = returnedSegments.some(isCalledInSomePath);
|
|
137
|
+
calledInEveryPaths || context.report({
|
|
138
|
+
messageId: calledInSomePaths ? "missingSome" : "missingAll",
|
|
139
|
+
node: node.parent
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
onCodePathSegmentStart(segment, node) {
|
|
143
|
+
if (funcInfo.currentSegments.add(segment), !(funcInfo.isConstructor && funcInfo.hasExtends)) return;
|
|
144
|
+
let info = segInfoMap[segment.id] = new SegmentInfo(), seenPrevSegments = segment.prevSegments.filter(hasSegmentBeenSeen);
|
|
145
|
+
seenPrevSegments.length > 0 && (info.calledInSomePaths = seenPrevSegments.some(isCalledInSomePath), info.calledInEveryPaths = seenPrevSegments.every(isCalledInEveryPath)), node.parent && node.parent.type === "ForStatement" && node.parent.update === node && (info.calledInEveryPaths = !0);
|
|
146
|
+
},
|
|
147
|
+
onUnreachableCodePathSegmentStart(segment) {
|
|
148
|
+
funcInfo.currentSegments.add(segment);
|
|
149
|
+
},
|
|
150
|
+
onUnreachableCodePathSegmentEnd(segment) {
|
|
151
|
+
funcInfo.currentSegments.delete(segment);
|
|
152
|
+
},
|
|
153
|
+
onCodePathSegmentEnd(segment) {
|
|
154
|
+
funcInfo.currentSegments.delete(segment);
|
|
155
|
+
},
|
|
156
|
+
onCodePathSegmentLoop(fromSegment, toSegment) {
|
|
157
|
+
funcInfo.isConstructor && funcInfo.hasExtends && funcInfo.codePath.traverseSegments({
|
|
158
|
+
first: toSegment,
|
|
159
|
+
last: fromSegment
|
|
160
|
+
}, (segment, controller) => {
|
|
161
|
+
let info = segInfoMap[segment.id];
|
|
162
|
+
if (!info) {
|
|
163
|
+
controller.skip();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
let seenPrevSegments = segment.prevSegments.filter(hasSegmentBeenSeen), calledInSomePreviousPaths = seenPrevSegments.some(isCalledInSomePath), calledInEveryPreviousPaths = seenPrevSegments.every(isCalledInEveryPath);
|
|
167
|
+
if (info.calledInSomePaths ||= calledInSomePreviousPaths, info.calledInEveryPaths ||= calledInEveryPreviousPaths, calledInSomePreviousPaths) {
|
|
168
|
+
let nodes = info.validNodes;
|
|
169
|
+
info.validNodes = [];
|
|
170
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
171
|
+
let node = nodes[i];
|
|
172
|
+
context.report({
|
|
173
|
+
messageId: "duplicate",
|
|
174
|
+
node
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
"CallExpression:exit"(node) {
|
|
181
|
+
if (!(funcInfo.isConstructor && funcInfo.hasExtends) || node.callee.type !== "Super") return;
|
|
182
|
+
let segments = funcInfo.currentSegments, duplicate = !1, info = null;
|
|
183
|
+
for (let segment of segments) segment.reachable && (info = segInfoMap[segment.id], duplicate ||= info.calledInSomePaths, info.calledInSomePaths = info.calledInEveryPaths = !0);
|
|
184
|
+
info && (duplicate ? context.report({
|
|
185
|
+
messageId: "duplicate",
|
|
186
|
+
node
|
|
187
|
+
}) : funcInfo.superIsConstructor ? info.validNodes.push(node) : context.report({
|
|
188
|
+
messageId: "badSuper",
|
|
189
|
+
node
|
|
190
|
+
}));
|
|
191
|
+
},
|
|
192
|
+
ReturnStatement(node) {
|
|
193
|
+
if (!(funcInfo.isConstructor && funcInfo.hasExtends) || !node.argument) return;
|
|
194
|
+
let segments = funcInfo.currentSegments;
|
|
195
|
+
for (let segment of segments) if (segment.reachable) {
|
|
196
|
+
let info = segInfoMap[segment.id];
|
|
197
|
+
info.calledInSomePaths = info.calledInEveryPaths = !0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}));
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src-js/generated/plugin-eslint/rules/constructor-super.cjs
|
|
206
|
+
module.exports = require_constructor_super().create;
|
|
207
|
+
//#endregion
|