@so1ve/eslint-plugin 0.119.3 → 0.120.1

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
@@ -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: parent2 } = node.parent;
160
+ const { parent: grandParent } = node.parent;
161
161
  context.report({
162
- node: parent2,
162
+ node: grandParent,
163
163
  messageId: "declaration",
164
- fix: (fixer) => {
165
- const [start, end] = parent2.range;
166
- return fixer.replaceTextRange(
167
- [start, end],
168
- generateFunction(
169
- "declaration",
170
- node.parent.id.name,
171
- node
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
- loc: node.loc,
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
- loc: node.loc,
341
+ node,
345
342
  messageId: "noInlineTypeImport",
346
343
  fix(fixer) {
347
344
  const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ rules: {
3
+ "function-style": any;
4
+ "import-dedupe": any;
5
+ "no-inline-type-import": any;
6
+ "no-negated-comparison": any;
7
+ "no-useless-template-string": any;
8
+ "no-import-promises-as": any;
9
+ "pad-after-last-import": any;
10
+ "use-async-with-await": any;
11
+ };
12
+ };
13
+
14
+ export { _default as default };
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ rules: {
3
+ "function-style": any;
4
+ "import-dedupe": any;
5
+ "no-inline-type-import": any;
6
+ "no-negated-comparison": any;
7
+ "no-useless-template-string": any;
8
+ "no-import-promises-as": any;
9
+ "pad-after-last-import": any;
10
+ "use-async-with-await": any;
11
+ };
12
+ };
13
+
14
+ export { _default as default };
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: parent2 } = node.parent;
158
+ const { parent: grandParent } = node.parent;
159
159
  context.report({
160
- node: parent2,
160
+ node: grandParent,
161
161
  messageId: "declaration",
162
- fix: (fixer) => {
163
- const [start, end] = parent2.range;
164
- return fixer.replaceTextRange(
165
- [start, end],
166
- generateFunction(
167
- "declaration",
168
- node.parent.id.name,
169
- node
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
- loc: node.loc,
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
- loc: node.loc,
339
+ node,
343
340
  messageId: "noInlineTypeImport",
344
341
  fix(fixer) {
345
342
  const typeSpecifiersText = typeSpecifiers.map((s) => sourceCode.getText(s).replace("type ", "")).join(", ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.119.3",
3
+ "version": "0.120.1",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "keywords": [
6
6
  "eslint",