@so1ve/eslint-plugin 0.119.3 → 0.120.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/dist/index.cjs +12 -15
- package/dist/index.mjs +12 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -157,21 +157,18 @@ const functionStyle = createEslintRule({
|
|
|
157
157
|
if (body.type === types.AST_NODE_TYPES.BlockStatement) {
|
|
158
158
|
const { body: blockBody } = body;
|
|
159
159
|
if (blockBody.length > 0 && node.parent?.parent?.type === types.AST_NODE_TYPES.VariableDeclaration) {
|
|
160
|
-
const { parent:
|
|
160
|
+
const { parent: grandParent } = node.parent;
|
|
161
161
|
context.report({
|
|
162
|
-
node:
|
|
162
|
+
node: grandParent,
|
|
163
163
|
messageId: "declaration",
|
|
164
|
-
fix: (fixer) =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
)
|
|
173
|
-
);
|
|
174
|
-
}
|
|
164
|
+
fix: (fixer) => fixer.replaceTextRange(
|
|
165
|
+
grandParent.range,
|
|
166
|
+
generateFunction(
|
|
167
|
+
"declaration",
|
|
168
|
+
node.parent.id.name,
|
|
169
|
+
node
|
|
170
|
+
)
|
|
171
|
+
)
|
|
175
172
|
});
|
|
176
173
|
}
|
|
177
174
|
}
|
|
@@ -323,7 +320,7 @@ const noInlineTypeImport = createEslintRule({
|
|
|
323
320
|
);
|
|
324
321
|
if (typeSpecifiers.length > 0 && valueSpecifiers.length > 0) {
|
|
325
322
|
context.report({
|
|
326
|
-
|
|
323
|
+
node,
|
|
327
324
|
messageId: "noInlineTypeImport",
|
|
328
325
|
fix(fixer) {
|
|
329
326
|
const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
|
|
@@ -341,7 +338,7 @@ const noInlineTypeImport = createEslintRule({
|
|
|
341
338
|
});
|
|
342
339
|
} else if (typeSpecifiers.length > 0) {
|
|
343
340
|
context.report({
|
|
344
|
-
|
|
341
|
+
node,
|
|
345
342
|
messageId: "noInlineTypeImport",
|
|
346
343
|
fix(fixer) {
|
|
347
344
|
const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
|
package/dist/index.mjs
CHANGED
|
@@ -155,21 +155,18 @@ const functionStyle = createEslintRule({
|
|
|
155
155
|
if (body.type === AST_NODE_TYPES.BlockStatement) {
|
|
156
156
|
const { body: blockBody } = body;
|
|
157
157
|
if (blockBody.length > 0 && node.parent?.parent?.type === AST_NODE_TYPES.VariableDeclaration) {
|
|
158
|
-
const { parent:
|
|
158
|
+
const { parent: grandParent } = node.parent;
|
|
159
159
|
context.report({
|
|
160
|
-
node:
|
|
160
|
+
node: grandParent,
|
|
161
161
|
messageId: "declaration",
|
|
162
|
-
fix: (fixer) =>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
162
|
+
fix: (fixer) => fixer.replaceTextRange(
|
|
163
|
+
grandParent.range,
|
|
164
|
+
generateFunction(
|
|
165
|
+
"declaration",
|
|
166
|
+
node.parent.id.name,
|
|
167
|
+
node
|
|
168
|
+
)
|
|
169
|
+
)
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
}
|
|
@@ -321,7 +318,7 @@ const noInlineTypeImport = createEslintRule({
|
|
|
321
318
|
);
|
|
322
319
|
if (typeSpecifiers.length > 0 && valueSpecifiers.length > 0) {
|
|
323
320
|
context.report({
|
|
324
|
-
|
|
321
|
+
node,
|
|
325
322
|
messageId: "noInlineTypeImport",
|
|
326
323
|
fix(fixer) {
|
|
327
324
|
const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
|
|
@@ -339,7 +336,7 @@ const noInlineTypeImport = createEslintRule({
|
|
|
339
336
|
});
|
|
340
337
|
} else if (typeSpecifiers.length > 0) {
|
|
341
338
|
context.report({
|
|
342
|
-
|
|
339
|
+
node,
|
|
343
340
|
messageId: "noInlineTypeImport",
|
|
344
341
|
fix(fixer) {
|
|
345
342
|
const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
|