@lvce-editor/eslint-plugin-tsconfig 11.2.0 → 12.0.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/dist/index.js +128 -122
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -3,39 +3,43 @@ import json from '@eslint/json';
|
|
|
3
3
|
const create$a = (context, name, shouldBeValue = true) => {
|
|
4
4
|
return {
|
|
5
5
|
Member(node) {
|
|
6
|
-
if (node.name.type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
6
|
+
if (node.name.type !== 'String' || node.name.value !== 'compilerOptions' || node.value.type !== 'Object') {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const {
|
|
10
|
+
members
|
|
11
|
+
} = node.value;
|
|
12
|
+
for (const member of members) {
|
|
13
|
+
if (member.name.type !== 'String' || member.name.value !== name) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (member.value.value === shouldBeValue) {
|
|
17
|
+
return;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
if (member.value.value === !shouldBeValue) {
|
|
20
|
+
context.report({
|
|
21
|
+
loc: member.name.loc,
|
|
22
|
+
messageId: name
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
26
|
}
|
|
27
|
+
context.report({
|
|
28
|
+
loc: node.name.loc,
|
|
29
|
+
messageId: name
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
const meta$9 = {
|
|
32
|
-
type: 'problem',
|
|
33
36
|
docs: {
|
|
34
37
|
description: 'Ensure that the allowImportingTsExtensions is enabled'
|
|
35
38
|
},
|
|
36
39
|
messages: {
|
|
37
40
|
allowImportingTsExtensions: 'allowImportingTsExtensions rule should be enabled'
|
|
38
|
-
}
|
|
41
|
+
},
|
|
42
|
+
type: 'problem'
|
|
39
43
|
};
|
|
40
44
|
const create$9 = context => {
|
|
41
45
|
return create$a(context, 'allowImportingTsExtensions');
|
|
@@ -48,13 +52,13 @@ const tsconfigAllowImportingTsExtensions = {
|
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
const meta$8 = {
|
|
51
|
-
type: 'problem',
|
|
52
55
|
docs: {
|
|
53
56
|
description: 'Ensure that the assumeChangesOnlyAffectDirectDependencies rule is enabled'
|
|
54
57
|
},
|
|
55
58
|
messages: {
|
|
56
59
|
assumeChangesOnlyAffectDirectDependencies: 'assumeChangesOnlyAffectDirectDependencies rule should be enabled'
|
|
57
|
-
}
|
|
60
|
+
},
|
|
61
|
+
type: 'problem'
|
|
58
62
|
};
|
|
59
63
|
const create$8 = context => {
|
|
60
64
|
return create$a(context, 'assumeChangesOnlyAffectDirectDependencies');
|
|
@@ -67,73 +71,113 @@ const tsconfigAssumeChangesOnlyAffectDirectDependencies = {
|
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
const meta$7 = {
|
|
70
|
-
type: 'problem',
|
|
71
74
|
docs: {
|
|
72
|
-
description: 'Enforce
|
|
75
|
+
description: 'Enforce not skipping libCheck'
|
|
73
76
|
},
|
|
74
77
|
messages: {
|
|
75
|
-
|
|
76
|
-
}
|
|
78
|
+
skipLibCheck: "Don't skip libcheck"
|
|
79
|
+
},
|
|
80
|
+
type: 'problem'
|
|
77
81
|
};
|
|
78
82
|
const create$7 = context => {
|
|
79
|
-
return
|
|
83
|
+
return {
|
|
84
|
+
Member(node) {
|
|
85
|
+
if (node.name.type !== 'String' || node.name.value !== 'compilerOptions' || node.value.type !== 'Object') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const {
|
|
89
|
+
members
|
|
90
|
+
} = node.value;
|
|
91
|
+
for (const member of members) {
|
|
92
|
+
if (member.name.type !== 'String' || member.name.value !== 'skipLibCheck') {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (member.value.value === true) {
|
|
96
|
+
context.report({
|
|
97
|
+
loc: member.name.loc,
|
|
98
|
+
messageId: 'skipLibCheck'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
80
105
|
};
|
|
81
106
|
|
|
82
|
-
const
|
|
107
|
+
const tsconfigDontSkipLibCheck = {
|
|
83
108
|
__proto__: null,
|
|
84
109
|
create: create$7,
|
|
85
110
|
meta: meta$7
|
|
86
111
|
};
|
|
87
112
|
|
|
88
113
|
const meta$6 = {
|
|
89
|
-
type: 'problem',
|
|
90
114
|
docs: {
|
|
91
|
-
description: 'Enforce
|
|
115
|
+
description: 'Enforce erasableSyntaxOnly'
|
|
92
116
|
},
|
|
93
117
|
messages: {
|
|
94
|
-
|
|
95
|
-
}
|
|
118
|
+
erasableSyntaxOnly: 'erasableSyntaxOnly rule should be enabled'
|
|
119
|
+
},
|
|
120
|
+
type: 'problem'
|
|
96
121
|
};
|
|
97
122
|
const create$6 = context => {
|
|
98
|
-
return create$a(context, '
|
|
123
|
+
return create$a(context, 'erasableSyntaxOnly');
|
|
99
124
|
};
|
|
100
125
|
|
|
101
|
-
const
|
|
126
|
+
const tsconfigErasableSyntaxOnly = {
|
|
102
127
|
__proto__: null,
|
|
103
128
|
create: create$6,
|
|
104
129
|
meta: meta$6
|
|
105
130
|
};
|
|
106
131
|
|
|
107
132
|
const meta$5 = {
|
|
108
|
-
type: 'problem',
|
|
109
133
|
docs: {
|
|
110
|
-
description: '
|
|
134
|
+
description: 'Enforce exactOptionalPropertyTypes'
|
|
111
135
|
},
|
|
112
136
|
messages: {
|
|
113
|
-
|
|
114
|
-
}
|
|
137
|
+
exactOptionalPropertyTypes: 'exactOptionalPropertyTypes rule should be enabled'
|
|
138
|
+
},
|
|
139
|
+
type: 'problem'
|
|
115
140
|
};
|
|
116
141
|
const create$5 = context => {
|
|
117
|
-
return create$a(context, '
|
|
142
|
+
return create$a(context, 'exactOptionalPropertyTypes');
|
|
118
143
|
};
|
|
119
144
|
|
|
120
|
-
const
|
|
145
|
+
const tsconfigExactOptionalPropertyTypes = {
|
|
121
146
|
__proto__: null,
|
|
122
147
|
create: create$5,
|
|
123
148
|
meta: meta$5
|
|
124
149
|
};
|
|
125
150
|
|
|
126
151
|
const meta$4 = {
|
|
127
|
-
|
|
152
|
+
docs: {
|
|
153
|
+
description: 'Ensure that the forceConsistentCasingInFileNames rule is enabled'
|
|
154
|
+
},
|
|
155
|
+
messages: {
|
|
156
|
+
forceConsistentCasingInFileNames: 'forceConsistentCasingInFileNames rule should be enabled'
|
|
157
|
+
},
|
|
158
|
+
type: 'problem'
|
|
159
|
+
};
|
|
160
|
+
const create$4 = context => {
|
|
161
|
+
return create$a(context, 'forceConsistentCasingInFileNames');
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const tsconfigForceConsistentCasingInFileNames = {
|
|
165
|
+
__proto__: null,
|
|
166
|
+
create: create$4,
|
|
167
|
+
meta: meta$4
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const meta$3 = {
|
|
128
171
|
docs: {
|
|
129
172
|
description: 'Validate moduleResolution values'
|
|
130
173
|
},
|
|
131
174
|
messages: {
|
|
132
175
|
moduleResolution: 'moduleResolution must be set to bundle or nodenext'
|
|
133
|
-
}
|
|
176
|
+
},
|
|
177
|
+
type: 'problem'
|
|
134
178
|
};
|
|
135
179
|
const allowedValues = new Set(['bundle', 'nodenext']);
|
|
136
|
-
const create$
|
|
180
|
+
const create$3 = context => {
|
|
137
181
|
return {
|
|
138
182
|
Member(node) {
|
|
139
183
|
if (node.name.type !== 'String' || node.name.value !== 'compilerOptions' || node.value.type !== 'Object') {
|
|
@@ -164,147 +208,109 @@ const create$4 = context => {
|
|
|
164
208
|
};
|
|
165
209
|
|
|
166
210
|
const tsconfigModuleResolution = {
|
|
167
|
-
__proto__: null,
|
|
168
|
-
create: create$4,
|
|
169
|
-
meta: meta$4
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const meta$3 = {
|
|
173
|
-
type: 'problem',
|
|
174
|
-
docs: {
|
|
175
|
-
description: 'Disallow implicit any'
|
|
176
|
-
},
|
|
177
|
-
messages: {
|
|
178
|
-
noImplicitAny: 'noImplicitAny rule should be enabled'
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const create$3 = context => {
|
|
182
|
-
return create$a(context, 'noImplicitAny');
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const tsconfigNoImplicitAny = {
|
|
186
211
|
__proto__: null,
|
|
187
212
|
create: create$3,
|
|
188
213
|
meta: meta$3
|
|
189
214
|
};
|
|
190
215
|
|
|
191
216
|
const meta$2 = {
|
|
192
|
-
type: 'problem',
|
|
193
217
|
docs: {
|
|
194
|
-
description: 'Disallow
|
|
218
|
+
description: 'Disallow implicit any'
|
|
195
219
|
},
|
|
196
220
|
messages: {
|
|
197
|
-
|
|
198
|
-
}
|
|
221
|
+
noImplicitAny: 'noImplicitAny rule should be enabled'
|
|
222
|
+
},
|
|
223
|
+
type: 'problem'
|
|
199
224
|
};
|
|
200
225
|
const create$2 = context => {
|
|
201
|
-
return create$a(context, '
|
|
226
|
+
return create$a(context, 'noImplicitAny');
|
|
202
227
|
};
|
|
203
228
|
|
|
204
|
-
const
|
|
229
|
+
const tsconfigNoImplicitAny = {
|
|
205
230
|
__proto__: null,
|
|
206
231
|
create: create$2,
|
|
207
232
|
meta: meta$2
|
|
208
233
|
};
|
|
209
234
|
|
|
210
235
|
const meta$1 = {
|
|
211
|
-
type: 'problem',
|
|
212
236
|
docs: {
|
|
213
|
-
description: '
|
|
237
|
+
description: 'Disallow not allowed keys in JSON objects'
|
|
214
238
|
},
|
|
215
239
|
messages: {
|
|
216
|
-
|
|
217
|
-
}
|
|
240
|
+
noUncheckedSideEffectImports: 'noUncheckedSideEffectImports rule should be enabled'
|
|
241
|
+
},
|
|
242
|
+
type: 'problem'
|
|
218
243
|
};
|
|
219
244
|
const create$1 = context => {
|
|
220
|
-
return create$a(context, '
|
|
245
|
+
return create$a(context, 'noUncheckedSideEffectImports');
|
|
221
246
|
};
|
|
222
247
|
|
|
223
|
-
const
|
|
248
|
+
const tsconfigNoUncheckedSideEffectImports = {
|
|
224
249
|
__proto__: null,
|
|
225
250
|
create: create$1,
|
|
226
251
|
meta: meta$1
|
|
227
252
|
};
|
|
228
253
|
|
|
229
254
|
const meta = {
|
|
230
|
-
type: 'problem',
|
|
231
255
|
docs: {
|
|
232
|
-
description: '
|
|
256
|
+
description: 'Ensure that the strict mode is enabled'
|
|
233
257
|
},
|
|
234
258
|
messages: {
|
|
235
|
-
|
|
236
|
-
}
|
|
259
|
+
strict: 'strict mode should be enabled'
|
|
260
|
+
},
|
|
261
|
+
type: 'problem'
|
|
237
262
|
};
|
|
238
263
|
const create = context => {
|
|
239
|
-
return
|
|
240
|
-
Member(node) {
|
|
241
|
-
if (node.name.type === 'String' && node.name.value === 'compilerOptions' && node.value.type === 'Object') {
|
|
242
|
-
const members = node.value.members;
|
|
243
|
-
for (const member of members) {
|
|
244
|
-
if (member.name.type === 'String' && member.name.value === 'skipLibCheck') {
|
|
245
|
-
if (member.value.value === true) {
|
|
246
|
-
context.report({
|
|
247
|
-
loc: member.name.loc,
|
|
248
|
-
messageId: 'skipLibCheck'
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// Allow omitting skipLibCheck
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
264
|
+
return create$a(context, 'strict');
|
|
259
265
|
};
|
|
260
266
|
|
|
261
|
-
const
|
|
267
|
+
const tsconfigStrict = {
|
|
262
268
|
__proto__: null,
|
|
263
269
|
create,
|
|
264
270
|
meta
|
|
265
271
|
};
|
|
266
272
|
|
|
267
273
|
const plugin = {
|
|
274
|
+
configs: {},
|
|
268
275
|
meta: {
|
|
269
276
|
name: 'tsconfig',
|
|
270
277
|
version: '0.0.1'
|
|
271
278
|
},
|
|
272
279
|
rules: {
|
|
273
|
-
'no-unchecked-side-effect-imports': tsconfigNoUncheckedSideEffectImports,
|
|
274
|
-
'force-consistent-casing-in-file-names': tsconfigForceConsistentCasingInFileNames,
|
|
275
|
-
strict: tsconfigStrict,
|
|
276
280
|
'allow-importing-ts-extensions': tsconfigAllowImportingTsExtensions,
|
|
277
|
-
'
|
|
278
|
-
'assume-changes-only-affect-direct-dependenices': tsconfigAssumeChangesOnlyAffectDirectDependencies,
|
|
279
|
-
'exact-optional-property-types': tsconfigExactOptionalPropertyTypes,
|
|
280
|
-
'erasable-syntax-only': tsconfigErasableSyntaxOnly,
|
|
281
|
+
'assume-changes-only-affect-direct-dependencies': tsconfigAssumeChangesOnlyAffectDirectDependencies,
|
|
281
282
|
'dont-skip-lib-check': tsconfigDontSkipLibCheck,
|
|
282
|
-
'
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
'erasable-syntax-only': tsconfigErasableSyntaxOnly,
|
|
284
|
+
'exact-optional-property-types': tsconfigExactOptionalPropertyTypes,
|
|
285
|
+
'force-consistent-casing-in-file-names': tsconfigForceConsistentCasingInFileNames,
|
|
286
|
+
'module-resolution': tsconfigModuleResolution,
|
|
287
|
+
'no-implicit-any': tsconfigNoImplicitAny,
|
|
288
|
+
'no-unchecked-side-effect-imports': tsconfigNoUncheckedSideEffectImports,
|
|
289
|
+
strict: tsconfigStrict
|
|
290
|
+
}
|
|
285
291
|
};
|
|
286
292
|
const recommended = [{
|
|
287
293
|
files: ['**/tsconfig.json'],
|
|
294
|
+
language: 'json/jsonc',
|
|
295
|
+
languageOptions: {
|
|
296
|
+
allowTrailingCommas: true
|
|
297
|
+
},
|
|
288
298
|
plugins: {
|
|
289
299
|
// @ts-ignore
|
|
290
300
|
json,
|
|
291
301
|
tsconfig: plugin
|
|
292
302
|
},
|
|
293
|
-
language: 'json/jsonc',
|
|
294
|
-
languageOptions: {
|
|
295
|
-
allowTrailingCommas: true
|
|
296
|
-
},
|
|
297
303
|
rules: {
|
|
298
|
-
'tsconfig/no-unchecked-side-effect-imports': 'error',
|
|
299
|
-
'tsconfig/force-consistent-casing-in-file-names': 'error',
|
|
300
|
-
'tsconfig/strict': 'error',
|
|
301
|
-
'tsconfig/erasable-syntax-only': 'off',
|
|
302
304
|
'tsconfig/allow-importing-ts-extensions': 'error',
|
|
303
|
-
'tsconfig/
|
|
304
|
-
'tsconfig/assume-changes-only-affect-direct-dependenices': 'error',
|
|
305
|
-
'tsconfig/exact-optional-property-types': 'error',
|
|
305
|
+
'tsconfig/assume-changes-only-affect-direct-dependencies': 'error',
|
|
306
306
|
'tsconfig/dont-skip-lib-check': 'error',
|
|
307
|
-
'tsconfig/
|
|
307
|
+
'tsconfig/erasable-syntax-only': 'off',
|
|
308
|
+
'tsconfig/exact-optional-property-types': 'error',
|
|
309
|
+
'tsconfig/force-consistent-casing-in-file-names': 'error',
|
|
310
|
+
'tsconfig/module-resolution': 'error',
|
|
311
|
+
'tsconfig/no-implicit-any': 'error',
|
|
312
|
+
'tsconfig/no-unchecked-side-effect-imports': 'error',
|
|
313
|
+
'tsconfig/strict': 'error'
|
|
308
314
|
}
|
|
309
315
|
}];
|
|
310
316
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/eslint-plugin-tsconfig",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/lvce-editor/eslint-config.git"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"keywords": [],
|
|
11
10
|
"license": "MIT",
|
|
12
|
-
"description": "",
|
|
11
|
+
"description": "ESLint rules for TypeScript configuration files.",
|
|
13
12
|
"dependencies": {
|
|
14
13
|
"@eslint/json": "2.0.0"
|
|
15
14
|
}
|