@wkovacs64/eslint-config 7.2.1 → 7.2.3
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/index.js +106 -109
- package/package.json +4 -3
package/index.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
//
|
3
3
|
// Forked from https://github.com/epicweb-dev/config
|
4
4
|
//
|
5
|
+
import resolveFrom from 'resolve-from';
|
5
6
|
import globals from 'globals';
|
6
7
|
import eslint from '@eslint/js';
|
7
8
|
import tseslint from 'typescript-eslint';
|
@@ -13,18 +14,16 @@ const ERROR = 'error';
|
|
13
14
|
const WARN = 'warn';
|
14
15
|
const OFF = 'off';
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
() => false,
|
20
|
-
);
|
17
|
+
function has(pkgName) {
|
18
|
+
return Boolean(resolveFrom.silent(process.cwd(), pkgName));
|
19
|
+
}
|
21
20
|
|
22
|
-
const hasTypeScript =
|
23
|
-
const hasReact =
|
24
|
-
const hasTestingLibrary =
|
25
|
-
const hasJestDom =
|
26
|
-
const hasVitest =
|
27
|
-
const hasPlaywright =
|
21
|
+
const hasTypeScript = has('typescript');
|
22
|
+
const hasReact = has('react');
|
23
|
+
const hasTestingLibrary = has('@testing-library/dom');
|
24
|
+
const hasJestDom = has('@testing-library/jest-dom');
|
25
|
+
const hasVitest = has('vitest');
|
26
|
+
const hasPlaywright = has('@playwright/test');
|
28
27
|
|
29
28
|
const vitestFiles = ['**/__tests__/**/*', '**/*.test.*'];
|
30
29
|
const testFiles = ['**/tests/**', '**/#tests/**', ...vitestFiles];
|
@@ -160,108 +159,106 @@ export const config = [
|
|
160
159
|
// TODO: figure out how to switch to type-checked configs
|
161
160
|
...tseslint.configs.recommended,
|
162
161
|
...tseslint.configs.stylistic,
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
parserOptions: {
|
170
|
-
parser: tseslint.parser,
|
171
|
-
projectService: true,
|
172
|
-
},
|
173
|
-
},
|
174
|
-
plugins: {
|
175
|
-
'@typescript-eslint': tseslint.plugin,
|
176
|
-
},
|
177
|
-
rules: {
|
178
|
-
'@typescript-eslint/ban-ts-comment': OFF,
|
179
|
-
'@typescript-eslint/consistent-type-assertions': [
|
180
|
-
ERROR,
|
181
|
-
{
|
182
|
-
assertionStyle: 'as',
|
183
|
-
objectLiteralTypeAssertions: 'allow-as-parameter',
|
184
|
-
},
|
185
|
-
],
|
186
|
-
'@typescript-eslint/consistent-type-definitions': OFF,
|
187
|
-
// Note: use this rule _OR_ verbatimModuleSyntax in tsconfig.json - not both
|
188
|
-
// '@typescript-eslint/consistent-type-imports': [
|
189
|
-
// ERROR,
|
190
|
-
// {
|
191
|
-
// prefer: 'type-imports',
|
192
|
-
// disallowTypeAnnotations: true,
|
193
|
-
// fixStyle: 'inline-type-imports',
|
194
|
-
// },
|
195
|
-
// ],
|
196
|
-
'@typescript-eslint/explicit-module-boundary-types': OFF,
|
197
|
-
'@typescript-eslint/naming-convention': [
|
198
|
-
ERROR,
|
199
|
-
{
|
200
|
-
selector: 'typeLike',
|
201
|
-
format: ['PascalCase'],
|
202
|
-
custom: { regex: '^I[A-Z]', match: false },
|
203
|
-
},
|
204
|
-
],
|
205
|
-
'@typescript-eslint/no-confusing-void-expression': [
|
206
|
-
ERROR,
|
207
|
-
{
|
208
|
-
ignoreArrowShorthand: true,
|
209
|
-
},
|
210
|
-
],
|
211
|
-
'@typescript-eslint/no-explicit-any': OFF,
|
212
|
-
'@typescript-eslint/no-floating-promises': [
|
213
|
-
ERROR,
|
214
|
-
{
|
215
|
-
ignoreIIFE: true,
|
216
|
-
},
|
217
|
-
],
|
218
|
-
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
219
|
-
'no-invalid-this': OFF,
|
220
|
-
'@typescript-eslint/no-invalid-this': ERROR,
|
221
|
-
'no-redeclare': OFF,
|
222
|
-
'@typescript-eslint/no-non-null-assertion': OFF,
|
223
|
-
'@typescript-eslint/no-redeclare': ERROR,
|
224
|
-
'no-shadow': OFF,
|
225
|
-
'@typescript-eslint/no-shadow': ERROR,
|
226
|
-
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
|
227
|
-
'@typescript-eslint/no-unused-vars': [
|
228
|
-
ERROR,
|
229
|
-
{
|
230
|
-
vars: 'all',
|
231
|
-
args: 'after-used',
|
232
|
-
argsIgnorePattern: '^_',
|
233
|
-
ignoreRestSiblings: true,
|
234
|
-
},
|
235
|
-
],
|
236
|
-
'no-use-before-define': OFF,
|
237
|
-
'@typescript-eslint/no-use-before-define': [
|
238
|
-
ERROR,
|
239
|
-
{
|
240
|
-
functions: false,
|
241
|
-
classes: true,
|
242
|
-
variables: true,
|
243
|
-
},
|
244
|
-
],
|
245
|
-
'@typescript-eslint/prefer-nullish-coalescing': OFF,
|
246
|
-
'@typescript-eslint/restrict-template-expressions': [
|
247
|
-
ERROR,
|
248
|
-
{
|
249
|
-
allowBoolean: true,
|
250
|
-
allowNullish: true,
|
162
|
+
{
|
163
|
+
files: ['**/*.ts?(x)'],
|
164
|
+
languageOptions: {
|
165
|
+
parserOptions: {
|
166
|
+
parser: tseslint.parser,
|
167
|
+
projectService: true,
|
251
168
|
},
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
typescript:
|
259
|
-
|
169
|
+
},
|
170
|
+
plugins: {
|
171
|
+
'@typescript-eslint': tseslint.plugin,
|
172
|
+
},
|
173
|
+
rules: {
|
174
|
+
'@typescript-eslint/ban-ts-comment': OFF,
|
175
|
+
'@typescript-eslint/consistent-type-assertions': [
|
176
|
+
ERROR,
|
177
|
+
{
|
178
|
+
assertionStyle: 'as',
|
179
|
+
objectLiteralTypeAssertions: 'allow-as-parameter',
|
180
|
+
},
|
181
|
+
],
|
182
|
+
'@typescript-eslint/consistent-type-definitions': OFF,
|
183
|
+
// Note: use this rule _OR_ verbatimModuleSyntax in tsconfig.json - not both
|
184
|
+
// '@typescript-eslint/consistent-type-imports': [
|
185
|
+
// ERROR,
|
186
|
+
// {
|
187
|
+
// prefer: 'type-imports',
|
188
|
+
// disallowTypeAnnotations: true,
|
189
|
+
// fixStyle: 'inline-type-imports',
|
190
|
+
// },
|
191
|
+
// ],
|
192
|
+
'@typescript-eslint/explicit-module-boundary-types': OFF,
|
193
|
+
'@typescript-eslint/naming-convention': [
|
194
|
+
ERROR,
|
195
|
+
{
|
196
|
+
selector: 'typeLike',
|
197
|
+
format: ['PascalCase'],
|
198
|
+
custom: { regex: '^I[A-Z]', match: false },
|
199
|
+
},
|
200
|
+
],
|
201
|
+
'@typescript-eslint/no-confusing-void-expression': [
|
202
|
+
ERROR,
|
203
|
+
{
|
204
|
+
ignoreArrowShorthand: true,
|
205
|
+
},
|
206
|
+
],
|
207
|
+
'@typescript-eslint/no-explicit-any': OFF,
|
208
|
+
'@typescript-eslint/no-floating-promises': [
|
209
|
+
ERROR,
|
210
|
+
{
|
211
|
+
ignoreIIFE: true,
|
212
|
+
},
|
213
|
+
],
|
214
|
+
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
215
|
+
'no-invalid-this': OFF,
|
216
|
+
'@typescript-eslint/no-invalid-this': ERROR,
|
217
|
+
'no-redeclare': OFF,
|
218
|
+
'@typescript-eslint/no-non-null-assertion': OFF,
|
219
|
+
'@typescript-eslint/no-redeclare': ERROR,
|
220
|
+
'no-shadow': OFF,
|
221
|
+
'@typescript-eslint/no-shadow': ERROR,
|
222
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
|
223
|
+
'@typescript-eslint/no-unused-vars': [
|
224
|
+
ERROR,
|
225
|
+
{
|
226
|
+
vars: 'all',
|
227
|
+
args: 'after-used',
|
228
|
+
argsIgnorePattern: '^_',
|
229
|
+
ignoreRestSiblings: true,
|
230
|
+
},
|
231
|
+
],
|
232
|
+
'no-use-before-define': OFF,
|
233
|
+
'@typescript-eslint/no-use-before-define': [
|
234
|
+
ERROR,
|
235
|
+
{
|
236
|
+
functions: false,
|
237
|
+
classes: true,
|
238
|
+
variables: true,
|
239
|
+
},
|
240
|
+
],
|
241
|
+
'@typescript-eslint/prefer-nullish-coalescing': OFF,
|
242
|
+
'@typescript-eslint/restrict-template-expressions': [
|
243
|
+
ERROR,
|
244
|
+
{
|
245
|
+
allowBoolean: true,
|
246
|
+
allowNullish: true,
|
247
|
+
},
|
248
|
+
],
|
249
|
+
'@typescript-eslint/require-await': OFF,
|
250
|
+
'@typescript-eslint/unified-signatures': 'warn',
|
251
|
+
},
|
252
|
+
settings: {
|
253
|
+
'import/resolver': {
|
254
|
+
typescript: {
|
255
|
+
alwaysTryTypes: true,
|
256
|
+
},
|
260
257
|
},
|
261
258
|
},
|
262
259
|
},
|
263
|
-
|
264
|
-
:
|
260
|
+
]
|
261
|
+
: []),
|
265
262
|
|
266
263
|
// This assumes test files are those which are in the test directory or have
|
267
264
|
// *.test.* in the filename. If a file doesn't match this assumption, then it
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wkovacs64/eslint-config",
|
3
|
-
"version": "7.2.
|
3
|
+
"version": "7.2.3",
|
4
4
|
"description": "@wKovacs64 ESLint config",
|
5
5
|
"keywords": [
|
6
6
|
"eslint",
|
@@ -60,18 +60,19 @@
|
|
60
60
|
"eslint-plugin-testing-library": "^6.2.2",
|
61
61
|
"eslint-plugin-vitest": "^0.5.4",
|
62
62
|
"globals": "^15.3.0",
|
63
|
+
"resolve-from": "5.0.0",
|
63
64
|
"typescript-eslint": "^8.0.0-alpha.20"
|
64
65
|
},
|
65
66
|
"devDependencies": {
|
66
67
|
"@changesets/changelog-github": "0.5.0",
|
67
68
|
"@changesets/cli": "2.27.5",
|
68
69
|
"@types/eslint__js": "8.42.3",
|
69
|
-
"@types/node": "20.14.
|
70
|
+
"@types/node": "20.14.2",
|
70
71
|
"@types/react": "18.3.3",
|
71
72
|
"@types/react-dom": "18.3.0",
|
72
73
|
"@wkovacs64/prettier-config": "4.1.0",
|
73
74
|
"eslint": "8.57.0",
|
74
|
-
"prettier": "3.3.
|
75
|
+
"prettier": "3.3.1",
|
75
76
|
"typescript": "5.4.5"
|
76
77
|
}
|
77
78
|
}
|