@tcy/eslint-rules 1.6.4 → 1.7.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/coverage/clover.xml +30 -3
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/index.html +23 -8
- package/coverage/lcov-report/src/array-elements-per-line.js.html +1 -1
- package/coverage/lcov-report/src/back/back.js.html +1 -1
- package/coverage/lcov-report/src/back/http.js.html +1 -1
- package/coverage/lcov-report/src/back/index.html +1 -1
- package/coverage/lcov-report/src/back/recommended.js.html +1 -1
- package/coverage/lcov-report/src/bin/eslint-cache-guard.js.html +298 -0
- package/coverage/lcov-report/src/bin/index.html +116 -0
- package/coverage/lcov-report/src/client/client.js.html +1 -1
- package/coverage/lcov-report/src/client/index.html +1 -1
- package/coverage/lcov-report/src/client/recommended.js.html +1 -1
- package/coverage/lcov-report/src/decorator-type-enforcement.js.html +1 -1
- package/coverage/lcov-report/src/enforce-tailwind-important.js.html +1 -1
- package/coverage/lcov-report/src/export-specifiers-per-line.js.html +1 -1
- package/coverage/lcov-report/src/import-specifiers-per-line.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.js.html +1 -1
- package/coverage/lcov-report/src/jsx-boolean-shorthand.js.html +1 -1
- package/coverage/lcov-report/src/jsx-expression-string-literals.js.html +1 -1
- package/coverage/lcov-report/src/jsx-ref-string-exists.js.html +1 -1
- package/coverage/lcov-report/src/plugin.js.html +1 -1
- package/coverage/lcov-report/src/recommended.js.html +1 -1
- package/coverage/lcov-report/src/route-dto-required.js.html +1 -1
- package/coverage/lcov-report/src/v-model-name-match.js.html +1 -1
- package/coverage/lcov-report/src/vuejs-define-component.js.html +1 -1
- package/coverage/lcov-report/src/vuejs-define-workspace.js.html +1 -1
- package/coverage/lcov.info +48 -0
- package/decl/array-elements-per-line.d.ts +13 -13
- package/decl/back/back.d.ts +199 -9
- package/decl/bin/eslint-cache-guard.d.ts +16 -0
- package/decl/client/client.d.ts +199 -9
- package/decl/decorator-type-enforcement.d.ts +13 -13
- package/decl/enforce-tailwind-important.d.ts +20 -17
- package/decl/export-specifiers-per-line.d.ts +11 -11
- package/decl/import-specifiers-per-line.d.ts +11 -11
- package/decl/index.d.ts +2 -2
- package/decl/jsx-boolean-shorthand.d.ts +11 -11
- package/decl/jsx-expression-string-literals.d.ts +11 -11
- package/decl/jsx-ref-string-exists.d.ts +14 -14
- package/decl/route-dto-required.d.ts +15 -15
- package/decl/v-model-name-match.d.ts +14 -14
- package/decl/vuejs-define-component.d.ts +11 -11
- package/decl/vuejs-define-workspace.d.ts +11 -11
- package/package.json +5 -2
- package/src/bin/eslint-cache-guard.js +71 -0
package/decl/client/client.d.ts
CHANGED
|
@@ -1,10 +1,201 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
plugins: {
|
|
3
|
+
tcy: {
|
|
4
|
+
rules: {
|
|
5
|
+
'import-specifiers-per-line': {
|
|
6
|
+
meta: {
|
|
7
|
+
type: string;
|
|
8
|
+
docs: {
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
fixable: string;
|
|
12
|
+
schema: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
maxSpecifiers: {
|
|
16
|
+
type: string;
|
|
17
|
+
default: number;
|
|
18
|
+
};
|
|
19
|
+
maxLen: {
|
|
20
|
+
type: string;
|
|
21
|
+
default: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
additionalProperties: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
create(context: any): {
|
|
28
|
+
ImportDeclaration(node: any): void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
'array-elements-per-line': {
|
|
32
|
+
meta: {
|
|
33
|
+
type: string;
|
|
34
|
+
docs: {
|
|
35
|
+
description: string;
|
|
36
|
+
category: string;
|
|
37
|
+
recommended: boolean;
|
|
38
|
+
};
|
|
39
|
+
fixable: string;
|
|
40
|
+
schema: never[];
|
|
41
|
+
};
|
|
42
|
+
create(context: any): {
|
|
43
|
+
ArrayExpression(node: any): void;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
'export-specifiers-per-line': {
|
|
47
|
+
meta: {
|
|
48
|
+
type: string;
|
|
49
|
+
docs: {
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
fixable: string;
|
|
53
|
+
schema: never[];
|
|
54
|
+
};
|
|
55
|
+
create(context: any): {
|
|
56
|
+
ExportNamedDeclaration(node: any): void;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
'jsx-boolean-shorthand': {
|
|
60
|
+
meta: {
|
|
61
|
+
type: string;
|
|
62
|
+
docs: {
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
fixable: string;
|
|
66
|
+
schema: never[];
|
|
67
|
+
};
|
|
68
|
+
create(context: any): {
|
|
69
|
+
JSXAttribute(node: any): void;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
'jsx-expression-string-literals': {
|
|
73
|
+
meta: {
|
|
74
|
+
type: string;
|
|
75
|
+
docs: {
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
fixable: string;
|
|
79
|
+
schema: never[];
|
|
80
|
+
};
|
|
81
|
+
create(context: any): {
|
|
82
|
+
JSXAttribute(node: any): void;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
'jsx-ref-string-exists': {
|
|
86
|
+
meta: {
|
|
87
|
+
type: string;
|
|
88
|
+
docs: {
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
messages: {
|
|
92
|
+
missingRef: string;
|
|
93
|
+
noServices: string;
|
|
94
|
+
};
|
|
95
|
+
schema: never[];
|
|
96
|
+
};
|
|
97
|
+
create(context: any): {
|
|
98
|
+
JSXAttribute(node: any): void;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
'enforce-tailwind-important': {
|
|
102
|
+
meta: {
|
|
103
|
+
type: string;
|
|
104
|
+
docs: {
|
|
105
|
+
description: string;
|
|
106
|
+
recommended: boolean;
|
|
107
|
+
};
|
|
108
|
+
fixable: string;
|
|
109
|
+
schema: never[];
|
|
110
|
+
messages: {
|
|
111
|
+
missingImportant: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
create(context: any): {
|
|
115
|
+
JSXAttribute(node: any): void;
|
|
116
|
+
VariableDeclarator(node: any): void;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
'v-model-name-match': {
|
|
120
|
+
meta: {
|
|
121
|
+
type: string;
|
|
122
|
+
docs: {
|
|
123
|
+
description: string;
|
|
124
|
+
recommended: boolean;
|
|
125
|
+
};
|
|
126
|
+
schema: never[];
|
|
127
|
+
messages: {
|
|
128
|
+
mismatch: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
create(context: any): {
|
|
132
|
+
JSXOpeningElement(node: any): void;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
'decorator-type-enforcement': {
|
|
136
|
+
meta: {
|
|
137
|
+
type: string;
|
|
138
|
+
docs: {
|
|
139
|
+
description: string;
|
|
140
|
+
category: string;
|
|
141
|
+
recommended: boolean;
|
|
142
|
+
};
|
|
143
|
+
fixable: string;
|
|
144
|
+
schema: never[];
|
|
145
|
+
};
|
|
146
|
+
create(context: any): {
|
|
147
|
+
PropertyDefinition(node: any): void;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
'vuejs-define-component': {
|
|
151
|
+
meta: {
|
|
152
|
+
type: string;
|
|
153
|
+
docs: {
|
|
154
|
+
description: string;
|
|
155
|
+
recommended: boolean;
|
|
156
|
+
};
|
|
157
|
+
schema: never[];
|
|
158
|
+
};
|
|
159
|
+
create(context: any): {
|
|
160
|
+
ExportDefaultDeclaration(node: any): void;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
'vuejs-define-workspace': {
|
|
164
|
+
meta: {
|
|
165
|
+
type: string;
|
|
166
|
+
docs: {
|
|
167
|
+
description: string;
|
|
168
|
+
recommended: boolean;
|
|
169
|
+
};
|
|
170
|
+
schema: never[];
|
|
171
|
+
};
|
|
172
|
+
create(context: any): {
|
|
173
|
+
ExportDefaultDeclaration?: undefined;
|
|
174
|
+
} | {
|
|
175
|
+
ExportDefaultDeclaration(node: any): void;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
'route-dto-required': {
|
|
179
|
+
meta: {
|
|
180
|
+
type: string;
|
|
181
|
+
docs: {
|
|
182
|
+
description: string;
|
|
183
|
+
category: string;
|
|
184
|
+
recommended: boolean;
|
|
185
|
+
};
|
|
186
|
+
schema: never[];
|
|
187
|
+
messages: {
|
|
188
|
+
missingDto: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
create(context: any): {
|
|
192
|
+
MethodDefinition(node: any): void;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
rules: {
|
|
8
199
|
'tcy/import-specifiers-per-line': (string | {
|
|
9
200
|
maxSpecifiers: number;
|
|
10
201
|
})[];
|
|
@@ -18,6 +209,5 @@ declare namespace _default {
|
|
|
18
209
|
'tcy/vuejs-define-component': string;
|
|
19
210
|
'tcy/vuejs-define-workspace': string;
|
|
20
211
|
};
|
|
21
|
-
}
|
|
212
|
+
};
|
|
22
213
|
export default _default;
|
|
23
|
-
import pluginConfig from '../plugin.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
category: string;
|
|
7
|
+
recommended: boolean;
|
|
8
|
+
};
|
|
9
|
+
fixable: string;
|
|
10
|
+
schema: never[];
|
|
11
|
+
};
|
|
12
|
+
create(context: any): {
|
|
13
13
|
PropertyDefinition(node: any): void;
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export default _default;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Enforce all Tailwind classes to end with "!" (important modifier)
|
|
3
|
+
*/
|
|
4
|
+
export declare const isMissingImportant: (cls: any) => boolean;
|
|
5
|
+
export declare const addImportant: (cls: any) => string;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
meta: {
|
|
8
|
+
type: string;
|
|
9
|
+
docs: {
|
|
10
|
+
description: string;
|
|
11
|
+
recommended: boolean;
|
|
12
|
+
};
|
|
13
|
+
fixable: string;
|
|
14
|
+
schema: never[];
|
|
15
|
+
messages: {
|
|
16
|
+
missingImportant: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
create(context: any): {
|
|
17
20
|
JSXAttribute(node: any): void;
|
|
18
21
|
VariableDeclarator(node: any): void;
|
|
19
22
|
};
|
|
20
|
-
}
|
|
23
|
+
};
|
|
21
24
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
fixable: string;
|
|
8
|
+
schema: never[];
|
|
9
|
+
};
|
|
10
|
+
create(context: any): {
|
|
11
11
|
ExportNamedDeclaration(node: any): void;
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
fixable: string;
|
|
8
|
+
schema: {
|
|
9
9
|
type: string;
|
|
10
10
|
properties: {
|
|
11
11
|
maxSpecifiers: {
|
|
@@ -19,9 +19,9 @@ declare namespace _default {
|
|
|
19
19
|
};
|
|
20
20
|
additionalProperties: boolean;
|
|
21
21
|
}[];
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
};
|
|
23
|
+
create(context: any): {
|
|
24
24
|
ImportDeclaration(node: any): void;
|
|
25
25
|
};
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
export default _default;
|
package/decl/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as client from
|
|
2
|
-
export * as back from
|
|
1
|
+
export * as client from './client/client.js';
|
|
2
|
+
export * as back from './back/back.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
fixable: string;
|
|
8
|
+
schema: never[];
|
|
9
|
+
};
|
|
10
|
+
create(context: any): {
|
|
11
11
|
JSXAttribute(node: any): void;
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
fixable: string;
|
|
8
|
+
schema: never[];
|
|
9
|
+
};
|
|
10
|
+
create(context: any): {
|
|
11
11
|
JSXAttribute(node: any): void;
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export default _default;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
messages: {
|
|
8
|
+
missingRef: string;
|
|
9
|
+
noServices: string;
|
|
10
|
+
};
|
|
11
|
+
schema: never[];
|
|
12
|
+
};
|
|
13
|
+
create(context: any): {
|
|
14
14
|
JSXAttribute(node: any): void;
|
|
15
15
|
};
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
export default _default;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
category: string;
|
|
7
|
+
recommended: boolean;
|
|
8
|
+
};
|
|
9
|
+
schema: never[];
|
|
10
|
+
messages: {
|
|
11
|
+
missingDto: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
create(context: any): {
|
|
15
15
|
MethodDefinition(node: any): void;
|
|
16
16
|
};
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
export default _default;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
recommended: boolean;
|
|
7
|
+
};
|
|
8
|
+
schema: never[];
|
|
9
|
+
messages: {
|
|
10
|
+
mismatch: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
create(context: any): {
|
|
14
14
|
JSXOpeningElement(node: any): void;
|
|
15
15
|
};
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
recommended: boolean;
|
|
7
|
+
};
|
|
8
|
+
schema: never[];
|
|
9
|
+
};
|
|
10
|
+
create(context: any): {
|
|
11
11
|
ExportDefaultDeclaration(node: any): void;
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export default _default;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
docs: {
|
|
5
|
+
description: string;
|
|
6
|
+
recommended: boolean;
|
|
7
|
+
};
|
|
8
|
+
schema: never[];
|
|
9
|
+
};
|
|
10
|
+
create(context: any): {
|
|
11
11
|
ExportDefaultDeclaration?: undefined;
|
|
12
12
|
} | {
|
|
13
13
|
ExportDefaultDeclaration(node: any): void;
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tcy/eslint-rules",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "```typescript import { plugin as customRules } from 'tcy@eslint-rules/src/index.mjs';",
|
|
5
5
|
"homepage": "https://github.com/tcastelly/eslint-rules#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "src/index.js",
|
|
17
17
|
"types": "decl/index.d.ts",
|
|
18
|
+
"bin": {
|
|
19
|
+
"eslint-cache-guard": "./src/bin/eslint-cache-guard.js"
|
|
20
|
+
},
|
|
18
21
|
"exports": {
|
|
19
22
|
"./client": {
|
|
20
23
|
"types": "./decl/client/client.d.ts",
|
|
@@ -51,6 +54,6 @@
|
|
|
51
54
|
"babel-jest": "^30.4.1",
|
|
52
55
|
"jest": "^30.4.2",
|
|
53
56
|
"rimraf": "^6.1.3",
|
|
54
|
-
"typescript": "^
|
|
57
|
+
"typescript": "^7.0.2"
|
|
55
58
|
}
|
|
56
59
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ESLint's `--cache` keys on file contents only, never on the config that produced
|
|
5
|
+
* the results. Editing a rule therefore leaves a stale cache behind and lint output
|
|
6
|
+
* silently goes wrong until the cache is deleted by hand.
|
|
7
|
+
*
|
|
8
|
+
* This hashes everything that can change lint output and drops the caches when it
|
|
9
|
+
* moves. Run it immediately before `eslint --cache`:
|
|
10
|
+
*
|
|
11
|
+
* "lint:eslint": "eslint-cache-guard && eslint src --cache"
|
|
12
|
+
*
|
|
13
|
+
* Extra inputs can be passed as arguments, relative to the project root:
|
|
14
|
+
*
|
|
15
|
+
* "lint:eslint": "eslint-cache-guard tsconfig.json && eslint src --cache"
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { createHash } from 'node:crypto';
|
|
19
|
+
import {
|
|
20
|
+
existsSync, readdirSync, readFileSync, rmSync, writeFileSync,
|
|
21
|
+
} from 'node:fs';
|
|
22
|
+
import { dirname, join, resolve } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
|
|
25
|
+
const STAMP = '.eslintcache.hash';
|
|
26
|
+
|
|
27
|
+
// Any of these may or may not exist; whichever are present get hashed.
|
|
28
|
+
const CANDIDATES = [
|
|
29
|
+
'eslint.config.ts',
|
|
30
|
+
'eslint.config.mts',
|
|
31
|
+
'eslint.config.js',
|
|
32
|
+
'eslint.config.mjs',
|
|
33
|
+
'eslint.config.cjs',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const projectRoot = process.cwd();
|
|
37
|
+
const selfRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
38
|
+
|
|
39
|
+
const hash = createHash('sha256');
|
|
40
|
+
|
|
41
|
+
// This package ships the lint rules themselves, so its own version has to be part
|
|
42
|
+
// of the key: bumping @tcy/eslint-rules changes lint output without touching a
|
|
43
|
+
// single file in the consuming project.
|
|
44
|
+
hash.update(readFileSync(join(selfRoot, 'package.json')));
|
|
45
|
+
|
|
46
|
+
[...CANDIDATES, ...process.argv.slice(2)]
|
|
47
|
+
.map((file) => join(projectRoot, file))
|
|
48
|
+
.filter((file) => existsSync(file))
|
|
49
|
+
.forEach((file) => {
|
|
50
|
+
hash.update(file);
|
|
51
|
+
hash.update(readFileSync(file));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const current = hash.digest('hex');
|
|
55
|
+
|
|
56
|
+
const stampPath = join(projectRoot, STAMP);
|
|
57
|
+
const previous = existsSync(stampPath) ? readFileSync(stampPath, 'utf8').trim() : null;
|
|
58
|
+
|
|
59
|
+
if (previous !== current) {
|
|
60
|
+
// Cache filenames vary per project (--cache-location), so clear the whole family
|
|
61
|
+
// rather than guessing at names. The stamp itself must survive.
|
|
62
|
+
readdirSync(projectRoot)
|
|
63
|
+
.filter((file) => file.startsWith('.eslintcache') && file !== STAMP)
|
|
64
|
+
.forEach((file) => rmSync(join(projectRoot, file), { force: true }));
|
|
65
|
+
|
|
66
|
+
writeFileSync(stampPath, `${current}\n`);
|
|
67
|
+
|
|
68
|
+
if (previous !== null) {
|
|
69
|
+
console.log('eslint config changed - cache invalidated');
|
|
70
|
+
}
|
|
71
|
+
}
|