@so1ve/eslint-plugin 0.119.1 → 0.119.3
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 +10 -9
- package/dist/index.mjs +10 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -217,12 +217,13 @@ const importDedupe = createEslintRule({
|
|
|
217
217
|
},
|
|
218
218
|
messageId: "importDedupe",
|
|
219
219
|
fix(fixer) {
|
|
220
|
-
const
|
|
221
|
-
let
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
const start = n.range[0];
|
|
221
|
+
let end = n.range[1];
|
|
222
|
+
const nextToken = context.getSourceCode().getTokenAfter(n);
|
|
223
|
+
if (nextToken && nextToken.value === ",") {
|
|
224
|
+
end = nextToken.range[1];
|
|
224
225
|
}
|
|
225
|
-
return fixer.removeRange([
|
|
226
|
+
return fixer.removeRange([start, end]);
|
|
226
227
|
}
|
|
227
228
|
});
|
|
228
229
|
}
|
|
@@ -504,12 +505,12 @@ const useAsyncWithAwait = createEslintRule({
|
|
|
504
505
|
},
|
|
505
506
|
defaultOptions: [],
|
|
506
507
|
create: (context) => {
|
|
507
|
-
const
|
|
508
|
+
const functionNodeStack = [];
|
|
508
509
|
function setupNode(node) {
|
|
509
|
-
|
|
510
|
+
functionNodeStack.push(node);
|
|
510
511
|
}
|
|
511
512
|
function clearNode() {
|
|
512
|
-
|
|
513
|
+
functionNodeStack.pop();
|
|
513
514
|
}
|
|
514
515
|
return {
|
|
515
516
|
"FunctionExpression": setupNode,
|
|
@@ -519,7 +520,7 @@ const useAsyncWithAwait = createEslintRule({
|
|
|
519
520
|
"ArrowFunctionExpression": setupNode,
|
|
520
521
|
"ArrowFunctionExpression:exit": clearNode,
|
|
521
522
|
AwaitExpression() {
|
|
522
|
-
const closestFunctionNode =
|
|
523
|
+
const closestFunctionNode = functionNodeStack[functionNodeStack.length - 1];
|
|
523
524
|
if (!closestFunctionNode || closestFunctionNode.async) {
|
|
524
525
|
return;
|
|
525
526
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -215,12 +215,13 @@ const importDedupe = createEslintRule({
|
|
|
215
215
|
},
|
|
216
216
|
messageId: "importDedupe",
|
|
217
217
|
fix(fixer) {
|
|
218
|
-
const
|
|
219
|
-
let
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
const start = n.range[0];
|
|
219
|
+
let end = n.range[1];
|
|
220
|
+
const nextToken = context.getSourceCode().getTokenAfter(n);
|
|
221
|
+
if (nextToken && nextToken.value === ",") {
|
|
222
|
+
end = nextToken.range[1];
|
|
222
223
|
}
|
|
223
|
-
return fixer.removeRange([
|
|
224
|
+
return fixer.removeRange([start, end]);
|
|
224
225
|
}
|
|
225
226
|
});
|
|
226
227
|
}
|
|
@@ -502,12 +503,12 @@ const useAsyncWithAwait = createEslintRule({
|
|
|
502
503
|
},
|
|
503
504
|
defaultOptions: [],
|
|
504
505
|
create: (context) => {
|
|
505
|
-
const
|
|
506
|
+
const functionNodeStack = [];
|
|
506
507
|
function setupNode(node) {
|
|
507
|
-
|
|
508
|
+
functionNodeStack.push(node);
|
|
508
509
|
}
|
|
509
510
|
function clearNode() {
|
|
510
|
-
|
|
511
|
+
functionNodeStack.pop();
|
|
511
512
|
}
|
|
512
513
|
return {
|
|
513
514
|
"FunctionExpression": setupNode,
|
|
@@ -517,7 +518,7 @@ const useAsyncWithAwait = createEslintRule({
|
|
|
517
518
|
"ArrowFunctionExpression": setupNode,
|
|
518
519
|
"ArrowFunctionExpression:exit": clearNode,
|
|
519
520
|
AwaitExpression() {
|
|
520
|
-
const closestFunctionNode =
|
|
521
|
+
const closestFunctionNode = functionNodeStack[functionNodeStack.length - 1];
|
|
521
522
|
if (!closestFunctionNode || closestFunctionNode.async) {
|
|
522
523
|
return;
|
|
523
524
|
}
|