@lusc/eslint-config 1.1.0 → 2.0.1
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 +50 -29
- package/package.json +5 -2
package/index.js
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import js from '@eslint/js';
|
|
2
2
|
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
3
|
+
import * as tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import eslintPluginImportX from 'eslint-plugin-import-x';
|
|
3
5
|
import nodePlugin from 'eslint-plugin-n';
|
|
4
6
|
import pluginPromise from 'eslint-plugin-promise';
|
|
5
7
|
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
6
|
-
import tseslint from 'typescript-eslint';
|
|
7
8
|
import globals from 'globals';
|
|
9
|
+
import {configs as tsConfigs} from 'typescript-eslint';
|
|
8
10
|
|
|
9
11
|
const ignores = ['dist/**', '.svelte-kit/**', 'build/**'];
|
|
10
12
|
|
|
11
13
|
export default [
|
|
12
14
|
{
|
|
13
15
|
ignores,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
16
|
languageOptions: {
|
|
17
17
|
globals: {
|
|
18
18
|
...globals.browser,
|
|
19
19
|
...globals.nodeBuiltin,
|
|
20
20
|
},
|
|
21
|
+
parser: tsParser,
|
|
22
|
+
ecmaVersion: 'latest',
|
|
23
|
+
sourceType: 'module',
|
|
21
24
|
},
|
|
22
25
|
},
|
|
23
26
|
js.configs.recommended,
|
|
27
|
+
...tsConfigs.strictTypeChecked.map(config => ({
|
|
28
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
29
|
+
...config,
|
|
30
|
+
})),
|
|
31
|
+
comments.recommended,
|
|
32
|
+
nodePlugin.configs['flat/recommended'],
|
|
33
|
+
pluginPromise.configs['flat/recommended'],
|
|
34
|
+
eslintPluginUnicorn.configs['flat/recommended'],
|
|
35
|
+
eslintPluginImportX.flatConfigs.recommended,
|
|
36
|
+
eslintPluginImportX.flatConfigs.typescript,
|
|
24
37
|
{
|
|
25
38
|
rules: {
|
|
26
39
|
'no-unused-vars': [
|
|
@@ -35,12 +48,40 @@ export default [
|
|
|
35
48
|
caughtErrorsIgnorePattern: /^_$/.source,
|
|
36
49
|
},
|
|
37
50
|
],
|
|
51
|
+
'promise/prefer-await-to-then': 'error',
|
|
52
|
+
'promise/always-return': 'off',
|
|
53
|
+
'unicorn/no-null': 'off',
|
|
54
|
+
// Math.min and max don't support bigint, so ternary is necessary there
|
|
55
|
+
'unicorn/prefer-math-min-max': 'off',
|
|
56
|
+
'n/no-missing-import': 'off',
|
|
57
|
+
// Too many false positives
|
|
58
|
+
'no-empty': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
allowEmptyCatch: true,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
'n/prefer-global/buffer': ['error', 'never'],
|
|
65
|
+
'n/prefer-global/process': ['error', 'never'],
|
|
66
|
+
'n/prefer-node-protocol': 'error',
|
|
67
|
+
'import-x/no-useless-path-segments': 'error',
|
|
68
|
+
'import-x/no-commonjs': 'error',
|
|
69
|
+
'import-x/first': 'error',
|
|
70
|
+
'import-x/newline-after-import': 'error',
|
|
71
|
+
'import-x/order': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
|
|
75
|
+
'newlines-between': 'always',
|
|
76
|
+
warnOnUnassignedImports: true,
|
|
77
|
+
alphabetize: {
|
|
78
|
+
order: 'asc',
|
|
79
|
+
caseInsensitive: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
38
83
|
},
|
|
39
84
|
},
|
|
40
|
-
...tseslint.configs.strictTypeChecked.map(config => ({
|
|
41
|
-
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
42
|
-
...config,
|
|
43
|
-
})),
|
|
44
85
|
{
|
|
45
86
|
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
46
87
|
languageOptions: {
|
|
@@ -56,7 +97,9 @@ export default [
|
|
|
56
97
|
allowNumber: true,
|
|
57
98
|
},
|
|
58
99
|
],
|
|
100
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
59
101
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
102
|
+
'no-unused-vars': 'off',
|
|
60
103
|
'@typescript-eslint/no-unused-vars': [
|
|
61
104
|
'error',
|
|
62
105
|
{
|
|
@@ -79,26 +122,4 @@ export default [
|
|
|
79
122
|
],
|
|
80
123
|
},
|
|
81
124
|
},
|
|
82
|
-
comments.recommended,
|
|
83
|
-
nodePlugin.configs['flat/recommended'],
|
|
84
|
-
pluginPromise.configs['flat/recommended'],
|
|
85
|
-
eslintPluginUnicorn.configs['flat/recommended'],
|
|
86
|
-
{
|
|
87
|
-
rules: {
|
|
88
|
-
'promise/prefer-await-to-then': 'error',
|
|
89
|
-
'promise/always-return': 'off',
|
|
90
|
-
'unicorn/no-null': 'off',
|
|
91
|
-
// Math.min and max don't support bigint, so ternary is necessary there
|
|
92
|
-
'unicorn/prefer-math-min-max': 'off',
|
|
93
|
-
'n/no-missing-import': 'off',
|
|
94
|
-
// Too many false positives
|
|
95
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
96
|
-
'no-empty': [
|
|
97
|
-
'error',
|
|
98
|
-
{
|
|
99
|
-
allowEmptyCatch: true,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
125
|
];
|
package/package.json
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
8
8
|
"@eslint/js": "^9.14.0",
|
|
9
|
-
"eslint
|
|
9
|
+
"@typescript-eslint/parser": "^8.13.0",
|
|
10
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
11
|
+
"eslint-plugin-import-x": "^4.4.0",
|
|
12
|
+
"eslint-plugin-n": "^17.13.1",
|
|
10
13
|
"eslint-plugin-promise": "^7.1.0",
|
|
11
14
|
"eslint-plugin-unicorn": "^56.0.0",
|
|
12
15
|
"globals": "^15.12.0",
|
|
@@ -38,6 +41,6 @@
|
|
|
38
41
|
"fmt": "prettier -w .",
|
|
39
42
|
"lint": "eslint --fix"
|
|
40
43
|
},
|
|
41
|
-
"version": "
|
|
44
|
+
"version": "2.0.1",
|
|
42
45
|
"type": "module"
|
|
43
46
|
}
|