@alexlit/lint-kit 110.2.0 → 111.0.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/.eslintrc.cjs +2 -8
- package/package.json +1 -1
- package/packages/config-eslint/README.md +22 -46
- package/packages/config-eslint/index.js +344 -213
- package/packages/config-eslint/package.json +4 -2
- package/packages/config-eslint/plugins/array-func.js +0 -1
- package/packages/config-eslint/plugins/compat.js +0 -1
- package/packages/config-eslint/plugins/decorator-position.js +0 -1
- package/packages/config-eslint/plugins/eslint-comments.js +0 -1
- package/packages/config-eslint/plugins/etc.js +0 -1
- package/packages/config-eslint/plugins/ext.js +0 -1
- package/packages/config-eslint/plugins/filenames.js +0 -1
- package/packages/config-eslint/plugins/import.js +0 -4
- package/packages/config-eslint/plugins/jsdoc.js +0 -1
- package/packages/config-eslint/plugins/jsx-a11y.js +0 -1
- package/packages/config-eslint/plugins/lit-a11y.js +0 -1
- package/packages/config-eslint/plugins/lit.js +0 -1
- package/packages/config-eslint/plugins/more.js +0 -1
- package/packages/config-eslint/plugins/no-await-in-promise.js +0 -1
- package/packages/config-eslint/plugins/no-constructor-bind.js +0 -1
- package/packages/config-eslint/plugins/no-explicit-type-exports.js +0 -1
- package/packages/config-eslint/plugins/no-loops.js +0 -1
- package/packages/config-eslint/plugins/no-secrets.js +0 -1
- package/packages/config-eslint/plugins/no-use-extend-native.js +0 -1
- package/packages/config-eslint/plugins/{optional/node.js → node.js} +0 -1
- package/packages/config-eslint/plugins/prettier.js +0 -1
- package/packages/config-eslint/plugins/promise.js +0 -1
- package/packages/config-eslint/plugins/regexp.js +0 -1
- package/packages/config-eslint/plugins/{optional/security.js → security.js} +0 -1
- package/packages/config-eslint/plugins/simple-import-sort.js +0 -1
- package/packages/config-eslint/plugins/sonar.js +0 -1
- package/packages/config-eslint/plugins/sort-class-members.js +0 -1
- package/packages/config-eslint/plugins/sort-destructure-keys.js +0 -1
- package/packages/config-eslint/plugins/sort-keys-fix.js +0 -1
- package/packages/config-eslint/plugins/spellcheck.js +2 -12
- package/packages/config-eslint/plugins/sql.js +0 -1
- package/packages/config-eslint/plugins/tanstack-query.js +0 -1
- package/packages/config-eslint/plugins/testing-library.js +0 -1
- package/packages/config-eslint/plugins/typescript-sort-keys.js +0 -1
- package/packages/config-eslint/plugins/{typescript/index.js → typescript.js} +3 -4
- package/packages/config-eslint/plugins/unicorn.js +0 -1
- package/packages/config-eslint/plugins/unused-imports.js +0 -1
- package/packages/config-eslint/plugins/vitest.js +0 -1
- package/packages/config-eslint/plugins/vue-i18n.js +0 -1
- package/packages/config-eslint/plugins/vue.js +1 -10
- package/packages/config-eslint/plugins/vuejs-accessibility.js +0 -1
- package/packages/config-eslint/plugins/wc.js +0 -1
- package/packages/config-eslint/plugins/write-good-comments.js +0 -2
- package/packages/config-eslint/utils/extend-spell-checker.js +23 -0
- package/packages/config-stylelint/README.md +1 -1
- package/packages/config-stylelint/index.js +2 -2
- package/packages/config-eslint/plugins/no-inferred-method-name.js +0 -8
- package/packages/config-eslint/plugins/nuxt.js +0 -10
- package/packages/config-eslint/plugins/quasar.js +0 -6
- /package/packages/config-eslint/{plugins/typescript/allow-boolean-property-list.const.js → constants/allow-boolean-property-list.js} +0 -0
- /package/packages/config-eslint/{plugins/typescript/boolean-prefixes.const.js → constants/boolean-prefixes.js} +0 -0
- /package/packages/config-eslint/{plugins/typescript/english-verbs.const.js → constants/english-verbs.js} +0 -0
package/.eslintrc.cjs
CHANGED
package/package.json
CHANGED
|
@@ -8,62 +8,38 @@ npm i @alexlit/config-eslint -D
|
|
|
8
8
|
|
|
9
9
|
## Connection
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
...require('@alexlit/config-eslint'),
|
|
15
|
-
};
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Recipes
|
|
19
|
-
|
|
20
|
-
### Vue
|
|
21
|
-
|
|
22
|
-
- If you use vue.js with `options api` syntax you need to turn off `sort-keys`
|
|
23
|
-
rule for `*.vue` files
|
|
11
|
+
- Default
|
|
12
|
+
([see plugins enabled by default](https://github.com/alex-lit/lint-kit/blob/master/packages/config-eslint/index.js))
|
|
24
13
|
|
|
25
14
|
```js
|
|
26
15
|
// .eslintrc.js
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
files: ['*.vue'],
|
|
30
|
-
rules: {
|
|
31
|
-
'sort-keys': 'off',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
```
|
|
16
|
+
const { createConfig } = require('@alexlit/config-eslint');
|
|
36
17
|
|
|
37
|
-
|
|
18
|
+
module.exports = createConfig();
|
|
19
|
+
```
|
|
38
20
|
|
|
39
|
-
-
|
|
21
|
+
- Custom
|
|
40
22
|
|
|
41
23
|
```js
|
|
42
24
|
// .eslintrc.js
|
|
43
|
-
|
|
44
|
-
.rules['spellcheck/spell-checker'][1];
|
|
25
|
+
import { createConfig, extendSpellChecker } from '@alexlit/config-eslint';
|
|
45
26
|
|
|
46
|
-
module.exports =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
...SPELLCHECK_RULES,
|
|
27
|
+
module.exports = createConfig(
|
|
28
|
+
{
|
|
29
|
+
// disable some default plugins
|
|
30
|
+
vitest: false,
|
|
52
31
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
32
|
+
// enable some optional plugins
|
|
33
|
+
node: true,
|
|
56
34
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
rules: {
|
|
66
|
-
'spellcheck/spell-checker': 'off',
|
|
35
|
+
{
|
|
36
|
+
// add custom rules
|
|
37
|
+
rules: {
|
|
38
|
+
'no-implicit-coercion': 'warn',
|
|
39
|
+
'spellcheck/spell-checker': extendSpellChecker({
|
|
40
|
+
skipWords: ['word1', 'word2'],
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
67
43
|
},
|
|
68
|
-
|
|
44
|
+
);
|
|
69
45
|
```
|
|
@@ -1,237 +1,368 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
/* eslint-disable sonarjs/no-duplicate-string */
|
|
2
|
+
/* eslint-disable sonarjs/no-duplicate-string, import/order */
|
|
3
3
|
|
|
4
4
|
const { defineConfig } = require('eslint-define-config');
|
|
5
|
+
const { extendSpellChecker } = require('./utils/extend-spell-checker');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
browser: true,
|
|
10
|
-
node: true,
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
extends: [
|
|
14
|
-
/** @see [eslint-config-airbnb-base](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) */
|
|
15
|
-
'airbnb-base',
|
|
16
|
-
|
|
17
|
-
/* plugins */
|
|
18
|
-
...[
|
|
19
|
-
'./plugins/array-func',
|
|
20
|
-
'./plugins/compat',
|
|
21
|
-
'./plugins/decorator-position',
|
|
22
|
-
'./plugins/eslint-comments',
|
|
23
|
-
'./plugins/etc',
|
|
24
|
-
'./plugins/ext',
|
|
25
|
-
'./plugins/filenames',
|
|
26
|
-
'./plugins/import',
|
|
27
|
-
'./plugins/jsdoc',
|
|
28
|
-
'./plugins/jsx-a11y',
|
|
29
|
-
'./plugins/lit',
|
|
30
|
-
'./plugins/lit-a11y',
|
|
31
|
-
'./plugins/more',
|
|
32
|
-
'./plugins/no-await-in-promise',
|
|
33
|
-
'./plugins/no-constructor-bind',
|
|
34
|
-
'./plugins/no-explicit-type-exports',
|
|
35
|
-
'./plugins/no-loops',
|
|
36
|
-
'./plugins/no-secrets',
|
|
37
|
-
'./plugins/no-use-extend-native',
|
|
38
|
-
'./plugins/promise',
|
|
39
|
-
'./plugins/regexp',
|
|
40
|
-
'./plugins/simple-import-sort',
|
|
41
|
-
'./plugins/sonar',
|
|
42
|
-
'./plugins/sort-class-members',
|
|
43
|
-
'./plugins/sort-destructure-keys',
|
|
44
|
-
'./plugins/sort-keys-fix',
|
|
45
|
-
'./plugins/spellcheck',
|
|
46
|
-
'./plugins/sql',
|
|
47
|
-
'./plugins/tanstack-query',
|
|
48
|
-
'./plugins/testing-library',
|
|
49
|
-
'./plugins/typescript-sort-keys',
|
|
50
|
-
'./plugins/typescript/index',
|
|
51
|
-
'./plugins/unicorn',
|
|
52
|
-
'./plugins/unused-imports',
|
|
53
|
-
'./plugins/vitest',
|
|
54
|
-
'./plugins/vue',
|
|
55
|
-
'./plugins/vue-i18n',
|
|
56
|
-
'./plugins/vuejs-accessibility',
|
|
57
|
-
'./plugins/wc',
|
|
58
|
-
'./plugins/write-good-comments',
|
|
59
|
-
|
|
60
|
-
/* optional */
|
|
61
|
-
// './plugins/optional/node',
|
|
62
|
-
// './plugins/optional/security',
|
|
63
|
-
|
|
64
|
-
/* prettier */
|
|
65
|
-
'./plugins/prettier',
|
|
66
|
-
].map((config) => require.resolve(config)),
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
ignorePatterns: [
|
|
70
|
-
'.*',
|
|
71
|
-
'build',
|
|
72
|
-
'dist',
|
|
73
|
-
'docs',
|
|
74
|
-
'node_modules',
|
|
75
|
-
'storybook-*',
|
|
76
|
-
'sw.js',
|
|
77
|
-
'!.*.js',
|
|
78
|
-
'!.node',
|
|
79
|
-
'!.storybook',
|
|
80
|
-
],
|
|
81
|
-
|
|
82
|
-
overrides: [
|
|
83
|
-
{
|
|
84
|
-
files: ['.*.cjs', '.*.js'],
|
|
85
|
-
|
|
86
|
-
rules: {
|
|
87
|
-
'global-require': 'off',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
files: ['**/store/**/*', '**/vuex/**/*', '**/pinia/**/*'],
|
|
7
|
+
const DEFAULT_PLUGINS = {
|
|
8
|
+
/** @see [eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func) */
|
|
9
|
+
'array-func': true,
|
|
92
10
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
|
|
99
|
-
parserOptions: {
|
|
100
|
-
ecmaFeatures: { jsx: true },
|
|
101
|
-
extraFileExtensions: ['.vue'],
|
|
102
|
-
parser: '@typescript-eslint/parser',
|
|
103
|
-
project: ['./tsconfig.json'],
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
root: true,
|
|
107
|
-
|
|
108
|
-
rules: {
|
|
109
|
-
'class-methods-use-this': 'off',
|
|
110
|
-
curly: 'error',
|
|
111
|
-
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
112
|
-
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
113
|
-
indent: 'off',
|
|
114
|
-
|
|
115
|
-
'lines-around-comment': [
|
|
116
|
-
'warn',
|
|
117
|
-
{
|
|
118
|
-
afterBlockComment: false,
|
|
119
|
-
afterLineComment: false,
|
|
11
|
+
/** @see [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) */
|
|
12
|
+
compat: true,
|
|
120
13
|
|
|
121
|
-
|
|
122
|
-
|
|
14
|
+
/** @see [eslint-plugin-decorator-position](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position) */
|
|
15
|
+
'decorator-position': true,
|
|
123
16
|
|
|
124
|
-
|
|
125
|
-
|
|
17
|
+
/** @see [eslint-plugin-eslint-comments](hhttps://github.com/mysticatea/eslint-plugin-eslint-comments) */
|
|
18
|
+
'eslint-comments': true,
|
|
126
19
|
|
|
127
|
-
|
|
128
|
-
|
|
20
|
+
/** @see [eslint-plugin-etc](https://github.com/cartant/eslint-plugin-etc) */
|
|
21
|
+
etc: true,
|
|
129
22
|
|
|
130
|
-
|
|
131
|
-
|
|
23
|
+
/** @see [eslint-plugin-ext](https://github.com/jiangfengming/eslint-plugin-ext) */
|
|
24
|
+
ext: true,
|
|
132
25
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
],
|
|
26
|
+
/** @see [eslint-plugin-filenames](https://github.com/selaux/eslint-plugin-filenames) */
|
|
27
|
+
filenames: true,
|
|
137
28
|
|
|
138
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @see [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import)
|
|
31
|
+
* @see [eslint-import-resolver-alias](https://github.com/johvin/eslint-import-resolver-alias)
|
|
32
|
+
*/
|
|
33
|
+
import: true,
|
|
139
34
|
|
|
140
|
-
|
|
35
|
+
/** @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) */
|
|
36
|
+
jsdoc: true,
|
|
141
37
|
|
|
142
|
-
|
|
38
|
+
/** @see [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) */
|
|
39
|
+
'jsx-a11y': true,
|
|
143
40
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
41
|
+
/** @see [eslint-plugin-lit](https://github.com/43081j/eslint-plugin-lit) */
|
|
42
|
+
lit: true,
|
|
43
|
+
|
|
44
|
+
/** @see [eslint-plugin-lit-a11y](https://www.npmjs.com/package/eslint-plugin-lit-a11y) */
|
|
45
|
+
'lit-a11y': true,
|
|
46
|
+
|
|
47
|
+
/** @see [eslint-plugin-more](https://github.com/WebbyLab/eslint-plugin-more) */
|
|
48
|
+
more: true,
|
|
49
|
+
|
|
50
|
+
/** @see [eslint-plugin-no-await-in-promise](https://github.com/hugo-vrijswijk/eslint-plugin-no-await-in-promise/) */
|
|
51
|
+
'no-await-in-promise': true,
|
|
52
|
+
|
|
53
|
+
/** @see [eslint-plugin-no-constructor-bind](https://github.com/markalfred/eslint-plugin-no-constructor-bind) */
|
|
54
|
+
'no-constructor-bind': true,
|
|
55
|
+
|
|
56
|
+
/** @see [eslint-plugin-no-explicit-type-exports](https://github.com/intuit/eslint-plugin-no-explicit-type-exports) */
|
|
57
|
+
'no-explicit-type-exports': true,
|
|
58
|
+
|
|
59
|
+
/** @see [eslint-plugin-no-loops](https://github.com/buildo/eslint-plugin-no-loops) */
|
|
60
|
+
'no-loops': true,
|
|
61
|
+
|
|
62
|
+
/** @see [eslint-plugin-no-secrets](https://github.com/nickdeis/eslint-plugin-no-secrets) */
|
|
63
|
+
'no-secrets': true,
|
|
64
|
+
|
|
65
|
+
/** @see [eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native) */
|
|
66
|
+
'no-use-extend-native': true,
|
|
67
|
+
|
|
68
|
+
/** @see [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) */
|
|
69
|
+
promise: true,
|
|
70
|
+
|
|
71
|
+
/** @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp) */
|
|
72
|
+
regexp: true,
|
|
73
|
+
|
|
74
|
+
/** @see [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort) */
|
|
75
|
+
'simple-import-sort': true,
|
|
76
|
+
|
|
77
|
+
/** @see [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) */
|
|
78
|
+
sonar: true,
|
|
79
|
+
|
|
80
|
+
/** @see [eslint-plugin-sort-class-members](https://github.com/bryanrsmith/eslint-plugin-sort-class-members) */
|
|
81
|
+
'sort-class-members': true,
|
|
82
|
+
|
|
83
|
+
/** @see [eslint-plugin-sort-destructure-keys](https://github.com/mthadley/eslint-plugin-sort-destructure-keys) */
|
|
84
|
+
'sort-destructure-keys': true,
|
|
85
|
+
|
|
86
|
+
/** @see [eslint-plugin-sort-keys-fix](https://github.com/leo-buneev/eslint-plugin-sort-keys-fix) */
|
|
87
|
+
'sort-keys-fix': true,
|
|
88
|
+
|
|
89
|
+
/** @see [eslint-plugin-spellcheck](https://github.com/aotaduy/eslint-plugin-spellcheck) */
|
|
90
|
+
spellcheck: true,
|
|
91
|
+
|
|
92
|
+
/** @see [eslint-plugin-sql](https://github.com/gajus/eslint-plugin-sql) */
|
|
93
|
+
sql: true,
|
|
94
|
+
|
|
95
|
+
/** @see [@tanstack/query](https://tanstack.com/query/v4/docs/react/eslint/eslint-plugin-query) */
|
|
96
|
+
'tanstack-query': true,
|
|
97
|
+
|
|
98
|
+
/** @see [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) */
|
|
99
|
+
'testing-library': true,
|
|
100
|
+
|
|
101
|
+
/** @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) */
|
|
102
|
+
typescript: true,
|
|
103
|
+
|
|
104
|
+
/** @see [eslint-plugin-typescript-sort-keys](https://github.com/infctr/eslint-plugin-typescript-sort-keys) */
|
|
105
|
+
'typescript-sort-keys': true,
|
|
106
|
+
|
|
107
|
+
/** @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) */
|
|
108
|
+
unicorn: true,
|
|
109
|
+
|
|
110
|
+
/** @see [eslint-plugin-unused-imports](https://github.com/sweepline/eslint-plugin-unused-imports) */
|
|
111
|
+
'unused-imports': true,
|
|
112
|
+
|
|
113
|
+
/** @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) */
|
|
114
|
+
vitest: true,
|
|
115
|
+
|
|
116
|
+
/** @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/) */
|
|
117
|
+
vue: true,
|
|
118
|
+
|
|
119
|
+
/** @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/) */
|
|
120
|
+
'vue-i18n': true,
|
|
121
|
+
|
|
122
|
+
/** @see [eslint-plugin-vuejs-accessibility](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility) */
|
|
123
|
+
'vuejs-accessibility': true,
|
|
124
|
+
|
|
125
|
+
/** @see [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc) */
|
|
126
|
+
wc: true,
|
|
127
|
+
|
|
128
|
+
/** @see [eslint-plugin-write-good-comments](https://github.com/kantord/eslint-plugin-write-good-comments) */
|
|
129
|
+
'write-good-comments': true,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const OPTIONAL_PLUGINS = {
|
|
133
|
+
/** @see [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) */
|
|
134
|
+
node: false,
|
|
135
|
+
|
|
136
|
+
/** @see [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) */
|
|
137
|
+
security: false,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const CODESTYLE_PLUGINS = {
|
|
141
|
+
/** @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) */
|
|
142
|
+
prettier: true,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const PLUGINS = {
|
|
146
|
+
...DEFAULT_PLUGINS,
|
|
147
|
+
...OPTIONAL_PLUGINS,
|
|
148
|
+
...CODESTYLE_PLUGINS,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Create "extends" field
|
|
153
|
+
*
|
|
154
|
+
* @param {PLUGINS} plugins Enabled/disabled plugins list
|
|
155
|
+
*/
|
|
156
|
+
const createPluginsList = (plugins = {}) => {
|
|
157
|
+
const pluginsList = [];
|
|
158
|
+
|
|
159
|
+
Object.entries({ ...PLUGINS, ...plugins })?.forEach(([name, isActive]) => {
|
|
160
|
+
if (isActive) {
|
|
161
|
+
pluginsList.push(require.resolve(`./plugins/${name}`));
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return pluginsList;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Create eslint config
|
|
170
|
+
*
|
|
171
|
+
* @param {PLUGINS} plugins Enabled/disabled plugins list
|
|
172
|
+
* @param {import('eslint-define-config').defineConfig} options Eslint options
|
|
173
|
+
*/
|
|
174
|
+
const createConfig = (plugins = {}, options = {}) =>
|
|
175
|
+
defineConfig({
|
|
176
|
+
...options,
|
|
177
|
+
|
|
178
|
+
env: {
|
|
179
|
+
browser: true,
|
|
180
|
+
node: true,
|
|
181
|
+
|
|
182
|
+
...options.env,
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
extends: [
|
|
186
|
+
/** @see [eslint-config-airbnb-base](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) */
|
|
187
|
+
'airbnb-base',
|
|
188
|
+
|
|
189
|
+
...createPluginsList(plugins),
|
|
190
|
+
|
|
191
|
+
...(options.extends ?? []),
|
|
151
192
|
],
|
|
152
193
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
'padding-line-between-statements': [
|
|
167
|
-
'warn',
|
|
168
|
-
// always
|
|
169
|
-
{ blankLine: 'always', next: '*', prev: 'block-like' },
|
|
170
|
-
{ blankLine: 'always', next: '*', prev: 'case' },
|
|
171
|
-
{ blankLine: 'always', next: '*', prev: 'cjs-export' },
|
|
172
|
-
{ blankLine: 'always', next: '*', prev: 'cjs-import' },
|
|
173
|
-
{ blankLine: 'always', next: '*', prev: 'class' },
|
|
174
|
-
{ blankLine: 'always', next: '*', prev: 'default' },
|
|
175
|
-
{ blankLine: 'always', next: '*', prev: 'directive' },
|
|
176
|
-
{ blankLine: 'always', next: '*', prev: 'expression' },
|
|
177
|
-
{ blankLine: 'always', next: '*', prev: 'iife' },
|
|
178
|
-
{ blankLine: 'always', next: '*', prev: 'multiline-block-like' },
|
|
179
|
-
{ blankLine: 'always', next: '*', prev: 'multiline-const' },
|
|
180
|
-
{ blankLine: 'always', next: '*', prev: 'multiline-expression' },
|
|
181
|
-
{ blankLine: 'always', next: '*', prev: 'multiline-let' },
|
|
182
|
-
{ blankLine: 'always', next: '*', prev: 'multiline-var' },
|
|
183
|
-
{ blankLine: 'always', next: '*', prev: 'singleline-const' },
|
|
184
|
-
{ blankLine: 'always', next: '*', prev: 'singleline-let' },
|
|
185
|
-
{ blankLine: 'always', next: '*', prev: 'singleline-var' },
|
|
186
|
-
{ blankLine: 'always', next: 'block-like', prev: '*' },
|
|
187
|
-
{ blankLine: 'always', next: 'cjs-export', prev: '*' },
|
|
188
|
-
{ blankLine: 'always', next: 'cjs-import', prev: '*' },
|
|
189
|
-
{ blankLine: 'always', next: 'class', prev: '*' },
|
|
190
|
-
{ blankLine: 'always', next: 'expression', prev: '*' },
|
|
191
|
-
{ blankLine: 'always', next: 'function', prev: '*' },
|
|
192
|
-
{ blankLine: 'always', next: 'iife', prev: '*' },
|
|
193
|
-
{ blankLine: 'always', next: 'multiline-block-like', prev: '*' },
|
|
194
|
-
{ blankLine: 'always', next: 'multiline-const', prev: '*' },
|
|
195
|
-
{ blankLine: 'always', next: 'multiline-expression', prev: '*' },
|
|
196
|
-
{ blankLine: 'always', next: 'multiline-let', prev: '*' },
|
|
197
|
-
{ blankLine: 'always', next: 'multiline-var', prev: '*' },
|
|
198
|
-
{ blankLine: 'always', next: 'return', prev: '*' },
|
|
199
|
-
{ blankLine: 'always', next: 'switch', prev: '*' },
|
|
200
|
-
// any
|
|
201
|
-
{ blankLine: 'any', next: 'expression', prev: 'expression' },
|
|
202
|
-
{
|
|
203
|
-
blankLine: 'any',
|
|
204
|
-
next: 'singleline-const',
|
|
205
|
-
prev: 'singleline-const',
|
|
206
|
-
},
|
|
207
|
-
{ blankLine: 'any', next: 'singleline-let', prev: 'singleline-let' },
|
|
208
|
-
{ blankLine: 'any', next: 'singleline-var', prev: 'singleline-var' },
|
|
209
|
-
// never
|
|
210
|
-
{ blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
|
|
211
|
-
{ blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
|
|
212
|
-
{ blankLine: 'never', next: 'directive', prev: 'directive' },
|
|
194
|
+
ignorePatterns: [
|
|
195
|
+
'.*',
|
|
196
|
+
'build',
|
|
197
|
+
'dist',
|
|
198
|
+
'docs',
|
|
199
|
+
'node_modules',
|
|
200
|
+
'storybook-*',
|
|
201
|
+
'sw.js',
|
|
202
|
+
'!.*.js',
|
|
203
|
+
'!.node',
|
|
204
|
+
'!.storybook',
|
|
205
|
+
|
|
206
|
+
...(options.ignorePatterns ?? []),
|
|
213
207
|
],
|
|
214
208
|
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
overrides: [
|
|
210
|
+
{
|
|
211
|
+
files: ['.*.cjs', '.*.js'],
|
|
217
212
|
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
rules: {
|
|
214
|
+
'global-require': 'off',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
220
217
|
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
218
|
+
files: ['**/store/**/*', '**/vuex/**/*', '**/pinia/**/*'],
|
|
219
|
+
|
|
220
|
+
rules: {
|
|
221
|
+
'no-param-reassign': 'off',
|
|
222
|
+
},
|
|
226
223
|
},
|
|
227
|
-
],
|
|
228
224
|
|
|
229
|
-
|
|
230
|
-
'warn',
|
|
231
|
-
'asc',
|
|
232
|
-
{ caseSensitive: true, minKeys: 2, natural: true },
|
|
225
|
+
...(options.overrides ?? []),
|
|
233
226
|
],
|
|
234
227
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
228
|
+
parserOptions: {
|
|
229
|
+
ecmaFeatures: { jsx: true },
|
|
230
|
+
extraFileExtensions: ['.vue'],
|
|
231
|
+
parser: '@typescript-eslint/parser',
|
|
232
|
+
project: ['./tsconfig.json'],
|
|
233
|
+
|
|
234
|
+
...options.parserOptions,
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
root: options.root ?? true,
|
|
238
|
+
|
|
239
|
+
rules: {
|
|
240
|
+
'class-methods-use-this': 'off',
|
|
241
|
+
curly: 'error',
|
|
242
|
+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
243
|
+
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
244
|
+
indent: 'off',
|
|
245
|
+
|
|
246
|
+
'lines-around-comment': [
|
|
247
|
+
'warn',
|
|
248
|
+
{
|
|
249
|
+
afterBlockComment: false,
|
|
250
|
+
afterLineComment: false,
|
|
251
|
+
|
|
252
|
+
allowArrayEnd: true,
|
|
253
|
+
allowArrayStart: true,
|
|
254
|
+
|
|
255
|
+
allowBlockEnd: true,
|
|
256
|
+
allowBlockStart: true,
|
|
257
|
+
|
|
258
|
+
allowClassEnd: true,
|
|
259
|
+
allowClassStart: true,
|
|
260
|
+
|
|
261
|
+
allowObjectEnd: true,
|
|
262
|
+
allowObjectStart: true,
|
|
263
|
+
|
|
264
|
+
beforeBlockComment: true,
|
|
265
|
+
beforeLineComment: false,
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
|
|
269
|
+
'no-console': 'warn',
|
|
270
|
+
|
|
271
|
+
'no-implicit-coercion': 'error',
|
|
272
|
+
|
|
273
|
+
'no-param-reassign': ['error', { props: false }],
|
|
274
|
+
|
|
275
|
+
'no-restricted-exports': [
|
|
276
|
+
'error',
|
|
277
|
+
{
|
|
278
|
+
restrictedNamedExports: [
|
|
279
|
+
'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
|
|
284
|
+
'no-return-await': 'off',
|
|
285
|
+
|
|
286
|
+
'no-shadow': 'off',
|
|
287
|
+
|
|
288
|
+
'no-underscore-dangle': 'off',
|
|
289
|
+
|
|
290
|
+
'no-unused-vars': 'off',
|
|
291
|
+
|
|
292
|
+
// delegate to eslint-plugin-unused-imports
|
|
293
|
+
'no-use-before-define': 'off',
|
|
294
|
+
|
|
295
|
+
'nonblock-statement-body-position': ['error', 'below'],
|
|
296
|
+
|
|
297
|
+
'padding-line-between-statements': [
|
|
298
|
+
'warn',
|
|
299
|
+
// always
|
|
300
|
+
{ blankLine: 'always', next: '*', prev: 'block-like' },
|
|
301
|
+
{ blankLine: 'always', next: '*', prev: 'case' },
|
|
302
|
+
{ blankLine: 'always', next: '*', prev: 'cjs-export' },
|
|
303
|
+
{ blankLine: 'always', next: '*', prev: 'cjs-import' },
|
|
304
|
+
{ blankLine: 'always', next: '*', prev: 'class' },
|
|
305
|
+
{ blankLine: 'always', next: '*', prev: 'default' },
|
|
306
|
+
{ blankLine: 'always', next: '*', prev: 'directive' },
|
|
307
|
+
{ blankLine: 'always', next: '*', prev: 'expression' },
|
|
308
|
+
{ blankLine: 'always', next: '*', prev: 'iife' },
|
|
309
|
+
{ blankLine: 'always', next: '*', prev: 'multiline-block-like' },
|
|
310
|
+
{ blankLine: 'always', next: '*', prev: 'multiline-const' },
|
|
311
|
+
{ blankLine: 'always', next: '*', prev: 'multiline-expression' },
|
|
312
|
+
{ blankLine: 'always', next: '*', prev: 'multiline-let' },
|
|
313
|
+
{ blankLine: 'always', next: '*', prev: 'multiline-var' },
|
|
314
|
+
{ blankLine: 'always', next: '*', prev: 'singleline-const' },
|
|
315
|
+
{ blankLine: 'always', next: '*', prev: 'singleline-let' },
|
|
316
|
+
{ blankLine: 'always', next: '*', prev: 'singleline-var' },
|
|
317
|
+
{ blankLine: 'always', next: 'block-like', prev: '*' },
|
|
318
|
+
{ blankLine: 'always', next: 'cjs-export', prev: '*' },
|
|
319
|
+
{ blankLine: 'always', next: 'cjs-import', prev: '*' },
|
|
320
|
+
{ blankLine: 'always', next: 'class', prev: '*' },
|
|
321
|
+
{ blankLine: 'always', next: 'expression', prev: '*' },
|
|
322
|
+
{ blankLine: 'always', next: 'function', prev: '*' },
|
|
323
|
+
{ blankLine: 'always', next: 'iife', prev: '*' },
|
|
324
|
+
{ blankLine: 'always', next: 'multiline-block-like', prev: '*' },
|
|
325
|
+
{ blankLine: 'always', next: 'multiline-const', prev: '*' },
|
|
326
|
+
{ blankLine: 'always', next: 'multiline-expression', prev: '*' },
|
|
327
|
+
{ blankLine: 'always', next: 'multiline-let', prev: '*' },
|
|
328
|
+
{ blankLine: 'always', next: 'multiline-var', prev: '*' },
|
|
329
|
+
{ blankLine: 'always', next: 'return', prev: '*' },
|
|
330
|
+
{ blankLine: 'always', next: 'switch', prev: '*' },
|
|
331
|
+
// any
|
|
332
|
+
{ blankLine: 'any', next: 'expression', prev: 'expression' },
|
|
333
|
+
{
|
|
334
|
+
blankLine: 'any',
|
|
335
|
+
next: 'singleline-const',
|
|
336
|
+
prev: 'singleline-const',
|
|
337
|
+
},
|
|
338
|
+
{ blankLine: 'any', next: 'singleline-let', prev: 'singleline-let' },
|
|
339
|
+
{ blankLine: 'any', next: 'singleline-var', prev: 'singleline-var' },
|
|
340
|
+
// never
|
|
341
|
+
{ blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
|
|
342
|
+
{ blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
|
|
343
|
+
{ blankLine: 'never', next: 'directive', prev: 'directive' },
|
|
344
|
+
],
|
|
345
|
+
|
|
346
|
+
quotes: ['error', 'single'],
|
|
347
|
+
'require-await': 'off',
|
|
348
|
+
|
|
349
|
+
'sort-imports': [
|
|
350
|
+
'warn',
|
|
351
|
+
{
|
|
352
|
+
allowSeparatedGroups: true,
|
|
353
|
+
ignoreCase: true,
|
|
354
|
+
ignoreDeclarationSort: true,
|
|
355
|
+
ignoreMemberSort: false,
|
|
356
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
|
|
360
|
+
'sort-keys': 'off', // delegate to sort-keys-fix
|
|
361
|
+
|
|
362
|
+
'sort-vars': 'warn',
|
|
363
|
+
|
|
364
|
+
...options.rules,
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
module.exports = { createConfig, extendSpellChecker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "77.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Eslint config",
|
|
6
6
|
"keywords": [
|
|
@@ -24,9 +24,11 @@
|
|
|
24
24
|
"main": "index.js",
|
|
25
25
|
"files": [
|
|
26
26
|
"README.md",
|
|
27
|
+
"constants",
|
|
27
28
|
"dictionaries",
|
|
28
29
|
"index.js",
|
|
29
|
-
"plugins"
|
|
30
|
+
"plugins",
|
|
31
|
+
"utils"
|
|
30
32
|
],
|
|
31
33
|
"scripts": {
|
|
32
34
|
"semver": "../../scripts/semver.sh",
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { extendSpellChecker } = require('../utils/extend-spell-checker');
|
|
2
2
|
|
|
3
|
-
/** @see [eslint-plugin-spellcheck](https://github.com/aotaduy/eslint-plugin-spellcheck) */
|
|
4
3
|
module.exports = {
|
|
5
4
|
plugins: ['spellcheck'],
|
|
6
5
|
|
|
7
6
|
rules: {
|
|
8
|
-
'spellcheck/spell-checker':
|
|
9
|
-
'warn',
|
|
10
|
-
{
|
|
11
|
-
ignoreRequire: true,
|
|
12
|
-
minLength: 4,
|
|
13
|
-
skipIfMatch: ['^@.*', '^plugin:.*'],
|
|
14
|
-
skipWordIfMatch: [/^[\da-f]{3,6}$/, /^'/, /'$/],
|
|
15
|
-
skipWords,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
7
|
+
'spellcheck/spell-checker': extendSpellChecker(),
|
|
18
8
|
},
|
|
19
9
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable unicorn/no-null */
|
|
2
2
|
|
|
3
|
-
const ALLOW_BOOLEAN_PROPERTY_LIST = require('
|
|
4
|
-
const BOOLEAN_PREFIXES = require('
|
|
5
|
-
const ENGLISH_VERBS = require('
|
|
3
|
+
const ALLOW_BOOLEAN_PROPERTY_LIST = require('../constants/allow-boolean-property-list');
|
|
4
|
+
const BOOLEAN_PREFIXES = require('../constants/boolean-prefixes');
|
|
5
|
+
const ENGLISH_VERBS = require('../constants/english-verbs');
|
|
6
6
|
|
|
7
|
-
/** @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) */
|
|
8
7
|
module.exports = {
|
|
9
8
|
extends: ['plugin:@typescript-eslint/recommended'],
|
|
10
9
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable spellcheck/spell-checker */
|
|
2
|
-
/** @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/) */
|
|
3
2
|
module.exports = {
|
|
4
3
|
extends: ['plugin:vue/vue3-recommended'],
|
|
5
4
|
|
|
@@ -259,15 +258,7 @@ module.exports = {
|
|
|
259
258
|
|
|
260
259
|
'vue/require-typed-ref': ['error'],
|
|
261
260
|
|
|
262
|
-
'vue/sort-keys':
|
|
263
|
-
'warn',
|
|
264
|
-
'asc',
|
|
265
|
-
{
|
|
266
|
-
caseSensitive: true,
|
|
267
|
-
minKeys: 2,
|
|
268
|
-
natural: true,
|
|
269
|
-
},
|
|
270
|
-
],
|
|
261
|
+
'vue/sort-keys': 'off', // delegate to sort-keys-fix,
|
|
271
262
|
|
|
272
263
|
'vue/static-class-names-order': ['warn'],
|
|
273
264
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const dictionaries = require('../dictionaries');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extends 'spellcheck/spell-checker' config
|
|
5
|
+
*
|
|
6
|
+
* @param {Record<string, any>} options 'spellcheck/spell-checker' options
|
|
7
|
+
* @param {'warn' | 'error'} level 'spellcheck/spell-checker' warnings level
|
|
8
|
+
*/
|
|
9
|
+
const extendSpellChecker = (options, level = 'warn') => [
|
|
10
|
+
level,
|
|
11
|
+
{
|
|
12
|
+
ignoreRequire: true,
|
|
13
|
+
minLength: 4,
|
|
14
|
+
skipIfMatch: ['^@.*', '^plugin:.*'],
|
|
15
|
+
skipWordIfMatch: [/^[\da-f]{3,6}$/, /^'/, /'$/],
|
|
16
|
+
|
|
17
|
+
...options,
|
|
18
|
+
|
|
19
|
+
skipWords: [...dictionaries, ...(options?.skipWords ?? [])],
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
module.exports = { extendSpellChecker };
|
|
@@ -9,7 +9,7 @@ npm i @alexlit/config-stylelint -D
|
|
|
9
9
|
## Connection
|
|
10
10
|
|
|
11
11
|
- Default
|
|
12
|
-
([see plugins enabled by default](https://github.com/alex-lit/lint-kit/blob/master/packages/config-stylelint/index.js
|
|
12
|
+
([see plugins enabled by default](https://github.com/alex-lit/lint-kit/blob/master/packages/config-stylelint/index.js))
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
15
|
// stylelint.config.js
|
|
@@ -52,7 +52,7 @@ const OPTIONAL_PLUGINS = {
|
|
|
52
52
|
'no-indistinguishable-colors': false,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const CODESTYLE_PLUGINS = {
|
|
56
56
|
/** @see [stylelint-prettier](https://github.com/prettier/stylelint-prettier) */
|
|
57
57
|
prettier: true,
|
|
58
58
|
};
|
|
@@ -60,7 +60,7 @@ const PRETTIER_PLUGINS = {
|
|
|
60
60
|
const PLUGINS = {
|
|
61
61
|
...ADDITIONAL_PLUGINS,
|
|
62
62
|
...OPTIONAL_PLUGINS,
|
|
63
|
-
...
|
|
63
|
+
...CODESTYLE_PLUGINS,
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @see [eslint-no-inferred-method-name](https://github.com/johnstonbl01/eslint-no-inferred-method-name) */
|
|
2
|
-
module.exports = {
|
|
3
|
-
plugins: ['eslint-plugin-no-inferred-method-name'],
|
|
4
|
-
|
|
5
|
-
rules: {
|
|
6
|
-
'no-inferred-method-name/no-inferred-method-name': 'error',
|
|
7
|
-
},
|
|
8
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|