@rotki/eslint-plugin 0.6.0 → 0.6.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
@@ -24,7 +24,7 @@ const createDebug__default = /*#__PURE__*/_interopDefaultCompat(createDebug);
24
24
  const compat__namespace = /*#__PURE__*/_interopNamespaceCompat(compat);
25
25
 
26
26
  const name = "@rotki/eslint-plugin";
27
- const version = "0.6.0";
27
+ const version = "0.6.1";
28
28
  const packageManager = "pnpm@9.15.0";
29
29
  const type = "module";
30
30
  const license = "AGPL-3.0";
@@ -54,6 +54,7 @@ const scripts = {
54
54
  clean: "rimraf .nyc_output coverage dist docs/.vitepress/dist",
55
55
  coverage: "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
56
56
  generate: "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-rule-docs.ts",
57
+ "generate:index": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-docs-index.ts",
57
58
  lint: "eslint .",
58
59
  "lint:fix": "eslint . --fix",
59
60
  build: "unbuild",
@@ -63,7 +64,7 @@ const scripts = {
63
64
  "test:coverage": "vitest run --coverage",
64
65
  "new": "node --experimental-specifier-resolution=node --loader ts-node/esm ./scripts/new-rule.ts",
65
66
  docs: "vitepress dev docs",
66
- "docs:build": "pnpm run generate && vitepress build docs",
67
+ "docs:build": "pnpm run generate && pnpm run generate:index && vitepress build docs",
67
68
  prepare: "husky",
68
69
  typecheck: "tsc --noEmit",
69
70
  release: "bumpp -r --no-push"
@@ -257,7 +258,7 @@ function createRecommended(plugin, name, flat) {
257
258
  }
258
259
  }
259
260
 
260
- const RULE_NAME$4 = "no-deprecated-classes";
261
+ const RULE_NAME$5 = "no-deprecated-classes";
261
262
  const debug$3 = createDebug__default("@rotki/eslint-plugin:no-deprecated-classes");
262
263
  const replacements$2 = [
263
264
  ["d-block", "block"],
@@ -431,11 +432,11 @@ const noDeprecatedClasses = createEslintRule({
431
432
  schema: [],
432
433
  type: "problem"
433
434
  },
434
- name: RULE_NAME$4
435
+ name: RULE_NAME$5
435
436
  });
436
437
 
437
438
  const debug$2 = createDebug__default("@rotki/eslint-plugin:no-deprecated-components");
438
- const RULE_NAME$3 = "no-deprecated-components";
439
+ const RULE_NAME$4 = "no-deprecated-components";
439
440
  const vuetify = {
440
441
  VApp: true,
441
442
  VAppBar: true,
@@ -540,11 +541,11 @@ const noDeprecatedComponents = createEslintRule({
540
541
  ],
541
542
  type: "problem"
542
543
  },
543
- name: RULE_NAME$3
544
+ name: RULE_NAME$4
544
545
  });
545
546
 
546
547
  const debug$1 = createDebug__default("@rotki/eslint-plugin:no-deprecated-props");
547
- const RULE_NAME$2 = "no-deprecated-props";
548
+ const RULE_NAME$3 = "no-deprecated-props";
548
549
  const replacements = {
549
550
  RuiRadio: {
550
551
  internalValue: "value"
@@ -599,7 +600,8 @@ const noDeprecatedProps = createEslintRule({
599
600
  defaultOptions: [],
600
601
  meta: {
601
602
  docs: {
602
- description: "..."
603
+ description: "Replaces deprecated props with their replacements",
604
+ recommendation: "recommended"
603
605
  },
604
606
  fixable: "code",
605
607
  messages: {
@@ -608,10 +610,10 @@ const noDeprecatedProps = createEslintRule({
608
610
  schema: [],
609
611
  type: "problem"
610
612
  },
611
- name: RULE_NAME$2
613
+ name: RULE_NAME$3
612
614
  });
613
615
 
614
- const RULE_NAME$1 = "no-legacy-library-import";
616
+ const RULE_NAME$2 = "no-legacy-library-import";
615
617
  const legacyLibrary = "@rotki/ui-library-compat";
616
618
  const newLibrary = "@rotki/ui-library";
617
619
  const noLegacyLibraryImport = createEslintRule({
@@ -634,7 +636,8 @@ const noLegacyLibraryImport = createEslintRule({
634
636
  defaultOptions: [],
635
637
  meta: {
636
638
  docs: {
637
- description: `Reports and replaces imports of ${legacyLibrary} with ${newLibrary}`
639
+ description: `Reports and replaces imports of ${legacyLibrary} with ${newLibrary}`,
640
+ recommendation: "recommended"
638
641
  },
639
642
  fixable: "code",
640
643
  messages: {
@@ -643,11 +646,11 @@ const noLegacyLibraryImport = createEslintRule({
643
646
  schema: [],
644
647
  type: "problem"
645
648
  },
646
- name: RULE_NAME$1
649
+ name: RULE_NAME$2
647
650
  });
648
651
 
649
652
  const debug = createDebug__default("@rotki/eslint-plugin:consistent-ref-type-annotation");
650
- const RULE_NAME = "consistent-ref-type-annotation";
653
+ const RULE_NAME$1 = "consistent-ref-type-annotation";
651
654
  const FIXABLE_METHODS = ["ref", "computed"];
652
655
  function checkAssignmentDeclaration(context, node, declaration, options) {
653
656
  const source = getSourceCode(context);
@@ -742,6 +745,45 @@ const consistentRefTypeAnnotation = createEslintRule({
742
745
  ],
743
746
  type: "problem"
744
747
  },
748
+ name: RULE_NAME$1
749
+ });
750
+
751
+ const RULE_NAME = "no-dot-ts-imports";
752
+ const noDotTsImport = createEslintRule({
753
+ create(context) {
754
+ return {
755
+ ImportDeclaration(node) {
756
+ const importDeclaration = node.source.value;
757
+ if (!importDeclaration.endsWith(".ts"))
758
+ return;
759
+ const lastIndexOfExtension = importDeclaration.lastIndexOf(".ts");
760
+ const replacement = importDeclaration.substring(0, lastIndexOfExtension);
761
+ context.report({
762
+ data: {
763
+ import: importDeclaration
764
+ },
765
+ fix(fixer) {
766
+ return fixer.replaceText(node.source, `'${replacement}'`);
767
+ },
768
+ messageId: "invalidTSExtension",
769
+ node: node.source
770
+ });
771
+ }
772
+ };
773
+ },
774
+ defaultOptions: [],
775
+ meta: {
776
+ docs: {
777
+ description: "Checks and replaces .ts extension in import statements.",
778
+ recommendation: "recommended"
779
+ },
780
+ fixable: "code",
781
+ messages: {
782
+ invalidTSExtension: `'{{ import }}' has a .ts extension, please remove it'`
783
+ },
784
+ schema: [],
785
+ type: "problem"
786
+ },
745
787
  name: RULE_NAME
746
788
  });
747
789
 
@@ -755,6 +797,7 @@ const plugin = {
755
797
  "no-deprecated-classes": noDeprecatedClasses,
756
798
  "no-deprecated-components": noDeprecatedComponents,
757
799
  "no-deprecated-props": noDeprecatedProps,
800
+ "no-dot-ts-imports": noDotTsImport,
758
801
  "no-legacy-library-import": noLegacyLibraryImport
759
802
  }
760
803
  };
package/dist/index.d.cts CHANGED
@@ -22,6 +22,7 @@ declare const plugin: {
22
22
  'no-deprecated-classes': PluginRuleModule<[]>;
23
23
  'no-deprecated-components': PluginRuleModule<Options$1>;
24
24
  'no-deprecated-props': PluginRuleModule<[]>;
25
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
25
26
  'no-legacy-library-import': PluginRuleModule<[]>;
26
27
  };
27
28
  };
@@ -36,6 +37,7 @@ declare const _default: {
36
37
  'no-deprecated-classes': PluginRuleModule<[]>;
37
38
  'no-deprecated-components': PluginRuleModule<Options$1>;
38
39
  'no-deprecated-props': PluginRuleModule<[]>;
40
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
39
41
  'no-legacy-library-import': PluginRuleModule<[]>;
40
42
  };
41
43
  } & {
@@ -52,6 +54,7 @@ declare const _default: {
52
54
  'no-deprecated-classes': PluginRuleModule<[]>;
53
55
  'no-deprecated-components': PluginRuleModule<Options$1>;
54
56
  'no-deprecated-props': PluginRuleModule<[]>;
57
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
55
58
  'no-legacy-library-import': PluginRuleModule<[]>;
56
59
  };
57
60
  };
@@ -77,6 +80,7 @@ declare const _default: {
77
80
  'no-deprecated-classes': PluginRuleModule<[]>;
78
81
  'no-deprecated-components': PluginRuleModule<Options$1>;
79
82
  'no-deprecated-props': PluginRuleModule<[]>;
83
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
80
84
  'no-legacy-library-import': PluginRuleModule<[]>;
81
85
  };
82
86
  };
package/dist/index.d.mts CHANGED
@@ -22,6 +22,7 @@ declare const plugin: {
22
22
  'no-deprecated-classes': PluginRuleModule<[]>;
23
23
  'no-deprecated-components': PluginRuleModule<Options$1>;
24
24
  'no-deprecated-props': PluginRuleModule<[]>;
25
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
25
26
  'no-legacy-library-import': PluginRuleModule<[]>;
26
27
  };
27
28
  };
@@ -36,6 +37,7 @@ declare const _default: {
36
37
  'no-deprecated-classes': PluginRuleModule<[]>;
37
38
  'no-deprecated-components': PluginRuleModule<Options$1>;
38
39
  'no-deprecated-props': PluginRuleModule<[]>;
40
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
39
41
  'no-legacy-library-import': PluginRuleModule<[]>;
40
42
  };
41
43
  } & {
@@ -52,6 +54,7 @@ declare const _default: {
52
54
  'no-deprecated-classes': PluginRuleModule<[]>;
53
55
  'no-deprecated-components': PluginRuleModule<Options$1>;
54
56
  'no-deprecated-props': PluginRuleModule<[]>;
57
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
55
58
  'no-legacy-library-import': PluginRuleModule<[]>;
56
59
  };
57
60
  };
@@ -77,6 +80,7 @@ declare const _default: {
77
80
  'no-deprecated-classes': PluginRuleModule<[]>;
78
81
  'no-deprecated-components': PluginRuleModule<Options$1>;
79
82
  'no-deprecated-props': PluginRuleModule<[]>;
83
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
80
84
  'no-legacy-library-import': PluginRuleModule<[]>;
81
85
  };
82
86
  };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ declare const plugin: {
22
22
  'no-deprecated-classes': PluginRuleModule<[]>;
23
23
  'no-deprecated-components': PluginRuleModule<Options$1>;
24
24
  'no-deprecated-props': PluginRuleModule<[]>;
25
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
25
26
  'no-legacy-library-import': PluginRuleModule<[]>;
26
27
  };
27
28
  };
@@ -36,6 +37,7 @@ declare const _default: {
36
37
  'no-deprecated-classes': PluginRuleModule<[]>;
37
38
  'no-deprecated-components': PluginRuleModule<Options$1>;
38
39
  'no-deprecated-props': PluginRuleModule<[]>;
40
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
39
41
  'no-legacy-library-import': PluginRuleModule<[]>;
40
42
  };
41
43
  } & {
@@ -52,6 +54,7 @@ declare const _default: {
52
54
  'no-deprecated-classes': PluginRuleModule<[]>;
53
55
  'no-deprecated-components': PluginRuleModule<Options$1>;
54
56
  'no-deprecated-props': PluginRuleModule<[]>;
57
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
55
58
  'no-legacy-library-import': PluginRuleModule<[]>;
56
59
  };
57
60
  };
@@ -77,6 +80,7 @@ declare const _default: {
77
80
  'no-deprecated-classes': PluginRuleModule<[]>;
78
81
  'no-deprecated-components': PluginRuleModule<Options$1>;
79
82
  'no-deprecated-props': PluginRuleModule<[]>;
83
+ 'no-dot-ts-imports': PluginRuleModule<[]>;
80
84
  'no-legacy-library-import': PluginRuleModule<[]>;
81
85
  };
82
86
  };
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { pascalCase, kebabCase } from 'scule';
5
5
  import { TSESTree } from '@typescript-eslint/utils';
6
6
 
7
7
  const name = "@rotki/eslint-plugin";
8
- const version = "0.6.0";
8
+ const version = "0.6.1";
9
9
  const packageManager = "pnpm@9.15.0";
10
10
  const type = "module";
11
11
  const license = "AGPL-3.0";
@@ -35,6 +35,7 @@ const scripts = {
35
35
  clean: "rimraf .nyc_output coverage dist docs/.vitepress/dist",
36
36
  coverage: "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
37
37
  generate: "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-rule-docs.ts",
38
+ "generate:index": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-docs-index.ts",
38
39
  lint: "eslint .",
39
40
  "lint:fix": "eslint . --fix",
40
41
  build: "unbuild",
@@ -44,7 +45,7 @@ const scripts = {
44
45
  "test:coverage": "vitest run --coverage",
45
46
  "new": "node --experimental-specifier-resolution=node --loader ts-node/esm ./scripts/new-rule.ts",
46
47
  docs: "vitepress dev docs",
47
- "docs:build": "pnpm run generate && vitepress build docs",
48
+ "docs:build": "pnpm run generate && pnpm run generate:index && vitepress build docs",
48
49
  prepare: "husky",
49
50
  typecheck: "tsc --noEmit",
50
51
  release: "bumpp -r --no-push"
@@ -238,7 +239,7 @@ function createRecommended(plugin, name, flat) {
238
239
  }
239
240
  }
240
241
 
241
- const RULE_NAME$4 = "no-deprecated-classes";
242
+ const RULE_NAME$5 = "no-deprecated-classes";
242
243
  const debug$3 = createDebug("@rotki/eslint-plugin:no-deprecated-classes");
243
244
  const replacements$2 = [
244
245
  ["d-block", "block"],
@@ -412,11 +413,11 @@ const noDeprecatedClasses = createEslintRule({
412
413
  schema: [],
413
414
  type: "problem"
414
415
  },
415
- name: RULE_NAME$4
416
+ name: RULE_NAME$5
416
417
  });
417
418
 
418
419
  const debug$2 = createDebug("@rotki/eslint-plugin:no-deprecated-components");
419
- const RULE_NAME$3 = "no-deprecated-components";
420
+ const RULE_NAME$4 = "no-deprecated-components";
420
421
  const vuetify = {
421
422
  VApp: true,
422
423
  VAppBar: true,
@@ -521,11 +522,11 @@ const noDeprecatedComponents = createEslintRule({
521
522
  ],
522
523
  type: "problem"
523
524
  },
524
- name: RULE_NAME$3
525
+ name: RULE_NAME$4
525
526
  });
526
527
 
527
528
  const debug$1 = createDebug("@rotki/eslint-plugin:no-deprecated-props");
528
- const RULE_NAME$2 = "no-deprecated-props";
529
+ const RULE_NAME$3 = "no-deprecated-props";
529
530
  const replacements = {
530
531
  RuiRadio: {
531
532
  internalValue: "value"
@@ -580,7 +581,8 @@ const noDeprecatedProps = createEslintRule({
580
581
  defaultOptions: [],
581
582
  meta: {
582
583
  docs: {
583
- description: "..."
584
+ description: "Replaces deprecated props with their replacements",
585
+ recommendation: "recommended"
584
586
  },
585
587
  fixable: "code",
586
588
  messages: {
@@ -589,10 +591,10 @@ const noDeprecatedProps = createEslintRule({
589
591
  schema: [],
590
592
  type: "problem"
591
593
  },
592
- name: RULE_NAME$2
594
+ name: RULE_NAME$3
593
595
  });
594
596
 
595
- const RULE_NAME$1 = "no-legacy-library-import";
597
+ const RULE_NAME$2 = "no-legacy-library-import";
596
598
  const legacyLibrary = "@rotki/ui-library-compat";
597
599
  const newLibrary = "@rotki/ui-library";
598
600
  const noLegacyLibraryImport = createEslintRule({
@@ -615,7 +617,8 @@ const noLegacyLibraryImport = createEslintRule({
615
617
  defaultOptions: [],
616
618
  meta: {
617
619
  docs: {
618
- description: `Reports and replaces imports of ${legacyLibrary} with ${newLibrary}`
620
+ description: `Reports and replaces imports of ${legacyLibrary} with ${newLibrary}`,
621
+ recommendation: "recommended"
619
622
  },
620
623
  fixable: "code",
621
624
  messages: {
@@ -624,11 +627,11 @@ const noLegacyLibraryImport = createEslintRule({
624
627
  schema: [],
625
628
  type: "problem"
626
629
  },
627
- name: RULE_NAME$1
630
+ name: RULE_NAME$2
628
631
  });
629
632
 
630
633
  const debug = createDebug("@rotki/eslint-plugin:consistent-ref-type-annotation");
631
- const RULE_NAME = "consistent-ref-type-annotation";
634
+ const RULE_NAME$1 = "consistent-ref-type-annotation";
632
635
  const FIXABLE_METHODS = ["ref", "computed"];
633
636
  function checkAssignmentDeclaration(context, node, declaration, options) {
634
637
  const source = getSourceCode(context);
@@ -723,6 +726,45 @@ const consistentRefTypeAnnotation = createEslintRule({
723
726
  ],
724
727
  type: "problem"
725
728
  },
729
+ name: RULE_NAME$1
730
+ });
731
+
732
+ const RULE_NAME = "no-dot-ts-imports";
733
+ const noDotTsImport = createEslintRule({
734
+ create(context) {
735
+ return {
736
+ ImportDeclaration(node) {
737
+ const importDeclaration = node.source.value;
738
+ if (!importDeclaration.endsWith(".ts"))
739
+ return;
740
+ const lastIndexOfExtension = importDeclaration.lastIndexOf(".ts");
741
+ const replacement = importDeclaration.substring(0, lastIndexOfExtension);
742
+ context.report({
743
+ data: {
744
+ import: importDeclaration
745
+ },
746
+ fix(fixer) {
747
+ return fixer.replaceText(node.source, `'${replacement}'`);
748
+ },
749
+ messageId: "invalidTSExtension",
750
+ node: node.source
751
+ });
752
+ }
753
+ };
754
+ },
755
+ defaultOptions: [],
756
+ meta: {
757
+ docs: {
758
+ description: "Checks and replaces .ts extension in import statements.",
759
+ recommendation: "recommended"
760
+ },
761
+ fixable: "code",
762
+ messages: {
763
+ invalidTSExtension: `'{{ import }}' has a .ts extension, please remove it'`
764
+ },
765
+ schema: [],
766
+ type: "problem"
767
+ },
726
768
  name: RULE_NAME
727
769
  });
728
770
 
@@ -736,6 +778,7 @@ const plugin = {
736
778
  "no-deprecated-classes": noDeprecatedClasses,
737
779
  "no-deprecated-components": noDeprecatedComponents,
738
780
  "no-deprecated-props": noDeprecatedProps,
781
+ "no-dot-ts-imports": noDotTsImport,
739
782
  "no-legacy-library-import": noLegacyLibraryImport
740
783
  }
741
784
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rotki/eslint-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "bugs": {
@@ -70,6 +70,7 @@
70
70
  "clean": "rimraf .nyc_output coverage dist docs/.vitepress/dist",
71
71
  "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
72
72
  "generate": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-rule-docs.ts",
73
+ "generate:index": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/update-docs-index.ts",
73
74
  "lint": "eslint .",
74
75
  "lint:fix": "eslint . --fix",
75
76
  "build": "unbuild",
@@ -78,7 +79,7 @@
78
79
  "test:coverage": "vitest run --coverage",
79
80
  "new": "node --experimental-specifier-resolution=node --loader ts-node/esm ./scripts/new-rule.ts",
80
81
  "docs": "vitepress dev docs",
81
- "docs:build": "pnpm run generate && vitepress build docs",
82
+ "docs:build": "pnpm run generate && pnpm run generate:index && vitepress build docs",
82
83
  "typecheck": "tsc --noEmit",
83
84
  "release": "bumpp -r --no-push"
84
85
  }