@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.
Files changed (57) hide show
  1. package/.eslintrc.cjs +2 -8
  2. package/package.json +1 -1
  3. package/packages/config-eslint/README.md +22 -46
  4. package/packages/config-eslint/index.js +344 -213
  5. package/packages/config-eslint/package.json +4 -2
  6. package/packages/config-eslint/plugins/array-func.js +0 -1
  7. package/packages/config-eslint/plugins/compat.js +0 -1
  8. package/packages/config-eslint/plugins/decorator-position.js +0 -1
  9. package/packages/config-eslint/plugins/eslint-comments.js +0 -1
  10. package/packages/config-eslint/plugins/etc.js +0 -1
  11. package/packages/config-eslint/plugins/ext.js +0 -1
  12. package/packages/config-eslint/plugins/filenames.js +0 -1
  13. package/packages/config-eslint/plugins/import.js +0 -4
  14. package/packages/config-eslint/plugins/jsdoc.js +0 -1
  15. package/packages/config-eslint/plugins/jsx-a11y.js +0 -1
  16. package/packages/config-eslint/plugins/lit-a11y.js +0 -1
  17. package/packages/config-eslint/plugins/lit.js +0 -1
  18. package/packages/config-eslint/plugins/more.js +0 -1
  19. package/packages/config-eslint/plugins/no-await-in-promise.js +0 -1
  20. package/packages/config-eslint/plugins/no-constructor-bind.js +0 -1
  21. package/packages/config-eslint/plugins/no-explicit-type-exports.js +0 -1
  22. package/packages/config-eslint/plugins/no-loops.js +0 -1
  23. package/packages/config-eslint/plugins/no-secrets.js +0 -1
  24. package/packages/config-eslint/plugins/no-use-extend-native.js +0 -1
  25. package/packages/config-eslint/plugins/{optional/node.js → node.js} +0 -1
  26. package/packages/config-eslint/plugins/prettier.js +0 -1
  27. package/packages/config-eslint/plugins/promise.js +0 -1
  28. package/packages/config-eslint/plugins/regexp.js +0 -1
  29. package/packages/config-eslint/plugins/{optional/security.js → security.js} +0 -1
  30. package/packages/config-eslint/plugins/simple-import-sort.js +0 -1
  31. package/packages/config-eslint/plugins/sonar.js +0 -1
  32. package/packages/config-eslint/plugins/sort-class-members.js +0 -1
  33. package/packages/config-eslint/plugins/sort-destructure-keys.js +0 -1
  34. package/packages/config-eslint/plugins/sort-keys-fix.js +0 -1
  35. package/packages/config-eslint/plugins/spellcheck.js +2 -12
  36. package/packages/config-eslint/plugins/sql.js +0 -1
  37. package/packages/config-eslint/plugins/tanstack-query.js +0 -1
  38. package/packages/config-eslint/plugins/testing-library.js +0 -1
  39. package/packages/config-eslint/plugins/typescript-sort-keys.js +0 -1
  40. package/packages/config-eslint/plugins/{typescript/index.js → typescript.js} +3 -4
  41. package/packages/config-eslint/plugins/unicorn.js +0 -1
  42. package/packages/config-eslint/plugins/unused-imports.js +0 -1
  43. package/packages/config-eslint/plugins/vitest.js +0 -1
  44. package/packages/config-eslint/plugins/vue-i18n.js +0 -1
  45. package/packages/config-eslint/plugins/vue.js +1 -10
  46. package/packages/config-eslint/plugins/vuejs-accessibility.js +0 -1
  47. package/packages/config-eslint/plugins/wc.js +0 -1
  48. package/packages/config-eslint/plugins/write-good-comments.js +0 -2
  49. package/packages/config-eslint/utils/extend-spell-checker.js +23 -0
  50. package/packages/config-stylelint/README.md +1 -1
  51. package/packages/config-stylelint/index.js +2 -2
  52. package/packages/config-eslint/plugins/no-inferred-method-name.js +0 -8
  53. package/packages/config-eslint/plugins/nuxt.js +0 -10
  54. package/packages/config-eslint/plugins/quasar.js +0 -6
  55. /package/packages/config-eslint/{plugins/typescript/allow-boolean-property-list.const.js → constants/allow-boolean-property-list.js} +0 -0
  56. /package/packages/config-eslint/{plugins/typescript/boolean-prefixes.const.js → constants/boolean-prefixes.js} +0 -0
  57. /package/packages/config-eslint/{plugins/typescript/english-verbs.const.js → constants/english-verbs.js} +0 -0
package/.eslintrc.cjs CHANGED
@@ -1,9 +1,3 @@
1
- const config = require('@alexlit/config-eslint');
1
+ const { createConfig } = require('@alexlit/config-eslint');
2
2
 
3
- module.exports = {
4
- ...config,
5
-
6
- rules: {
7
- ...config.rules,
8
- },
9
- };
3
+ module.exports = createConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/lint-kit",
3
- "version": "110.2.0",
3
+ "version": "111.0.0",
4
4
  "private": false,
5
5
  "description": "Preset of configuration files and dependencies for linting web applications (designed for Vue.js with TypeScript)",
6
6
  "keywords": [
@@ -8,62 +8,38 @@ npm i @alexlit/config-eslint -D
8
8
 
9
9
  ## Connection
10
10
 
11
- ```js
12
- // .eslintrc.js
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
- overrides: [
28
- {
29
- files: ['*.vue'],
30
- rules: {
31
- 'sort-keys': 'off',
32
- },
33
- },
34
- ];
35
- ```
16
+ const { createConfig } = require('@alexlit/config-eslint');
36
17
 
37
- ### Spell check
18
+ module.exports = createConfig();
19
+ ```
38
20
 
39
- - Skip some words
21
+ - Custom
40
22
 
41
23
  ```js
42
24
  // .eslintrc.js
43
- const SPELLCHECK_RULES = require('@alexlit/config-eslint/plugins/spellcheck')
44
- .rules['spellcheck/spell-checker'][1];
25
+ import { createConfig, extendSpellChecker } from '@alexlit/config-eslint';
45
26
 
46
- module.exports = {
47
- rules: {
48
- 'spellcheck/spell-checker': [
49
- 'warn',
50
- {
51
- ...SPELLCHECK_RULES,
27
+ module.exports = createConfig(
28
+ {
29
+ // disable some default plugins
30
+ vitest: false,
52
31
 
53
- skipWords: [...SPELLCHECK_RULES.skipWords, 'word1', 'word2'],
54
- },
55
- ],
32
+ // enable some optional plugins
33
+ node: true,
56
34
  },
57
- };
58
- ```
59
-
60
- - Disable spell checking
61
-
62
- ```js
63
- // .eslintrc.js
64
- module.exports = {
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
- /// <reference types="@eslint-types/typescript-eslint" />
7
- module.exports = defineConfig({
8
- env: {
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
- rules: {
94
- 'no-param-reassign': 'off',
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
- allowArrayEnd: true,
122
- allowArrayStart: true,
14
+ /** @see [eslint-plugin-decorator-position](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position) */
15
+ 'decorator-position': true,
123
16
 
124
- allowBlockEnd: true,
125
- allowBlockStart: true,
17
+ /** @see [eslint-plugin-eslint-comments](hhttps://github.com/mysticatea/eslint-plugin-eslint-comments) */
18
+ 'eslint-comments': true,
126
19
 
127
- allowClassEnd: true,
128
- allowClassStart: true,
20
+ /** @see [eslint-plugin-etc](https://github.com/cartant/eslint-plugin-etc) */
21
+ etc: true,
129
22
 
130
- allowObjectEnd: true,
131
- allowObjectStart: true,
23
+ /** @see [eslint-plugin-ext](https://github.com/jiangfengming/eslint-plugin-ext) */
24
+ ext: true,
132
25
 
133
- beforeBlockComment: true,
134
- beforeLineComment: false,
135
- },
136
- ],
26
+ /** @see [eslint-plugin-filenames](https://github.com/selaux/eslint-plugin-filenames) */
27
+ filenames: true,
137
28
 
138
- 'no-console': 'warn',
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
- 'no-implicit-coercion': 'error',
35
+ /** @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) */
36
+ jsdoc: true,
141
37
 
142
- 'no-param-reassign': ['error', { props: false }],
38
+ /** @see [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) */
39
+ 'jsx-a11y': true,
143
40
 
144
- 'no-restricted-exports': [
145
- 'error',
146
- {
147
- restrictedNamedExports: [
148
- 'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
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
- 'no-return-await': 'off',
154
-
155
- 'no-shadow': 'off',
156
-
157
- 'no-underscore-dangle': 'off',
158
-
159
- 'no-unused-vars': 'off',
160
-
161
- // delegate to eslint-plugin-unused-imports
162
- 'no-use-before-define': 'off',
163
-
164
- 'nonblock-statement-body-position': ['error', 'below'],
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
- quotes: ['error', 'single'],
216
- 'require-await': 'off',
209
+ overrides: [
210
+ {
211
+ files: ['.*.cjs', '.*.js'],
217
212
 
218
- 'sort-imports': [
219
- 'warn',
213
+ rules: {
214
+ 'global-require': 'off',
215
+ },
216
+ },
220
217
  {
221
- allowSeparatedGroups: true,
222
- ignoreCase: true,
223
- ignoreDeclarationSort: true,
224
- ignoreMemberSort: false,
225
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
218
+ files: ['**/store/**/*', '**/vuex/**/*', '**/pinia/**/*'],
219
+
220
+ rules: {
221
+ 'no-param-reassign': 'off',
222
+ },
226
223
  },
227
- ],
228
224
 
229
- 'sort-keys': [
230
- 'warn',
231
- 'asc',
232
- { caseSensitive: true, minKeys: 2, natural: true },
225
+ ...(options.overrides ?? []),
233
226
  ],
234
227
 
235
- 'sort-vars': 'warn',
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": "76.8.0",
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,5 +1,4 @@
1
1
  /* eslint-disable unicorn/prevent-abbreviations */
2
- /** @see [eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func) */
3
2
  module.exports = {
4
3
  extends: ['plugin:array-func/all'],
5
4
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) */
2
1
  module.exports = {
3
2
  extends: ['plugin:compat/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-decorator-position](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position) */
2
1
  module.exports = {
3
2
  extends: ['plugin:decorator-position/base'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-eslint-comments](hhttps://github.com/mysticatea/eslint-plugin-eslint-comments) */
2
1
  module.exports = {
3
2
  extends: ['plugin:eslint-comments/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-etc](https://github.com/cartant/eslint-plugin-etc) */
2
1
  module.exports = {
3
2
  extends: ['plugin:etc/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-ext](https://github.com/jiangfengming/eslint-plugin-ext) */
2
1
  // eslint-disable-next-line unicorn/prevent-abbreviations
3
2
  module.exports = {
4
3
  plugins: ['ext'],
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable regexp/no-super-linear-backtracking */
2
- /** @see [eslint-plugin-filenames](https://github.com/selaux/eslint-plugin-filenames) */
3
2
  module.exports = {
4
3
  overrides: [
5
4
  {
@@ -1,7 +1,3 @@
1
- /**
2
- * @see [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import)
3
- * @see [eslint-import-resolver-alias](https://github.com/johvin/eslint-import-resolver-alias)
4
- */
5
1
  module.exports = {
6
2
  extends: [
7
3
  'plugin:import/errors',
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) */
2
1
  module.exports = {
3
2
  extends: ['plugin:jsdoc/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) */
2
1
  module.exports = {
3
2
  extends: ['plugin:jsx-a11y/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-lit-a11y](https://www.npmjs.com/package/eslint-plugin-lit-a11y) */
2
1
  module.exports = {
3
2
  extends: ['plugin:lit-a11y/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-lit](https://github.com/43081j/eslint-plugin-lit) */
2
1
  module.exports = {
3
2
  extends: ['plugin:lit/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-more](https://github.com/WebbyLab/eslint-plugin-more) */
2
1
  module.exports = {
3
2
  overrides: [
4
3
  {
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-await-in-promise](https://github.com/hugo-vrijswijk/eslint-plugin-no-await-in-promise/) */
2
1
  module.exports = {
3
2
  extends: ['plugin:no-await-in-promise/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-constructor-bind](https://github.com/markalfred/eslint-plugin-no-constructor-bind) */
2
1
  module.exports = {
3
2
  plugins: ['no-constructor-bind'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-explicit-type-exports](https://github.com/intuit/eslint-plugin-no-explicit-type-exports) */
2
1
  module.exports = {
3
2
  plugins: ['eslint-plugin-no-explicit-type-exports'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-loops](https://github.com/buildo/eslint-plugin-no-loops) */
2
1
  module.exports = {
3
2
  plugins: ['no-loops'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-secrets](https://github.com/nickdeis/eslint-plugin-no-secrets) */
2
1
  module.exports = {
3
2
  plugins: ['no-secrets'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native) */
2
1
  module.exports = {
3
2
  extends: ['plugin:no-use-extend-native/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) */
2
1
  module.exports = {
3
2
  extends: ['plugin:node/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) */
2
1
  module.exports = {
3
2
  extends: ['prettier'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) */
2
1
  module.exports = {
3
2
  extends: ['plugin:promise/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp) */
2
1
  module.exports = {
3
2
  extends: ['plugin:regexp/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) */
2
1
  module.exports = {
3
2
  extends: ['plugin:security/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort) */
2
1
  module.exports = {
3
2
  plugins: ['simple-import-sort'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) */
2
1
  module.exports = {
3
2
  extends: ['plugin:sonarjs/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-sort-class-members](https://github.com/bryanrsmith/eslint-plugin-sort-class-members) */
2
1
  module.exports = {
3
2
  plugins: ['sort-class-members'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-sort-destructure-keys](https://github.com/mthadley/eslint-plugin-sort-destructure-keys) */
2
1
  module.exports = {
3
2
  plugins: ['sort-destructure-keys'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-sort-keys-fix](https://github.com/leo-buneev/eslint-plugin-sort-keys-fix) */
2
1
  module.exports = {
3
2
  plugins: ['sort-keys-fix'],
4
3
 
@@ -1,19 +1,9 @@
1
- const skipWords = require('../dictionaries');
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,4 +1,3 @@
1
- /** @see [eslint-plugin-sql](https://github.com/gajus/eslint-plugin-sql) */
2
1
  module.exports = {
3
2
  plugins: ['sql'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [@tanstack/query](https://tanstack.com/query/v4/docs/react/eslint/eslint-plugin-query) */
2
1
  module.exports = {
3
2
  extends: ['plugin:@tanstack/eslint-plugin-query/recommended'],
4
3
  plugins: ['@tanstack/query'],
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) */
2
1
  module.exports = {
3
2
  overrides: [
4
3
  {
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-typescript-sort-keys](https://github.com/infctr/eslint-plugin-typescript-sort-keys) */
2
1
  module.exports = {
3
2
  extends: ['plugin:typescript-sort-keys/recommended'],
4
3
 
@@ -1,10 +1,9 @@
1
1
  /* eslint-disable unicorn/no-null */
2
2
 
3
- const ALLOW_BOOLEAN_PROPERTY_LIST = require('./allow-boolean-property-list.const');
4
- const BOOLEAN_PREFIXES = require('./boolean-prefixes.const');
5
- const ENGLISH_VERBS = require('./english-verbs.const');
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,4 +1,3 @@
1
- /** @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) */
2
1
  module.exports = {
3
2
  extends: ['plugin:unicorn/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-unused-imports](https://github.com/sweepline/eslint-plugin-unused-imports) */
2
1
  module.exports = {
3
2
  plugins: ['unused-imports'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) */
2
1
  module.exports = {
3
2
  overrides: [
4
3
  {
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/) */
2
1
  module.exports = {
3
2
  extends: ['plugin:@intlify/vue-i18n/recommended'],
4
3
 
@@ -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
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-vuejs-accessibility](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility) */
2
1
  module.exports = {
3
2
  extends: ['plugin:vuejs-accessibility/recommended'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc) */
2
1
  module.exports = {
3
2
  extends: ['plugin:wc/recommended'],
4
3
 
@@ -1,5 +1,3 @@
1
- /** @see [eslint-plugin-write-good-comments](https://github.com/kantord/eslint-plugin-write-good-comments) */
2
-
3
1
  module.exports = {
4
2
  plugins: ['write-good-comments'],
5
3
 
@@ -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#L62))
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 PRETTIER_PLUGINS = {
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
- ...PRETTIER_PLUGINS,
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
- };
@@ -1,10 +0,0 @@
1
- /** @see [eslint-plugin-nuxt](https://github.com/nuxt/eslint-plugin-nuxt) */
2
- module.exports = {
3
- extends: ['plugin:nuxt/recommended'],
4
-
5
- plugins: ['nuxt'],
6
-
7
- rules: {
8
- 'nuxt/require-func-head': 'error',
9
- },
10
- };
@@ -1,6 +0,0 @@
1
- /** @see [eslint-plugin-quasar](https://github.com/quasarframework/eslint-plugin-quasar) */
2
- module.exports = {
3
- extends: ['plugin:quasar/standard'],
4
-
5
- plugins: ['quasar'],
6
- };