@so1ve/eslint-plugin 0.119.0 → 0.119.2

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 CHANGED
@@ -217,12 +217,13 @@ const importDedupe = createEslintRule({
217
217
  },
218
218
  messageId: "importDedupe",
219
219
  fix(fixer) {
220
- const s = n.range[0];
221
- let e = n.range[1];
222
- if (context.getSourceCode().text[e] === ",") {
223
- e += 1;
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([s, e]);
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 functionNodeScopeStack = [];
508
+ const functionNodeStack = [];
508
509
  function setupNode(node) {
509
- functionNodeScopeStack.push(node);
510
+ functionNodeStack.push(node);
510
511
  }
511
512
  function clearNode() {
512
- functionNodeScopeStack.pop();
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 = functionNodeScopeStack[functionNodeScopeStack.length - 1];
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 s = n.range[0];
219
- let e = n.range[1];
220
- if (context.getSourceCode().text[e] === ",") {
221
- e += 1;
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([s, e]);
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 functionNodeScopeStack = [];
506
+ const functionNodeStack = [];
506
507
  function setupNode(node) {
507
- functionNodeScopeStack.push(node);
508
+ functionNodeStack.push(node);
508
509
  }
509
510
  function clearNode() {
510
- functionNodeScopeStack.pop();
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 = functionNodeScopeStack[functionNodeScopeStack.length - 1];
521
+ const closestFunctionNode = functionNodeStack[functionNodeStack.length - 1];
521
522
  if (!closestFunctionNode || closestFunctionNode.async) {
522
523
  return;
523
524
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.119.0",
3
+ "version": "0.119.2",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "keywords": [
6
6
  "eslint",