@aliexme/eslint-config 2.3.0 → 3.1.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/README.md +19 -19
- package/configs/base.js +6 -63
- package/configs/import.js +62 -58
- package/configs/package-json.js +12 -0
- package/configs/prettier.js +2 -49
- package/configs/react-native.js +3 -3
- package/configs/react.js +3 -16
- package/configs/recommended.js +8 -6
- package/configs/stylistic.js +73 -15
- package/configs/typescript.js +2 -9
- package/index.js +4 -3
- package/package.json +29 -25
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ Extend your ESLint config file:
|
|
|
15
15
|
```js
|
|
16
16
|
import eslintConfigRecommended from '@aliexme/eslint-config'
|
|
17
17
|
|
|
18
|
-
export default [
|
|
19
|
-
|
|
20
|
-
]
|
|
18
|
+
export default defineConfig([
|
|
19
|
+
eslintConfigRecommended, // <--
|
|
20
|
+
])
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### React
|
|
@@ -33,10 +33,10 @@ And add the following lines to your ESLint config file:
|
|
|
33
33
|
```js
|
|
34
34
|
import eslintConfigReact from '@aliexme/eslint-config/react'
|
|
35
35
|
|
|
36
|
-
export default [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|
|
36
|
+
export default defineConfig([
|
|
37
|
+
eslintConfigRecommended,
|
|
38
|
+
eslintConfigReact, // <--
|
|
39
|
+
])
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### React Native
|
|
@@ -52,10 +52,10 @@ And add the following lines to your ESLint config file:
|
|
|
52
52
|
```js
|
|
53
53
|
import eslintConfigReactNative from '@aliexme/eslint-config/react-native'
|
|
54
54
|
|
|
55
|
-
export default [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
]
|
|
55
|
+
export default defineConfig([
|
|
56
|
+
eslintConfigRecommended,
|
|
57
|
+
eslintConfigReactNative, // <--
|
|
58
|
+
])
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### Vue
|
|
@@ -71,10 +71,10 @@ And add the following lines to your ESLint config file:
|
|
|
71
71
|
```js
|
|
72
72
|
import eslintConfigVue from '@aliexme/eslint-config/vue'
|
|
73
73
|
|
|
74
|
-
export default [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
]
|
|
74
|
+
export default defineConfig([
|
|
75
|
+
eslintConfigRecommended,
|
|
76
|
+
eslintConfigVue, // <--
|
|
77
|
+
])
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
### Prettier
|
|
@@ -90,8 +90,8 @@ And add the following lines to your ESLint config file:
|
|
|
90
90
|
```js
|
|
91
91
|
import eslintConfigPrettier from '@aliexme/eslint-config/prettier'
|
|
92
92
|
|
|
93
|
-
export default [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]
|
|
93
|
+
export default defineConfig([
|
|
94
|
+
eslintConfigRecommended,
|
|
95
|
+
eslintConfigPrettier, // <--
|
|
96
|
+
])
|
|
97
97
|
```
|
package/configs/base.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
|
+
import eslint from '@eslint/js'
|
|
2
3
|
import globals from 'globals'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
eslintJs.configs.recommended,
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
eslint.configs.recommended,
|
|
7
7
|
{
|
|
8
|
-
name: '@aliexme/eslint-config
|
|
8
|
+
name: '@aliexme/eslint-config/base',
|
|
9
9
|
languageOptions: {
|
|
10
10
|
ecmaVersion: 'latest',
|
|
11
11
|
sourceType: 'module',
|
|
@@ -16,38 +16,7 @@ export default [
|
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
rules: {
|
|
19
|
-
quotes: ['error', 'single'],
|
|
20
|
-
'jsx-quotes': ['error', 'prefer-single'],
|
|
21
|
-
'quote-props': ['error', 'as-needed'],
|
|
22
|
-
semi: ['error', 'never'],
|
|
23
|
-
indent: ['error', 2, { SwitchCase: 1, offsetTernaryExpressions: true }],
|
|
24
|
-
'max-len': ['error', 120],
|
|
25
|
-
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0, maxBOF: 0 }],
|
|
26
|
-
'comma-dangle': ['error', 'always-multiline'],
|
|
27
|
-
'comma-spacing': ['error', { before: false, after: true }],
|
|
28
|
-
'comma-style': ['error', 'last'],
|
|
29
|
-
'key-spacing': 'error',
|
|
30
|
-
'keyword-spacing': ['error', { before: true, after: true }],
|
|
31
|
-
'object-curly-spacing': ['error', 'always'],
|
|
32
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
33
|
-
'computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
|
|
34
|
-
'arrow-spacing': 'error',
|
|
35
|
-
'switch-colon-spacing': ['error', { after: true, before: false }],
|
|
36
|
-
'space-in-parens': ['error', 'never'],
|
|
37
|
-
'space-before-function-paren': [
|
|
38
|
-
'error',
|
|
39
|
-
{
|
|
40
|
-
anonymous: 'never',
|
|
41
|
-
named: 'never',
|
|
42
|
-
asyncArrow: 'always',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
'space-before-blocks': ['error', 'always'],
|
|
46
19
|
'no-constant-condition': ['error', { checkLoops: false }],
|
|
47
|
-
'no-trailing-spaces': 'error',
|
|
48
|
-
'no-multi-spaces': 'error',
|
|
49
|
-
'eol-last': 'error',
|
|
50
|
-
'arrow-parens': 'error',
|
|
51
20
|
'no-useless-rename': 'error',
|
|
52
21
|
'no-var': 'error',
|
|
53
22
|
'prefer-const': 'error',
|
|
@@ -58,48 +27,22 @@ export default [
|
|
|
58
27
|
'array-callback-return': ['error', { checkForEach: true }],
|
|
59
28
|
'prefer-destructuring': ['error', { array: false, object: true }, { enforceForRenamedProperties: false }],
|
|
60
29
|
'prefer-template': 'error',
|
|
61
|
-
'template-curly-spacing': ['error', 'never'],
|
|
62
30
|
'no-eval': 'error',
|
|
63
|
-
'wrap-iife': ['error', 'inside', { functionPrototypeMethods: true }],
|
|
64
31
|
'no-loop-func': 'error',
|
|
65
32
|
'prefer-rest-params': 'error',
|
|
66
33
|
'default-param-last': 'error',
|
|
67
34
|
'no-new-func': 'error',
|
|
68
35
|
'no-param-reassign': ['error', { props: true }],
|
|
69
36
|
'prefer-spread': 'error',
|
|
70
|
-
'space-infix-ops': ['error', { int32Hint: true }],
|
|
71
|
-
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
72
|
-
'object-curly-newline': ['error', { consistent: true }],
|
|
73
37
|
'prefer-arrow-callback': 'error',
|
|
74
38
|
'no-empty-function': 'error',
|
|
75
39
|
'no-useless-constructor': 'error',
|
|
76
40
|
'dot-notation': 'error',
|
|
77
41
|
'one-var': ['error', 'never'],
|
|
78
42
|
'no-multi-assign': 'error',
|
|
79
|
-
'operator-linebreak': [
|
|
80
|
-
'error',
|
|
81
|
-
'before',
|
|
82
|
-
{
|
|
83
|
-
overrides: { '=': 'after' },
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
43
|
eqeqeq: 'error',
|
|
87
44
|
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
88
45
|
'no-nested-ternary': 'error',
|
|
89
|
-
'no-mixed-operators': 'error',
|
|
90
|
-
'brace-style': ['error', '1tbs'],
|
|
91
|
-
'spaced-comment': [
|
|
92
|
-
'error',
|
|
93
|
-
'always',
|
|
94
|
-
{
|
|
95
|
-
markers: ['/', '!', '?'],
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 2 }],
|
|
99
|
-
'no-whitespace-before-property': 'error',
|
|
100
|
-
'padded-blocks': ['error', 'never'],
|
|
101
|
-
'block-spacing': ['error', 'always'],
|
|
102
|
-
'func-call-spacing': ['error', 'never'],
|
|
103
46
|
'no-new-wrappers': 'error',
|
|
104
47
|
radix: ['error', 'as-needed'],
|
|
105
48
|
'id-length': [
|
|
@@ -132,4 +75,4 @@ export default [
|
|
|
132
75
|
'no-console': 'warn',
|
|
133
76
|
},
|
|
134
77
|
},
|
|
135
|
-
]
|
|
78
|
+
])
|
package/configs/import.js
CHANGED
|
@@ -1,61 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import eslintPluginImport from 'eslint-plugin-import'
|
|
1
|
+
import tseslint from 'typescript-eslint'
|
|
2
|
+
import { createNodeResolver, importX } from 'eslint-plugin-import-x'
|
|
3
|
+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export default /** @type {import('eslint').Linter.Config[]} */ (
|
|
6
|
+
tseslint.config([
|
|
7
|
+
importX.flatConfigs.recommended,
|
|
8
|
+
importX.flatConfigs.typescript,
|
|
9
|
+
{
|
|
10
|
+
name: '@aliexme/eslint-config/import',
|
|
11
|
+
settings: {
|
|
12
|
+
'import-x/resolver-next': [
|
|
13
|
+
createNodeResolver({ modules: ['src/', 'node_modules'] }),
|
|
14
|
+
createTypeScriptImportResolver(),
|
|
15
|
+
],
|
|
16
|
+
'import-x/extensions': [
|
|
17
|
+
'.js',
|
|
18
|
+
'.cjs',
|
|
19
|
+
'.mjs',
|
|
20
|
+
'.jsx',
|
|
21
|
+
'.ts',
|
|
22
|
+
'.cts',
|
|
23
|
+
'.mts',
|
|
24
|
+
'.tsx',
|
|
25
|
+
'.vue',
|
|
26
|
+
'.svelte',
|
|
27
|
+
'.astro',
|
|
28
|
+
],
|
|
29
|
+
'import-x/ignore': ['node_modules'],
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
'import-x/order': [
|
|
33
|
+
'error',
|
|
34
|
+
{
|
|
35
|
+
groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'object'],
|
|
36
|
+
pathGroups: [
|
|
37
|
+
{ pattern: '{react*,vue*,svelte*,astro*}', group: 'external', position: 'before' },
|
|
38
|
+
{ pattern: '{next*,nuxt*}', group: 'external', position: 'before' },
|
|
39
|
+
{ pattern: '@aliexme/**', group: 'external', position: 'after' },
|
|
40
|
+
{ pattern: '#*', group: 'external', position: 'after' },
|
|
41
|
+
{ pattern: './**/{styles,*.styles,*.css,*.scss}', group: 'internal', position: 'before' },
|
|
42
|
+
{ pattern: '../**/{styles,*.styles,*.css,*.scss}', group: 'internal', position: 'before' },
|
|
43
|
+
{ pattern: '@/**', group: 'internal', position: 'before' },
|
|
44
|
+
{ pattern: '~/**', group: 'internal', position: 'before' },
|
|
45
|
+
],
|
|
46
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
47
|
+
'newlines-between': 'always',
|
|
48
|
+
warnOnUnassignedImports: true,
|
|
49
|
+
distinctGroup: false,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
'import-x/no-useless-path-segments': ['error', { noUselessIndex: false }],
|
|
53
|
+
'import-x/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
54
|
+
'import-x/no-self-import': 'error',
|
|
55
|
+
'import-x/no-mutable-exports': 'error',
|
|
56
|
+
'import-x/first': 'error',
|
|
57
|
+
'import-x/newline-after-import': 'error',
|
|
58
|
+
'import-x/default': 'off',
|
|
59
|
+
'import-x/named': 'off',
|
|
60
|
+
'import-x/namespace': 'off',
|
|
61
|
+
'import-x/no-named-as-default-member': 'off',
|
|
21
62
|
},
|
|
22
|
-
'import/ignore': ['node_modules'],
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
'import/no-useless-path-segments': ['error', { noUselessIndex: false }],
|
|
26
|
-
'import/order': [
|
|
27
|
-
'error',
|
|
28
|
-
{
|
|
29
|
-
groups: [['builtin', 'external'], 'internal', ['parent', 'sibling'], 'index', 'object'],
|
|
30
|
-
pathGroups: [
|
|
31
|
-
{
|
|
32
|
-
pattern: '@aliexme/**',
|
|
33
|
-
group: 'external',
|
|
34
|
-
position: 'after',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
// Nuxt imports
|
|
38
|
-
pattern: '#{app,components,imports}',
|
|
39
|
-
group: 'external',
|
|
40
|
-
position: 'after',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
pattern: './{styles,*.styles,*.css,*.scss}',
|
|
44
|
-
group: 'internal',
|
|
45
|
-
position: 'before',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
pathGroupsExcludedImportTypes: ['@aliexme'],
|
|
49
|
-
'newlines-between': 'always',
|
|
50
|
-
warnOnUnassignedImports: true,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
54
|
-
'import/no-self-import': 'error',
|
|
55
|
-
'import/no-mutable-exports': 'error',
|
|
56
|
-
'import/first': 'error',
|
|
57
|
-
'import/newline-after-import': 'error',
|
|
58
|
-
'import/namespace': 'off',
|
|
59
63
|
},
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
])
|
|
65
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
|
+
import packageJson from 'eslint-plugin-package-json'
|
|
3
|
+
|
|
4
|
+
export default defineConfig([
|
|
5
|
+
packageJson.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
files: ['**/package.json'],
|
|
8
|
+
rules: {
|
|
9
|
+
'package-json/sort-collections': ['error', ['dependencies', 'devDependencies', 'peerDependencies', 'overrides']],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
])
|
package/configs/prettier.js
CHANGED
|
@@ -1,51 +1,4 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
eslintPluginPrettierRecommended,
|
|
6
|
-
{
|
|
7
|
-
rules: {
|
|
8
|
-
// Disable @stylistic rules
|
|
9
|
-
'@stylistic/block-spacing': 'off',
|
|
10
|
-
'@stylistic/brace-style': 'off',
|
|
11
|
-
'@stylistic/comma-dangle': 'off',
|
|
12
|
-
'@stylistic/comma-spacing': 'off',
|
|
13
|
-
'@stylistic/func-call-spacing': 'off',
|
|
14
|
-
'@stylistic/function-paren-newline': 'off',
|
|
15
|
-
'@stylistic/indent': 'off',
|
|
16
|
-
'@stylistic/indent-binary-ops': 'off',
|
|
17
|
-
'@stylistic/jsx-child-element-spacing': 'off',
|
|
18
|
-
'@stylistic/jsx-closing-bracket-location': 'off',
|
|
19
|
-
'@stylistic/jsx-closing-tag-location': 'off',
|
|
20
|
-
'@stylistic/jsx-curly-newline': 'off',
|
|
21
|
-
'@stylistic/jsx-curly-spacing': 'off',
|
|
22
|
-
'@stylistic/jsx-equals-spacing': 'off',
|
|
23
|
-
'@stylistic/jsx-first-prop-new-line': 'off',
|
|
24
|
-
'@stylistic/jsx-indent': 'off',
|
|
25
|
-
'@stylistic/jsx-indent-props': 'off',
|
|
26
|
-
'@stylistic/jsx-max-props-per-line': 'off',
|
|
27
|
-
'@stylistic/jsx-newline': 'off',
|
|
28
|
-
'@stylistic/jsx-one-expression-per-line': 'off',
|
|
29
|
-
'@stylistic/jsx-props-no-multi-spaces': 'off',
|
|
30
|
-
'@stylistic/jsx-quotes': 'off',
|
|
31
|
-
'@stylistic/jsx-tag-spacing': 'off',
|
|
32
|
-
'@stylistic/jsx-wrap-multilines': 'off',
|
|
33
|
-
'@stylistic/key-spacing': 'off',
|
|
34
|
-
'@stylistic/keyword-spacing': 'off',
|
|
35
|
-
'@stylistic/lines-around-comment': 'off',
|
|
36
|
-
'@stylistic/max-len': 'off',
|
|
37
|
-
'@stylistic/member-delimiter-style': 'off',
|
|
38
|
-
'@stylistic/multiline-ternary': 'off',
|
|
39
|
-
'@stylistic/no-extra-parens': 'off',
|
|
40
|
-
'@stylistic/no-extra-semi': 'off',
|
|
41
|
-
'@stylistic/object-curly-spacing': 'off',
|
|
42
|
-
'@stylistic/operator-linebreak': 'off',
|
|
43
|
-
'@stylistic/quotes': 'off',
|
|
44
|
-
'@stylistic/semi': 'off',
|
|
45
|
-
'@stylistic/space-before-blocks': 'off',
|
|
46
|
-
'@stylistic/space-before-function-paren': 'off',
|
|
47
|
-
'@stylistic/space-infix-ops': 'off',
|
|
48
|
-
'@stylistic/type-annotation-spacing': 'off',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
]
|
|
4
|
+
export default defineConfig([eslintPluginPrettierRecommended])
|
package/configs/react-native.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
// @ts-expect-error Could not find a declaration file for module 'eslint-plugin-react-native'
|
|
2
3
|
import eslintPluginReactNative from 'eslint-plugin-react-native'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
export default [
|
|
5
|
+
export default defineConfig([
|
|
6
6
|
{
|
|
7
7
|
plugins: {
|
|
8
8
|
'react-native': eslintPluginReactNative,
|
|
@@ -14,4 +14,4 @@ export default [
|
|
|
14
14
|
'react-native/no-single-element-style-arrays': 'error',
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
]
|
|
17
|
+
])
|
package/configs/react.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
// @ts-expect-error Could not find a declaration file for module 'eslint-plugin-react/configs/recommended.js'
|
|
2
3
|
import eslintPluginReactRecommended from 'eslint-plugin-react/configs/recommended.js'
|
|
3
4
|
// @ts-expect-error Could not find a declaration file for module 'eslint-plugin-react/configs/jsx-runtime.js'
|
|
4
5
|
import eslintPluginReactJsxRuntime from 'eslint-plugin-react/configs/jsx-runtime.js'
|
|
5
6
|
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
export default [
|
|
8
|
+
export default defineConfig([
|
|
9
9
|
eslintPluginReactRecommended,
|
|
10
10
|
eslintPluginReactJsxRuntime,
|
|
11
11
|
{
|
|
@@ -15,19 +15,6 @@ export default [
|
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
rules: {
|
|
18
|
-
'react/jsx-tag-spacing': [
|
|
19
|
-
'error',
|
|
20
|
-
{
|
|
21
|
-
closingSlash: 'never',
|
|
22
|
-
beforeSelfClosing: 'proportional-always',
|
|
23
|
-
afterOpening: 'never',
|
|
24
|
-
beforeClosing: 'never',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
|
|
28
|
-
'react/jsx-curly-spacing': ['error', { when: 'never', children: true }],
|
|
29
|
-
'react/jsx-curly-brace-presence': ['error', 'never'],
|
|
30
|
-
'react/jsx-closing-bracket-location': 'error',
|
|
31
18
|
'react/self-closing-comp': 'error',
|
|
32
19
|
'react/no-unused-prop-types': 'error',
|
|
33
20
|
},
|
|
@@ -46,4 +33,4 @@ export default [
|
|
|
46
33
|
...eslintPluginReactHooks.configs.recommended.rules,
|
|
47
34
|
},
|
|
48
35
|
},
|
|
49
|
-
]
|
|
36
|
+
])
|
package/configs/recommended.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import typescriptConfigArray from './typescript.js'
|
|
3
|
-
import stylisticConfigArray from './stylistic.js'
|
|
4
|
-
import importConfigArray from './import.js'
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import baseConfig from './base.js'
|
|
4
|
+
import typescriptConfig from './typescript.js'
|
|
5
|
+
import stylisticConfig from './stylistic.js'
|
|
6
|
+
import importConfig from './import.js'
|
|
7
|
+
import packageJsonConfig from './package-json.js'
|
|
8
|
+
|
|
9
|
+
export default defineConfig([baseConfig, typescriptConfig, stylisticConfig, importConfig, packageJsonConfig])
|
package/configs/stylistic.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import stylistic from '@stylistic/eslint-plugin'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
export default [
|
|
4
|
+
export default defineConfig([
|
|
5
5
|
stylistic.configs.customize({
|
|
6
6
|
jsx: true,
|
|
7
7
|
arrowParens: true,
|
|
@@ -14,16 +14,12 @@ export default [
|
|
|
14
14
|
semi: false,
|
|
15
15
|
}),
|
|
16
16
|
{
|
|
17
|
+
name: '@aliexme/eslint-config/stylistic',
|
|
17
18
|
rules: {
|
|
18
|
-
'@stylistic/
|
|
19
|
-
'@stylistic/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
consistent: true,
|
|
23
|
-
multiline: true,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
'@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
|
|
19
|
+
'@stylistic/quotes': ['error', 'single'],
|
|
20
|
+
'@stylistic/quote-props': ['error', 'as-needed'],
|
|
21
|
+
'@stylistic/semi': ['error', 'never'],
|
|
22
|
+
'@stylistic/indent': ['error', 2, { SwitchCase: 1, offsetTernaryExpressions: true }],
|
|
27
23
|
'@stylistic/max-len': [
|
|
28
24
|
'error',
|
|
29
25
|
{
|
|
@@ -35,11 +31,41 @@ export default [
|
|
|
35
31
|
ignoreRegExpLiterals: true,
|
|
36
32
|
},
|
|
37
33
|
],
|
|
38
|
-
'@stylistic/
|
|
34
|
+
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0, maxBOF: 0 }],
|
|
35
|
+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
36
|
+
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
|
37
|
+
'@stylistic/comma-style': ['error', 'last'],
|
|
38
|
+
'@stylistic/key-spacing': 'error',
|
|
39
|
+
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
|
|
40
|
+
'@stylistic/object-curly-spacing': ['error', 'always'],
|
|
41
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
42
|
+
'@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
|
|
43
|
+
'@stylistic/arrow-spacing': 'error',
|
|
44
|
+
'@stylistic/switch-colon-spacing': ['error', { after: true, before: false }],
|
|
45
|
+
'@stylistic/space-in-parens': ['error', 'never'],
|
|
46
|
+
'@stylistic/space-before-function-paren': [
|
|
39
47
|
'error',
|
|
40
48
|
{
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
anonymous: 'never',
|
|
50
|
+
named: 'never',
|
|
51
|
+
asyncArrow: 'always',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
'@stylistic/space-before-blocks': ['error', 'always'],
|
|
55
|
+
'@stylistic/template-curly-spacing': ['error', 'never'],
|
|
56
|
+
'@stylistic/block-spacing': ['error', 'always'],
|
|
57
|
+
'@stylistic/func-call-spacing': ['error', 'never'],
|
|
58
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
59
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
60
|
+
'@stylistic/no-multi-spaces': 'error',
|
|
61
|
+
'@stylistic/eol-last': 'error',
|
|
62
|
+
'@stylistic/arrow-parens': 'error',
|
|
63
|
+
'@stylistic/array-bracket-newline': ['error', { multiline: true }],
|
|
64
|
+
'@stylistic/array-element-newline': [
|
|
65
|
+
'error',
|
|
66
|
+
{
|
|
67
|
+
consistent: true,
|
|
68
|
+
multiline: true,
|
|
43
69
|
},
|
|
44
70
|
],
|
|
45
71
|
'@stylistic/object-curly-newline': [
|
|
@@ -50,6 +76,35 @@ export default [
|
|
|
50
76
|
},
|
|
51
77
|
],
|
|
52
78
|
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
|
|
79
|
+
'@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
|
|
80
|
+
'@stylistic/member-delimiter-style': [
|
|
81
|
+
'error',
|
|
82
|
+
{
|
|
83
|
+
multiline: { delimiter: 'none' },
|
|
84
|
+
singleline: { delimiter: 'semi' },
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
'@stylistic/wrap-iife': ['error', 'inside', { functionPrototypeMethods: true }],
|
|
88
|
+
'@stylistic/space-infix-ops': ['error', { int32Hint: true }],
|
|
89
|
+
'@stylistic/operator-linebreak': [
|
|
90
|
+
'error',
|
|
91
|
+
'before',
|
|
92
|
+
{
|
|
93
|
+
overrides: { '=': 'after' },
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
'@stylistic/no-mixed-operators': 'error',
|
|
97
|
+
'@stylistic/brace-style': ['error', '1tbs'],
|
|
98
|
+
'@stylistic/spaced-comment': [
|
|
99
|
+
'error',
|
|
100
|
+
'always',
|
|
101
|
+
{
|
|
102
|
+
markers: ['/', '!', '?'],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
'@stylistic/newline-per-chained-call': ['error', { ignoreChainWithDepth: 2 }],
|
|
106
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
107
|
+
'@stylistic/padded-blocks': ['error', 'never'],
|
|
53
108
|
|
|
54
109
|
// JSX
|
|
55
110
|
'@stylistic/jsx-curly-spacing': ['error', { when: 'never', children: true }],
|
|
@@ -62,6 +117,9 @@ export default [
|
|
|
62
117
|
beforeClosing: 'never',
|
|
63
118
|
},
|
|
64
119
|
],
|
|
120
|
+
'@stylistic/jsx-max-props-per-line': ['error', { when: 'multiline' }],
|
|
121
|
+
'@stylistic/jsx-curly-brace-presence': ['error', 'never'],
|
|
122
|
+
'@stylistic/jsx-closing-bracket-location': 'error',
|
|
65
123
|
},
|
|
66
124
|
},
|
|
67
|
-
]
|
|
125
|
+
])
|
package/configs/typescript.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import tseslint from 'typescript-eslint'
|
|
2
2
|
|
|
3
3
|
export default /** @type {import('eslint').Linter.Config[]} */ (
|
|
4
|
-
tseslint.config(
|
|
4
|
+
tseslint.config(tseslint.configs.strict, tseslint.configs.stylistic, {
|
|
5
5
|
name: '@aliexme/eslint-config/typescript',
|
|
6
|
+
files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx', '**/*.vue', '**/*.svelte', '**/*.astro'],
|
|
6
7
|
languageOptions: {
|
|
7
8
|
parserOptions: {
|
|
8
9
|
parser: tseslint.parser,
|
|
@@ -18,13 +19,6 @@ export default /** @type {import('eslint').Linter.Config[]} */ (
|
|
|
18
19
|
},
|
|
19
20
|
],
|
|
20
21
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
21
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
22
|
-
'error',
|
|
23
|
-
{
|
|
24
|
-
multiline: { delimiter: 'none' },
|
|
25
|
-
singleline: { delimiter: 'semi' },
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
22
|
'@typescript-eslint/no-empty-object-type': [
|
|
29
23
|
'error',
|
|
30
24
|
{
|
|
@@ -35,7 +29,6 @@ export default /** @type {import('eslint').Linter.Config[]} */ (
|
|
|
35
29
|
'error',
|
|
36
30
|
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
|
|
37
31
|
],
|
|
38
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
39
32
|
},
|
|
40
33
|
})
|
|
41
34
|
)
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import recommendedConfig from './configs/recommended.js'
|
|
4
|
+
|
|
5
|
+
export default defineConfig(recommendedConfig)
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliexme/eslint-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Set of configs for ESLint",
|
|
3
|
+
"version": "3.1.0",
|
|
5
4
|
"private": false,
|
|
6
|
-
"
|
|
5
|
+
"description": "Set of configs for ESLint",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"eslint",
|
|
8
|
+
"eslintconfig"
|
|
9
|
+
],
|
|
7
10
|
"homepage": "https://github.com/aliexme/web-shared/tree/main/packages/eslint-config",
|
|
8
11
|
"repository": {
|
|
9
12
|
"type": "git",
|
|
@@ -11,39 +14,37 @@
|
|
|
11
14
|
"directory": "packages/eslint-config"
|
|
12
15
|
},
|
|
13
16
|
"license": "MIT",
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"eslintconfig"
|
|
17
|
-
],
|
|
17
|
+
"author": "Alexander Smirnov <al.smirnov996@gmail.com>",
|
|
18
|
+
"sideEffects": false,
|
|
18
19
|
"type": "module",
|
|
19
|
-
"files": [
|
|
20
|
-
"index.js",
|
|
21
|
-
"configs"
|
|
22
|
-
],
|
|
23
20
|
"exports": {
|
|
24
21
|
".": "./index.js",
|
|
22
|
+
"./recommended": "./configs/recommended.js",
|
|
25
23
|
"./base": "./configs/base.js",
|
|
26
24
|
"./typescript": "./configs/typescript.js",
|
|
27
25
|
"./stylistic": "./configs/stylistic.js",
|
|
28
26
|
"./import": "./configs/import.js",
|
|
27
|
+
"./package-json": "./configs/package-json.js",
|
|
28
|
+
"./prettier": "./configs/prettier.js",
|
|
29
29
|
"./react": "./configs/react.js",
|
|
30
30
|
"./react-native": "./configs/react-native.js",
|
|
31
|
-
"./vue": "./configs/vue.js"
|
|
32
|
-
"./prettier": "./configs/prettier.js",
|
|
33
|
-
"./recommended": "./configs/recommended.js"
|
|
34
|
-
},
|
|
35
|
-
"sideEffects": false,
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
31
|
+
"./vue": "./configs/vue.js"
|
|
38
32
|
},
|
|
33
|
+
"types": "./index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"index.js",
|
|
36
|
+
"configs"
|
|
37
|
+
],
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@eslint/compat": "^1.
|
|
39
|
+
"@eslint/compat": "^1.3.0",
|
|
41
40
|
"@eslint/eslintrc": "^3.3.1",
|
|
42
|
-
"@eslint/js": "^9.
|
|
43
|
-
"@stylistic/eslint-plugin": "^4.
|
|
44
|
-
"eslint-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
41
|
+
"@eslint/js": "^9.29.0",
|
|
42
|
+
"@stylistic/eslint-plugin": "^4.4.1",
|
|
43
|
+
"eslint-import-resolver-typescript": "^4.4.3",
|
|
44
|
+
"eslint-plugin-import-x": "^4.15.2",
|
|
45
|
+
"eslint-plugin-package-json": "^0.39.0",
|
|
46
|
+
"globals": "^16.2.0",
|
|
47
|
+
"typescript-eslint": "^8.34.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"eslint": "^9.0.0",
|
|
@@ -78,5 +79,8 @@
|
|
|
78
79
|
"optional": true
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
|
-
"
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
},
|
|
85
|
+
"gitHead": "b0b64c6bea3f7d5a2dcf2db3372b4ba29025d0bc"
|
|
82
86
|
}
|