@rotki/eslint-plugin 1.0.0 → 1.2.0
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/README.md +1 -1
- package/dist/index.d.mts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.mjs +68 -4
- package/package.json +25 -24
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4,10 +4,15 @@ interface PluginRuleModule<TOptions extends readonly unknown[] = []> extends Rul
|
|
|
4
4
|
defaultOptions: TOptions;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
type Options$
|
|
7
|
+
type Options$2 = [{
|
|
8
8
|
legacy: boolean;
|
|
9
9
|
}];
|
|
10
10
|
|
|
11
|
+
interface Options$1 {
|
|
12
|
+
max: number;
|
|
13
|
+
ignoreTypeImports: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
type Options = [{
|
|
12
17
|
allowInference: boolean;
|
|
13
18
|
}];
|
|
@@ -19,8 +24,9 @@ declare const plugin: {
|
|
|
19
24
|
};
|
|
20
25
|
rules: {
|
|
21
26
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
27
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
22
28
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
23
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
29
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
24
30
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
25
31
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
26
32
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -34,8 +40,9 @@ declare const _default: {
|
|
|
34
40
|
};
|
|
35
41
|
rules: {
|
|
36
42
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
43
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
37
44
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
38
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
45
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
39
46
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
40
47
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
41
48
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -51,8 +58,9 @@ declare const _default: {
|
|
|
51
58
|
};
|
|
52
59
|
rules: {
|
|
53
60
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
61
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
54
62
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
55
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
63
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
56
64
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
57
65
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
58
66
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -77,8 +85,9 @@ declare const _default: {
|
|
|
77
85
|
};
|
|
78
86
|
rules: {
|
|
79
87
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
88
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
80
89
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
81
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
90
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
82
91
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
83
92
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
84
93
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -105,4 +114,5 @@ type Rules = {
|
|
|
105
114
|
[K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]>;
|
|
106
115
|
};
|
|
107
116
|
|
|
108
|
-
export {
|
|
117
|
+
export { _default as default };
|
|
118
|
+
export type { RuleOptions, Rules };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,15 @@ interface PluginRuleModule<TOptions extends readonly unknown[] = []> extends Rul
|
|
|
4
4
|
defaultOptions: TOptions;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
type Options$
|
|
7
|
+
type Options$2 = [{
|
|
8
8
|
legacy: boolean;
|
|
9
9
|
}];
|
|
10
10
|
|
|
11
|
+
interface Options$1 {
|
|
12
|
+
max: number;
|
|
13
|
+
ignoreTypeImports: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
type Options = [{
|
|
12
17
|
allowInference: boolean;
|
|
13
18
|
}];
|
|
@@ -19,8 +24,9 @@ declare const plugin: {
|
|
|
19
24
|
};
|
|
20
25
|
rules: {
|
|
21
26
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
27
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
22
28
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
23
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
29
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
24
30
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
25
31
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
26
32
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -34,8 +40,9 @@ declare const _default: {
|
|
|
34
40
|
};
|
|
35
41
|
rules: {
|
|
36
42
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
43
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
37
44
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
38
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
45
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
39
46
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
40
47
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
41
48
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -51,8 +58,9 @@ declare const _default: {
|
|
|
51
58
|
};
|
|
52
59
|
rules: {
|
|
53
60
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
61
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
54
62
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
55
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
63
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
56
64
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
57
65
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
58
66
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -77,8 +85,9 @@ declare const _default: {
|
|
|
77
85
|
};
|
|
78
86
|
rules: {
|
|
79
87
|
'consistent-ref-type-annotation': PluginRuleModule<Options>;
|
|
88
|
+
'max-dependencies': PluginRuleModule<[Options$1]>;
|
|
80
89
|
'no-deprecated-classes': PluginRuleModule<[]>;
|
|
81
|
-
'no-deprecated-components': PluginRuleModule<Options$
|
|
90
|
+
'no-deprecated-components': PluginRuleModule<Options$2>;
|
|
82
91
|
'no-deprecated-props': PluginRuleModule<[]>;
|
|
83
92
|
'no-dot-ts-imports': PluginRuleModule<[]>;
|
|
84
93
|
'no-legacy-library-import': PluginRuleModule<[]>;
|
|
@@ -105,4 +114,5 @@ type Rules = {
|
|
|
105
114
|
[K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]>;
|
|
106
115
|
};
|
|
107
116
|
|
|
108
|
-
export {
|
|
117
|
+
export { _default as default };
|
|
118
|
+
export type { RuleOptions, Rules };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as compat from 'eslint-compat-utils';
|
|
|
4
4
|
import { extname } from 'node:path';
|
|
5
5
|
import { pascalCase, kebabCase } from 'scule';
|
|
6
6
|
|
|
7
|
-
const version = "1.
|
|
7
|
+
const version = "1.2.0";
|
|
8
8
|
const pkg = {
|
|
9
9
|
version: version};
|
|
10
10
|
|
|
@@ -97,13 +97,13 @@ function createRule({
|
|
|
97
97
|
meta
|
|
98
98
|
}) {
|
|
99
99
|
return {
|
|
100
|
-
create: (context) => {
|
|
100
|
+
create: ((context) => {
|
|
101
101
|
const optionsWithDefault = context.options.map((options, index) => ({
|
|
102
102
|
...defaultOptions[index] || {},
|
|
103
103
|
...options || {}
|
|
104
104
|
}));
|
|
105
105
|
return create(context, optionsWithDefault);
|
|
106
|
-
},
|
|
106
|
+
}),
|
|
107
107
|
defaultOptions,
|
|
108
108
|
meta
|
|
109
109
|
};
|
|
@@ -135,7 +135,7 @@ function defineTemplateBodyVisitor(context, templateBodyVisitor, scriptVisitor,
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
const debug$3 = createDebug("@rotki/eslint-plugin:consistent-ref-type-annotation");
|
|
138
|
-
const RULE_NAME$
|
|
138
|
+
const RULE_NAME$6 = "consistent-ref-type-annotation";
|
|
139
139
|
const FIXABLE_METHODS = ["ref", "computed"];
|
|
140
140
|
function checkAssignmentDeclaration(context, node, declaration, options) {
|
|
141
141
|
const source = getSourceCode(context);
|
|
@@ -230,6 +230,69 @@ const consistentRefTypeAnnotation = createEslintRule({
|
|
|
230
230
|
],
|
|
231
231
|
type: "problem"
|
|
232
232
|
},
|
|
233
|
+
name: RULE_NAME$6
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
const RULE_NAME$5 = "max-dependencies";
|
|
237
|
+
const maxDependencies = createEslintRule({
|
|
238
|
+
create(context, [options]) {
|
|
239
|
+
let dependencyCount = 0;
|
|
240
|
+
let firstImportNode = null;
|
|
241
|
+
return {
|
|
242
|
+
ImportDeclaration(node) {
|
|
243
|
+
if (!firstImportNode) {
|
|
244
|
+
firstImportNode = node;
|
|
245
|
+
}
|
|
246
|
+
if (options.ignoreTypeImports && node.importKind === "type") {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
dependencyCount++;
|
|
250
|
+
},
|
|
251
|
+
"Program:exit": function() {
|
|
252
|
+
if (dependencyCount > options.max) {
|
|
253
|
+
context.report({
|
|
254
|
+
data: {
|
|
255
|
+
count: dependencyCount,
|
|
256
|
+
max: options.max
|
|
257
|
+
},
|
|
258
|
+
messageId: "maxDependencies",
|
|
259
|
+
node: firstImportNode
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
defaultOptions: [
|
|
266
|
+
{
|
|
267
|
+
ignoreTypeImports: false,
|
|
268
|
+
max: 20
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
meta: {
|
|
272
|
+
docs: {
|
|
273
|
+
description: "enforce a maximum number of dependencies per file",
|
|
274
|
+
recommendation: "recommended"
|
|
275
|
+
},
|
|
276
|
+
messages: {
|
|
277
|
+
maxDependencies: "Maximum number of dependencies ({{ max }}) exceeded ({{ count }})."
|
|
278
|
+
},
|
|
279
|
+
schema: [
|
|
280
|
+
{
|
|
281
|
+
additionalProperties: false,
|
|
282
|
+
properties: {
|
|
283
|
+
ignoreTypeImports: {
|
|
284
|
+
type: "boolean"
|
|
285
|
+
},
|
|
286
|
+
max: {
|
|
287
|
+
minimum: 0,
|
|
288
|
+
type: "integer"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
type: "object"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
type: "suggestion"
|
|
295
|
+
},
|
|
233
296
|
name: RULE_NAME$5
|
|
234
297
|
});
|
|
235
298
|
|
|
@@ -670,6 +733,7 @@ const plugin = {
|
|
|
670
733
|
},
|
|
671
734
|
rules: {
|
|
672
735
|
"consistent-ref-type-annotation": consistentRefTypeAnnotation,
|
|
736
|
+
"max-dependencies": maxDependencies,
|
|
673
737
|
"no-deprecated-classes": noDeprecatedClasses,
|
|
674
738
|
"no-deprecated-components": noDeprecatedComponents,
|
|
675
739
|
"no-deprecated-props": noDeprecatedProps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotki/eslint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"bugs": {
|
|
@@ -25,41 +25,42 @@
|
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.20.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@typescript-eslint/utils": "8.
|
|
32
|
-
"debug": "4.4.
|
|
33
|
-
"eslint-compat-utils": "0.6.
|
|
31
|
+
"@typescript-eslint/utils": "8.40.0",
|
|
32
|
+
"debug": "4.4.1",
|
|
33
|
+
"eslint-compat-utils": "0.6.5",
|
|
34
34
|
"jsonc-eslint-parser": "2.4.0",
|
|
35
35
|
"scule": "1.3.0",
|
|
36
|
-
"vue-eslint-parser": "10.
|
|
36
|
+
"vue-eslint-parser": "10.2.0",
|
|
37
37
|
"yaml-eslint-parser": "1.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@commitlint/cli": "19.
|
|
41
|
-
"@commitlint/config-conventional": "19.
|
|
42
|
-
"@rotki/eslint-config": "4.0
|
|
40
|
+
"@commitlint/cli": "19.8.1",
|
|
41
|
+
"@commitlint/config-conventional": "19.8.1",
|
|
42
|
+
"@rotki/eslint-config": "4.5.0",
|
|
43
|
+
"@rotki/eslint-plugin": "file:.",
|
|
43
44
|
"@types/debug": "4.1.12",
|
|
44
|
-
"@types/node": "
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
46
|
-
"@typescript-eslint/parser": "8.
|
|
47
|
-
"@typescript-eslint/rule-tester": "8.
|
|
48
|
-
"@vitest/coverage-v8": "3.
|
|
49
|
-
"bumpp": "10.
|
|
50
|
-
"debug": "4.4.
|
|
51
|
-
"eslint": "9.
|
|
45
|
+
"@types/node": "22.17.2",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "8.40.0",
|
|
47
|
+
"@typescript-eslint/parser": "8.40.0",
|
|
48
|
+
"@typescript-eslint/rule-tester": "8.40.0",
|
|
49
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
50
|
+
"bumpp": "10.2.3",
|
|
51
|
+
"debug": "4.4.1",
|
|
52
|
+
"eslint": "9.33.0",
|
|
52
53
|
"husky": "9.1.7",
|
|
53
|
-
"lint-staged": "
|
|
54
|
+
"lint-staged": "16.1.5",
|
|
54
55
|
"rimraf": "6.0.1",
|
|
55
|
-
"tsx": "4.
|
|
56
|
-
"typescript": "5.
|
|
57
|
-
"unbuild": "3.
|
|
58
|
-
"vitepress": "1.6.
|
|
59
|
-
"vitest": "3.
|
|
56
|
+
"tsx": "4.20.4",
|
|
57
|
+
"typescript": "5.9.2",
|
|
58
|
+
"unbuild": "3.6.1",
|
|
59
|
+
"vitepress": "1.6.4",
|
|
60
|
+
"vitest": "3.2.4"
|
|
60
61
|
},
|
|
61
62
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
63
|
+
"node": ">=22 <23",
|
|
63
64
|
"pnpm": ">=10 <11"
|
|
64
65
|
},
|
|
65
66
|
"lint-staged": {
|