@so1ve/eslint-plugin 3.19.0 → 3.20.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.d.ts CHANGED
@@ -1,27 +1,62 @@
1
- import * as _typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
1
+ import { ESLintUtils } from "@typescript-eslint/utils";
2
2
 
3
3
  //#region src/rules/function-style.d.ts
4
- type MessageIds = "arrow" | "declaration";
4
+ type MessageIds$9 = "arrow" | "declaration";
5
+ declare const rule: ESLintUtils.RuleModule<MessageIds$9>;
6
+ //#endregion
7
+ //#region src/rules/import-dedupe.d.ts
8
+ type MessageIds$8 = "importDedupe";
9
+ declare const rule$1: ESLintUtils.RuleModule<MessageIds$8>;
10
+ //#endregion
11
+ //#region src/rules/no-import-promises-as.d.ts
12
+ type MessageIds$7 = "noImportPromisesAs";
13
+ declare const rule$2: ESLintUtils.RuleModule<MessageIds$7>;
14
+ //#endregion
15
+ //#region src/rules/no-inline-type-import.d.ts
16
+ type MessageIds$6 = "noInlineTypeImport";
17
+ declare const rule$3: ESLintUtils.RuleModule<MessageIds$6>;
18
+ //#endregion
19
+ //#region src/rules/no-negated-comparison.d.ts
20
+ type MessageIds$5 = "noNegatedComparison";
21
+ declare const rule$4: ESLintUtils.RuleModule<MessageIds$5>;
22
+ //#endregion
23
+ //#region src/rules/no-useless-template-string.d.ts
24
+ type MessageIds$4 = "noUselessTemplateString";
25
+ declare const rule$5: ESLintUtils.RuleModule<MessageIds$4>;
26
+ //#endregion
27
+ //#region src/rules/pad-after-last-import.d.ts
28
+ type MessageIds$3 = "padAfterLastImport";
29
+ declare const rule$6: ESLintUtils.RuleModule<MessageIds$3>;
30
+ //#endregion
31
+ //#region src/rules/prefer-ts-expect-error.d.ts
32
+ type MessageIds$2 = "preferExpectErrorComment";
33
+ declare const rule$7: ESLintUtils.RuleModule<MessageIds$2>;
34
+ //#endregion
35
+ //#region src/rules/require-async-with-await.d.ts
36
+ type MessageIds$1 = "requireAsyncWithAwait";
37
+ declare const rule$8: ESLintUtils.RuleModule<MessageIds$1>;
5
38
  //#endregion
6
39
  //#region src/rules/vue-root-element-sort-attributes.d.ts
40
+ type MessageIds = "wrongOrder";
7
41
  type Options = [{
8
42
  script?: string[];
9
43
  [otherElement: string]: string[] | undefined;
10
44
  }];
45
+ declare const rule$9: ESLintUtils.RuleModule<MessageIds, Options>;
11
46
  //#endregion
12
47
  //#region src/index.d.ts
13
48
  declare const _default: {
14
49
  rules: {
15
- "function-style": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
16
- "import-dedupe": _typescript_eslint_utils_ts_eslint0.RuleModule<"importDedupe", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
17
- "no-import-promises-as": _typescript_eslint_utils_ts_eslint0.RuleModule<"noImportPromisesAs", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
18
- "no-inline-type-import": _typescript_eslint_utils_ts_eslint0.RuleModule<"noInlineTypeImport", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
19
- "no-negated-comparison": _typescript_eslint_utils_ts_eslint0.RuleModule<"noNegatedComparison", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
20
- "no-useless-template-string": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUselessTemplateString", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
21
- "pad-after-last-import": _typescript_eslint_utils_ts_eslint0.RuleModule<"padAfterLastImport", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
22
- "prefer-ts-expect-error": _typescript_eslint_utils_ts_eslint0.RuleModule<"preferExpectErrorComment", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
23
- "require-async-with-await": _typescript_eslint_utils_ts_eslint0.RuleModule<"requireAsyncWithAwait", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
24
- "vue-root-element-sort-attributes": _typescript_eslint_utils_ts_eslint0.RuleModule<"wrongOrder", Options, unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
50
+ "function-style": typeof rule;
51
+ "import-dedupe": typeof rule$1;
52
+ "no-import-promises-as": typeof rule$2;
53
+ "no-inline-type-import": typeof rule$3;
54
+ "no-negated-comparison": typeof rule$4;
55
+ "no-useless-template-string": typeof rule$5;
56
+ "pad-after-last-import": typeof rule$6;
57
+ "prefer-ts-expect-error": typeof rule$7;
58
+ "require-async-with-await": typeof rule$8;
59
+ "vue-root-element-sort-attributes": typeof rule$9;
25
60
  };
26
61
  };
27
62
  //#endregion
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ function getPreviousNode(node) {
17
17
  //#endregion
18
18
  //#region src/rules/function-style.ts
19
19
  const RULE_NAME$8 = "function-style";
20
- var function_style_default = createEslintRule({
20
+ const rule$9 = createEslintRule({
21
21
  name: RULE_NAME$8,
22
22
  meta: {
23
23
  type: "problem",
@@ -153,11 +153,12 @@ var function_style_default = createEslintRule({
153
153
  };
154
154
  }
155
155
  });
156
+ var function_style_default = rule$9;
156
157
 
157
158
  //#endregion
158
159
  //#region src/rules/import-dedupe.ts
159
160
  const RULE_NAME$7 = "import-dedupe";
160
- var import_dedupe_default = createEslintRule({
161
+ const rule$8 = createEslintRule({
161
162
  name: RULE_NAME$7,
162
163
  meta: {
163
164
  type: "problem",
@@ -191,6 +192,7 @@ var import_dedupe_default = createEslintRule({
191
192
  }
192
193
  } })
193
194
  });
195
+ var import_dedupe_default = rule$8;
194
196
 
195
197
  //#endregion
196
198
  //#region src/rules/no-import-promises-as.ts
@@ -201,7 +203,7 @@ const POSSIBLE_IMPORT_SOURCES = [
201
203
  "readline",
202
204
  "stream"
203
205
  ].flatMap((s) => [s, `node:${s}`]);
204
- var no_import_promises_as_default = createEslintRule({
206
+ const rule$7 = createEslintRule({
205
207
  name: RULE_NAME$6,
206
208
  meta: {
207
209
  type: "problem",
@@ -232,11 +234,12 @@ var no_import_promises_as_default = createEslintRule({
232
234
  } };
233
235
  }
234
236
  });
237
+ var no_import_promises_as_default = rule$7;
235
238
 
236
239
  //#endregion
237
240
  //#region src/rules/no-inline-type-import.ts
238
241
  const RULE_NAME$5 = "no-inline-type-import";
239
- var no_inline_type_import_default = createEslintRule({
242
+ const rule$6 = createEslintRule({
240
243
  name: RULE_NAME$5,
241
244
  meta: {
242
245
  type: "layout",
@@ -255,8 +258,20 @@ var no_inline_type_import_default = createEslintRule({
255
258
  node,
256
259
  messageId: "noInlineTypeImport",
257
260
  fix(fixer) {
258
- const typeSpecifiersText = typeSpecifiers.map((s) => s.local.name).join(", ");
259
- const valueSpecifiersText = valueSpecifiers.map((s) => s.local.name).join(", ");
261
+ const typeSpecifiersText = typeSpecifiers.map((s) => {
262
+ if (s.type === AST_NODE_TYPES.ImportSpecifier) {
263
+ const importedName = s.imported.type === AST_NODE_TYPES.Identifier ? s.imported.name : s.imported.value;
264
+ return importedName === s.local.name ? s.local.name : `${importedName} as ${s.local.name}`;
265
+ }
266
+ return s.local.name;
267
+ }).join(", ");
268
+ const valueSpecifiersText = valueSpecifiers.map((s) => {
269
+ if (s.type === AST_NODE_TYPES.ImportSpecifier) {
270
+ const importedName = s.imported.type === AST_NODE_TYPES.Identifier ? s.imported.name : s.imported.value;
271
+ return importedName === s.local.name ? s.local.name : `${importedName} as ${s.local.name}`;
272
+ }
273
+ return s.local.name;
274
+ }).join(", ");
260
275
  const defaultImportSpecifierText = defaultImportSpecifier?.local.name;
261
276
  const defaultAndValueSpecifiersText = defaultImportSpecifier ? `import ${defaultImportSpecifierText}, { ${valueSpecifiersText} } from "${node.source.value}";` : `import { ${valueSpecifiersText} } from "${node.source.value}";`;
262
277
  const texts = [`import type { ${typeSpecifiersText} } from "${node.source.value}";`, defaultAndValueSpecifiersText];
@@ -267,12 +282,19 @@ var no_inline_type_import_default = createEslintRule({
267
282
  node,
268
283
  messageId: "noInlineTypeImport",
269
284
  fix(fixer) {
270
- const typeSpecifiersText = typeSpecifiers.map((s) => s.local.name).join(", ");
285
+ const typeSpecifiersText = typeSpecifiers.map((s) => {
286
+ if (s.type === AST_NODE_TYPES.ImportSpecifier) {
287
+ const importedName = s.imported.type === AST_NODE_TYPES.Identifier ? s.imported.name : s.imported.value;
288
+ return importedName === s.local.name ? s.local.name : `${importedName} as ${s.local.name}`;
289
+ }
290
+ return s.local.name;
291
+ }).join(", ");
271
292
  return fixer.replaceText(node, `import type { ${typeSpecifiersText} } from "${node.source.value}";`);
272
293
  }
273
294
  });
274
295
  } })
275
296
  });
297
+ var no_inline_type_import_default = rule$6;
276
298
 
277
299
  //#endregion
278
300
  //#region src/rules/no-negated-comparison.ts
@@ -288,7 +310,7 @@ const negatedToPositive = {
288
310
  ">=": "<"
289
311
  };
290
312
  const negatives = Object.keys(negatedToPositive);
291
- var no_negated_comparison_default = createEslintRule({
313
+ const rule$5 = createEslintRule({
292
314
  name: RULE_NAME$4,
293
315
  meta: {
294
316
  type: "problem",
@@ -313,11 +335,12 @@ var no_negated_comparison_default = createEslintRule({
313
335
  });
314
336
  } })
315
337
  });
338
+ var no_negated_comparison_default = rule$5;
316
339
 
317
340
  //#endregion
318
341
  //#region src/rules/no-useless-template-string.ts
319
342
  const RULE_NAME$3 = "no-useless-template-string";
320
- var no_useless_template_string_default = createEslintRule({
343
+ const rule$4 = createEslintRule({
321
344
  name: RULE_NAME$3,
322
345
  meta: {
323
346
  type: "problem",
@@ -339,11 +362,12 @@ var no_useless_template_string_default = createEslintRule({
339
362
  });
340
363
  } })
341
364
  });
365
+ var no_useless_template_string_default = rule$4;
342
366
 
343
367
  //#endregion
344
368
  //#region src/rules/pad-after-last-import.ts
345
369
  const RULE_NAME$2 = "pad-after-last-import";
346
- var pad_after_last_import_default = createEslintRule({
370
+ const rule$3 = createEslintRule({
347
371
  name: RULE_NAME$2,
348
372
  meta: {
349
373
  type: "problem",
@@ -376,10 +400,11 @@ var pad_after_last_import_default = createEslintRule({
376
400
  };
377
401
  }
378
402
  });
403
+ var pad_after_last_import_default = rule$3;
379
404
 
380
405
  //#endregion
381
406
  //#region src/rules/prefer-ts-expect-error.ts
382
- var prefer_ts_expect_error_default = createEslintRule({
407
+ const rule$2 = createEslintRule({
383
408
  name: "prefer-ts-expect-error",
384
409
  meta: {
385
410
  type: "problem",
@@ -417,11 +442,12 @@ var prefer_ts_expect_error_default = createEslintRule({
417
442
  } };
418
443
  }
419
444
  });
445
+ var prefer_ts_expect_error_default = rule$2;
420
446
 
421
447
  //#endregion
422
448
  //#region src/rules/require-async-with-await.ts
423
449
  const RULE_NAME$1 = "require-async-with-await";
424
- var require_async_with_await_default = createEslintRule({
450
+ const rule$1 = createEslintRule({
425
451
  name: RULE_NAME$1,
426
452
  meta: {
427
453
  type: "problem",
@@ -463,12 +489,13 @@ var require_async_with_await_default = createEslintRule({
463
489
  };
464
490
  }
465
491
  });
492
+ var require_async_with_await_default = rule$1;
466
493
 
467
494
  //#endregion
468
495
  //#region src/rules/vue-root-element-sort-attributes.ts
469
496
  const RULE_NAME = "vue-root-element-sort-attributes";
470
497
  const defaultOptions = { script: ["setup", "lang"] };
471
- var vue_root_element_sort_attributes_default = createEslintRule({
498
+ const rule = createEslintRule({
472
499
  name: RULE_NAME,
473
500
  meta: {
474
501
  type: "layout",
@@ -525,6 +552,7 @@ var vue_root_element_sort_attributes_default = createEslintRule({
525
552
  } };
526
553
  }
527
554
  });
555
+ var vue_root_element_sort_attributes_default = rule;
528
556
 
529
557
  //#endregion
530
558
  //#region src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "3.19.0",
3
+ "version": "3.20.2",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -38,10 +38,5 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "vue-eslint-parser": "^10.2.0"
41
- },
42
- "scripts": {
43
- "build": "tsdown",
44
- "test": "vitest",
45
- "watch": "tsdown --watch"
46
41
  }
47
42
  }