@lusc/eslint-config 3.1.1 → 3.2.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/configs/typescript.js +47 -42
- package/index.d.ts +6 -0
- package/index.js +28 -22
- package/package.json +1 -1
package/configs/typescript.js
CHANGED
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import tsEslint from 'typescript-eslint';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'error',
|
|
15
|
-
{
|
|
16
|
-
allowNumber: true,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
20
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
21
|
-
'@typescript-eslint/no-unused-vars': [
|
|
22
|
-
'error',
|
|
23
|
-
{
|
|
24
|
-
vars: 'all',
|
|
25
|
-
varsIgnorePattern: /^_/.source,
|
|
26
|
-
args: 'after-used',
|
|
27
|
-
ignoreRestSiblings: true,
|
|
28
|
-
argsIgnorePattern: /^_/.source,
|
|
29
|
-
caughtErrors: 'all',
|
|
30
|
-
caughtErrorsIgnorePattern: /^_$/.source,
|
|
3
|
+
/**
|
|
4
|
+
* @param {readonly string[]} globs
|
|
5
|
+
*/
|
|
6
|
+
export default function typescript(globs) {
|
|
7
|
+
return [
|
|
8
|
+
...tsEslint.configs.strictTypeChecked,
|
|
9
|
+
{
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parserOptions: {
|
|
12
|
+
projectService: true,
|
|
13
|
+
tsconfigRootDir: import.meta.dirname,
|
|
31
14
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
allowNumber: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
24
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
25
|
+
'@typescript-eslint/no-unused-vars': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
vars: 'all',
|
|
29
|
+
varsIgnorePattern: /^_/.source,
|
|
30
|
+
args: 'after-used',
|
|
31
|
+
ignoreRestSiblings: true,
|
|
32
|
+
argsIgnorePattern: /^_/.source,
|
|
33
|
+
caughtErrors: 'all',
|
|
34
|
+
caughtErrorsIgnorePattern: /^_$/.source,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'@typescript-eslint/no-misused-promises': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
checksConditionals: true,
|
|
41
|
+
// Useful for event handlers
|
|
42
|
+
checksVoidReturn: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
41
46
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
+
].map(config => ({
|
|
48
|
+
...config,
|
|
49
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', ...globs],
|
|
50
|
+
}));
|
|
51
|
+
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -12,27 +12,33 @@ import unicorn from './configs/unicorn.js';
|
|
|
12
12
|
|
|
13
13
|
const ignores = ['**/dist/', '**/.svelte-kit/', '**/build/'];
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
export function withOptions({typescriptGlobs}) {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
ignores,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
languageOptions: {
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.browser,
|
|
24
|
+
...globals.nodeBuiltin,
|
|
25
|
+
},
|
|
26
|
+
parser: tsParser,
|
|
27
|
+
ecmaVersion: 'latest',
|
|
28
|
+
sourceType: 'module',
|
|
24
29
|
},
|
|
25
|
-
parser: tsParser,
|
|
26
|
-
ecmaVersion: 'latest',
|
|
27
|
-
sourceType: 'module',
|
|
28
30
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
eslint,
|
|
32
|
+
comments,
|
|
33
|
+
promise,
|
|
34
|
+
unicorn,
|
|
35
|
+
n,
|
|
36
|
+
importConfig,
|
|
37
|
+
regexp,
|
|
38
|
+
typescript(typescriptGlobs),
|
|
39
|
+
].flat();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default withOptions({
|
|
43
|
+
typescriptGlobs: [],
|
|
44
|
+
});
|