@dr.pogodin/eslint-configs 0.2.3 → 0.2.5
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/config/javascript.js +24 -5
- package/config/typescript.js +13 -4
- package/package.json +2 -2
package/config/javascript.js
CHANGED
|
@@ -11,7 +11,7 @@ import babelPlugin from '@babel/eslint-plugin';
|
|
|
11
11
|
import js from '@eslint/js';
|
|
12
12
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
export function newJsConfig({ noPerf } = {}) {
|
|
15
15
|
const extentions = [
|
|
16
16
|
'js/recommended',
|
|
17
17
|
'@stylistic/recommended',
|
|
@@ -24,8 +24,8 @@ function newConfig({ noPerf } = {}) {
|
|
|
24
24
|
'@babel/new-cap': 'error',
|
|
25
25
|
'@babel/no-invalid-this': 'error',
|
|
26
26
|
|
|
27
|
-
'@babel/no-undef': 'error',
|
|
28
27
|
'no-undef': 'off',
|
|
28
|
+
'@babel/no-undef': 'error',
|
|
29
29
|
|
|
30
30
|
'@babel/no-unused-expressions': 'error',
|
|
31
31
|
|
|
@@ -285,6 +285,7 @@ function newConfig({ noPerf } = {}) {
|
|
|
285
285
|
.sortByNaturalSort()
|
|
286
286
|
.placeAllWithCaseBeforeAllWithOtherCase('uppercase')
|
|
287
287
|
.placeCharacterBefore({ characterAfter: '-', characterBefore: '/' })
|
|
288
|
+
.placeCharacterAfter({ characterAfter: '@', characterBefore: 'z' })
|
|
288
289
|
.getCharacters();
|
|
289
290
|
|
|
290
291
|
settings.perfectionist = {
|
|
@@ -294,6 +295,24 @@ function newConfig({ noPerf } = {}) {
|
|
|
294
295
|
newlinesInside: 'ignore',
|
|
295
296
|
partitionByNewLine: true,
|
|
296
297
|
};
|
|
298
|
+
|
|
299
|
+
rules['perfectionist/sort-imports'] = ['error', {
|
|
300
|
+
alphabet,
|
|
301
|
+
groups: [
|
|
302
|
+
'builtin',
|
|
303
|
+
'external',
|
|
304
|
+
'internal',
|
|
305
|
+
'parent',
|
|
306
|
+
'sibling',
|
|
307
|
+
'index',
|
|
308
|
+
'style',
|
|
309
|
+
'unknown',
|
|
310
|
+
],
|
|
311
|
+
newlinesBetween: 1,
|
|
312
|
+
newlinesInside: 'ignore',
|
|
313
|
+
partitionByNewLine: false,
|
|
314
|
+
type: 'custom',
|
|
315
|
+
}];
|
|
297
316
|
}
|
|
298
317
|
|
|
299
318
|
return defineConfig([{
|
|
@@ -307,15 +326,15 @@ function newConfig({ noPerf } = {}) {
|
|
|
307
326
|
},
|
|
308
327
|
name: 'dr.pogodin/javascript',
|
|
309
328
|
plugins: {
|
|
329
|
+
js,
|
|
310
330
|
'@babel': babelPlugin,
|
|
311
331
|
'@stylistic': stylisticPlugin,
|
|
312
|
-
js,
|
|
313
332
|
},
|
|
314
333
|
rules,
|
|
315
334
|
settings,
|
|
316
335
|
}]);
|
|
317
336
|
}
|
|
318
337
|
|
|
319
|
-
export const javascriptNoPerf =
|
|
338
|
+
export const javascriptNoPerf = newJsConfig({ noPerf: true });
|
|
320
339
|
|
|
321
|
-
export default
|
|
340
|
+
export default newJsConfig();
|
package/config/typescript.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { defineConfig } from 'eslint/config';
|
|
2
2
|
import tsEsLint from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { javascriptNoPerf, newJsConfig } from './javascript.js';
|
|
5
5
|
|
|
6
6
|
function newConfig({ noPerf } = {}) {
|
|
7
|
+
const jsConfig = newJsConfig();
|
|
8
|
+
|
|
9
|
+
// TODO: It is not the best way to modify this rule's settings,
|
|
10
|
+
// it will be better to expose this as an option of newJsConfig()
|
|
11
|
+
// function.
|
|
12
|
+
jsConfig[0].rules['perfectionist/sort-imports'][1].tsconfig = {
|
|
13
|
+
rootDir: '.',
|
|
14
|
+
};
|
|
15
|
+
|
|
7
16
|
let extentions = [
|
|
8
17
|
jsConfig,
|
|
9
18
|
tsEsLint.configs.recommendedTypeChecked,
|
|
@@ -50,8 +59,8 @@ function newConfig({ noPerf } = {}) {
|
|
|
50
59
|
|
|
51
60
|
// NOTE: The core rule variant reports incorrect errors on TypeScript
|
|
52
61
|
// code, thus disabled.
|
|
53
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
54
62
|
'no-shadow': 'off',
|
|
63
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
55
64
|
|
|
56
65
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
57
66
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
@@ -61,8 +70,8 @@ function newConfig({ noPerf } = {}) {
|
|
|
61
70
|
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
62
71
|
|
|
63
72
|
// NOTE: Disables the base rule as it can report incorrect errors.
|
|
64
|
-
'@typescript-eslint/no-unused-private-class-members': 'error',
|
|
65
73
|
'no-unused-private-class-members': 'off',
|
|
74
|
+
'@typescript-eslint/no-unused-private-class-members': 'error',
|
|
66
75
|
|
|
67
76
|
'@typescript-eslint/no-use-before-define': 'error',
|
|
68
77
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
@@ -73,8 +82,8 @@ function newConfig({ noPerf } = {}) {
|
|
|
73
82
|
|
|
74
83
|
// NOTE: The core variant of this rule, disabled below, does not work
|
|
75
84
|
// correctly for TypeScript code in some edge cases.
|
|
76
|
-
'@typescript-eslint/prefer-destructuring': 'error',
|
|
77
85
|
'prefer-destructuring': 'off',
|
|
86
|
+
'@typescript-eslint/prefer-destructuring': 'error',
|
|
78
87
|
|
|
79
88
|
'@typescript-eslint/prefer-enum-initializers': 'error',
|
|
80
89
|
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dr.pogodin/eslint-configs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "ESLint configurations for TypeScript and/or React projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./config/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/eslint-parser": "^7.28.6",
|
|
33
33
|
"@babel/eslint-plugin": "^7.27.1",
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
34
|
+
"@babel/preset-env": "^7.29.0",
|
|
35
35
|
"@babel/preset-react": "^7.28.5",
|
|
36
36
|
"@babel/preset-typescript": "^7.28.5",
|
|
37
37
|
"@eslint/js": "^9.39.2",
|