eslint-config-any 3.0.0-beta.2 → 3.0.0-beta.3
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/dist/index.js +2 -1
- package/package.json +4 -5
- package/src/configs/browser.js +7 -0
- package/src/configs/commonjs.js +11 -0
- package/src/configs/create-config.js +186 -0
- package/src/configs/index.js +21 -43
- package/src/configs/jest.js +9 -0
- package/src/configs/next.js +17 -0
- package/src/configs/node.js +7 -0
- package/src/configs/react.js +32 -0
- package/src/configs/sharedNodeAndBrowser.js +7 -0
- package/src/configs/vitest.js +9 -0
- package/src/configs/vue.js +19 -0
- package/src/configs/vue2.js +19 -0
- package/src/environments/browser.js +8 -0
- package/src/environments/commonjs.js +7 -0
- package/src/environments/index.js +17 -0
- package/src/environments/jest.js +8 -0
- package/src/environments/node.js +11 -0
- package/src/environments/sharedNodeAndBrowser.js +8 -0
- package/src/environments/vitest.js +8 -0
- package/src/files/ignores.js +10 -0
- package/src/files/index.js +34 -0
- package/src/index.js +45 -0
- package/src/plugins/array-func.js +7 -0
- package/src/plugins/eslint-comments.js +7 -0
- package/src/plugins/import-helpers.js +9 -0
- package/src/plugins/import-x.js +25 -0
- package/src/plugins/index.js +54 -0
- package/src/plugins/js.js +7 -0
- package/src/plugins/json.js +29 -0
- package/src/plugins/jsx-a11y-x.js +7 -0
- package/src/plugins/markdown.js +7 -0
- package/src/plugins/next.js +7 -0
- package/src/plugins/perfectionist.js +9 -0
- package/src/plugins/prettier.js +7 -0
- package/src/plugins/react.js +21 -0
- package/src/plugins/regexp.js +7 -0
- package/src/plugins/stylistic.js +9 -0
- package/src/plugins/typescript.js +15 -0
- package/src/plugins/vue.js +24 -0
- package/src/rules/commonjs.js +3 -0
- package/src/rules/index.js +45 -0
- package/src/rules/prettier.js +20 -0
- package/src/{configs/typescript/rules/index.js → rules/typescript.js} +11 -2
- package/src/configs/base/index.js +0 -48
- package/src/configs/base/plugins/@eslint-community___eslint-comments/index.js +0 -18
- package/src/configs/base/plugins/@stylistic/index.js +0 -17
- package/src/configs/base/plugins/array-func/index.js +0 -18
- package/src/configs/base/plugins/import-helpers/index.js +0 -17
- package/src/configs/base/plugins/import-x/index.js +0 -31
- package/src/configs/base/plugins/json/index.js +0 -26
- package/src/configs/base/plugins/json/rules/index.js +0 -3
- package/src/configs/base/plugins/markdown/index.js +0 -5
- package/src/configs/base/plugins/markdown/rules/index.js +0 -3
- package/src/configs/base/plugins/perfectionist/index.js +0 -17
- package/src/configs/base/plugins/regexp/index.js +0 -18
- package/src/configs/base/plugins/regexp/rules/index.js +0 -3
- package/src/configs/env/browser/index.js +0 -10
- package/src/configs/env/commonjs/index.js +0 -17
- package/src/configs/env/index.js +0 -15
- package/src/configs/env/jest/index.js +0 -15
- package/src/configs/env/node/index.js +0 -13
- package/src/configs/env/sharedNodeAndBrowser/index.js +0 -10
- package/src/configs/env/vitest/index.js +0 -15
- package/src/configs/next/index.js +0 -20
- package/src/configs/prettier/index.js +0 -27
- package/src/configs/react/index.js +0 -38
- package/src/configs/typescript/index.js +0 -33
- package/src/configs/vue/index.js +0 -7
- package/src/configs/vue/shared/index.js +0 -24
- package/src/configs/vue/v2/index.js +0 -21
- package/src/configs/vue/v2/rules/index.js +0 -1
- package/src/configs/vue/v3/index.js +0 -21
- package/src/configs/vue/v3/rules/index.js +0 -1
- package/src/utils/extensions/index.js +0 -3
- package/src/utils/index.js +0 -1
- /package/src/{utils/extensions → files}/extensions.js +0 -0
- /package/src/{utils/extensions → files}/file-extensions-set.js +0 -0
- /package/src/{utils/extensions → files}/helpers.js +0 -0
- /package/src/{configs/react/kit → plugins/react}/jsx-boolean-value.js +0 -0
- /package/src/{configs/base/plugins/array-func/rules/index.js → rules/array-func.js} +0 -0
- /package/src/{configs/base/plugins/import-helpers/rules/index.js → rules/import-helpers.js} +0 -0
- /package/src/{configs/base/plugins/import-x/rules/index.js → rules/import-x.js} +0 -0
- /package/src/{configs/base/rules/index.js → rules/js.js} +0 -0
- /package/src/{configs/base/plugins/perfectionist/rules/index.js → rules/perfectionist.js} +0 -0
- /package/src/{configs/react/rules/index.js → rules/react.js} +0 -0
- /package/src/{configs/base/plugins/@stylistic/rules/index.js → rules/stylistic.js} +0 -0
- /package/src/{configs/vue/shared/rules/index.js → rules/vue.js} +0 -0
- /package/src/{configs/base/plugins/@eslint-community___eslint-comments/rules/index.js → rules/vue2.js} +0 -0
- /package/src/{configs/next/rules/index.js → rules/vue3.js} +0 -0
package/README.md
CHANGED
|
@@ -25,62 +25,62 @@ Requires **ESLint 10+** and **Node 22+**.
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
2. Create a `eslint.config.mjs` file at project root.
|
|
28
|
-
3. Write some boilerplate like below, selecting the
|
|
28
|
+
3. Write some boilerplate like below, selecting the configs you need:
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
// eslint.config.mjs
|
|
32
32
|
import anyConfig from 'eslint-config-any';
|
|
33
33
|
|
|
34
34
|
export default [
|
|
35
|
-
...anyConfig.react,
|
|
36
|
-
...anyConfig.vitest,
|
|
35
|
+
...anyConfig.react(),
|
|
36
|
+
...anyConfig.vitest(),
|
|
37
37
|
];
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
## Which
|
|
40
|
+
## Which configs can I pick?
|
|
41
41
|
|
|
42
42
|
This package is designed to make you write the less code as possible, so you don't need to deal with scaffold-hell and learning how to setup a ESlint or Prettier configuration.
|
|
43
43
|
|
|
44
44
|
With ESLint 10+ and its [Flat Configuration](https://eslint.org/blog/2022/08/new-config-system-part-1/), things got a little more complicated to setup, specially if you seek stricter rules for linting and formatting (like I do). However, things got way more flexible, allowing plugins and configs to apply only to certain files that actually use them for linting. For example, you'll only need `eslint-plugin-vue` for `*.vue` files, ot TypeScript-specific rules in files that actually use TS, and so on.
|
|
45
45
|
|
|
46
|
-
So you'll' just need to select one generalized
|
|
46
|
+
So you'll' just need to select one generalized config and make small compositions in a few cases.
|
|
47
47
|
|
|
48
|
-
The current
|
|
48
|
+
The current configs available are:
|
|
49
49
|
|
|
50
50
|
- `react`: for React projects, adding support not only for basic JS files but also TS, JSX and TSX extensions, as well as providing browser's global variables.
|
|
51
51
|
- `next`: for Next.js projects. Includes the full `react` stack plus `@next/eslint-plugin-next` (`core-web-vitals`). **Don't select both `react` and `next`, as they overlap**.
|
|
52
52
|
- `vue`: for Vue 3 projects, adding support not only for basic JS files but also TS and VUE extensions, as well as providing browser's global variables.
|
|
53
|
-
- `vue2`: similar to `vue` option, except it contains some specific rules for Vue v2 only. **Don't select both
|
|
53
|
+
- `vue2`: similar to `vue` option, except it contains some specific rules for Vue v2 only. **Don't select both configs, as they may conflict with each other**.
|
|
54
54
|
- `browser`: if your project does not use nay of the previous frameworks and is meant to run in the client-side, that's the one to go with. It lints files with JS and TS extensions and provides browser's global variables.
|
|
55
|
-
- `node`: if you're writing code for the server-side, use this
|
|
55
|
+
- `node`: if you're writing code for the server-side, use this config to lint JS and TS files, as well as providing Node's global variables.
|
|
56
56
|
- `sharedNodeAndBrowser`: if you're project targets browser and node environments, this not only lints JS and TS files, but also ensure you only use global variables that are available in both environments.
|
|
57
|
-
- `commonjs`: all the
|
|
58
|
-
- `jest`: if you're using Jest as test runner, add this
|
|
59
|
-
- `vitest`: if you're using Vitest as test runner, add this
|
|
57
|
+
- `commonjs`: all the configs above consider projects using ES Modules. But if you're using CommonJS, combine this option to make this standard compatible.
|
|
58
|
+
- `jest`: if you're using Jest as test runner, add this config in combination of another to allow Jest variables.
|
|
59
|
+
- `vitest`: if you're using Vitest as test runner, add this config in combination of another to allow Vitest variables.
|
|
60
60
|
|
|
61
61
|
## Customization
|
|
62
62
|
|
|
63
|
-
Not everyone follow the same rules.
|
|
63
|
+
Not everyone follow the same rules. If your project is one of these, pass overrides into a config factory or add a new object to your flat config array:
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
66
|
// eslint.config.mjs
|
|
67
67
|
import anyConfig from 'eslint-config-any';
|
|
68
68
|
|
|
69
69
|
export default [
|
|
70
|
-
...anyConfig.node
|
|
71
|
-
...anyConfig.commonjs,
|
|
72
|
-
...anyConfig.jest,
|
|
73
|
-
{
|
|
70
|
+
...anyConfig.node({
|
|
74
71
|
rules: {
|
|
75
72
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
76
73
|
'no-console': 'off',
|
|
77
74
|
'import-x/no-duplicates': 'off',
|
|
78
|
-
'jsx-a11y-x/no-autofocus': 'error',
|
|
79
75
|
},
|
|
80
|
-
},
|
|
76
|
+
}),
|
|
77
|
+
...anyConfig.commonjs(),
|
|
78
|
+
...anyConfig.jest(),
|
|
81
79
|
];
|
|
82
80
|
```
|
|
83
81
|
|
|
82
|
+
Config factories accept `{ files, ignores, rules, languageOptions, settings }`. Building blocks (`files`, `environments`, `plugins`, `rules`) are also on the default export if you want to compose your own stack.
|
|
83
|
+
|
|
84
84
|
React/import/a11y/Next overrides use `@eslint-react/*`, `import-x/*`, `jsx-a11y-x/*`, and `@next/next/*` (not `react/*`, `react-hooks/*`, `import/*`, or `jsx-a11y/*`).
|
|
85
85
|
|
|
86
86
|
If the Next app is not at the ESLint cwd (monorepo), set `settings.next.rootDir` in your config.
|
|
@@ -88,7 +88,7 @@ If the Next app is not at the ESLint cwd (monorepo), set `settings.next.rootDir`
|
|
|
88
88
|
## ESLint 10 notes
|
|
89
89
|
|
|
90
90
|
- `eslint:recommended` now includes `no-unassigned-vars`, `no-useless-assignment`, and `preserve-caught-error`. This package leaves them on.
|
|
91
|
-
- `/* eslint-env */` comments are errors; use `languageOptions.globals` or these
|
|
91
|
+
- `/* eslint-env */` comments are errors; use `languageOptions.globals` or these configs.
|
|
92
92
|
- Config files are resolved from each linted file upward (monorepos: put `eslint.config.*` where the files live, or pass `--config`).
|
|
93
93
|
- `.eslintignore` is gone; if you need gitignore-driven ignores, use `includeIgnoreFile()` from `eslint/config` in **your** config.
|
|
94
94
|
- JSX components count as variable references (`no-unused-vars` / `no-undef`).
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from '../src/
|
|
1
|
+
export { default } from '../src/index.js';
|
|
2
|
+
export * from '../src/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-any",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
4
|
"description": "ESLint configuration for JavaScript, TypeScript, React, Next.js & Vue projects, by Julio L. Muller",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@eslint-community/eslint-plugin-eslint-comments": "~4.8.1",
|
|
62
|
-
"@eslint-react/eslint-plugin": "~5.
|
|
63
|
-
"@eslint-react/kit": "~5.
|
|
62
|
+
"@eslint-react/eslint-plugin": "~5.21.1",
|
|
63
|
+
"@eslint-react/kit": "~5.21.1",
|
|
64
64
|
"@eslint/js": "^10.0.1",
|
|
65
65
|
"@eslint/json": "~2.1.0",
|
|
66
66
|
"@eslint/markdown": "~8.0.3",
|
|
@@ -86,10 +86,9 @@
|
|
|
86
86
|
"@commitlint/config-conventional": "^21.2.3",
|
|
87
87
|
"@commitlint/prompt-cli": "^21.2.3",
|
|
88
88
|
"@types/bun": "^1.4.2",
|
|
89
|
-
"conventional-changelog-conventionalcommits": "^10.4.0",
|
|
90
89
|
"eslint": "^10.11.0",
|
|
91
90
|
"husky": "^9.1.7",
|
|
92
|
-
"lint-staged": "^17.
|
|
91
|
+
"lint-staged": "^17.6.0",
|
|
93
92
|
"typescript": "~6.0.3"
|
|
94
93
|
}
|
|
95
94
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import * as rules from '../rules/index.js';
|
|
4
|
+
import { createAddonConfig } from './create-config.js';
|
|
5
|
+
|
|
6
|
+
export default createAddonConfig({
|
|
7
|
+
name: 'any/commonjs',
|
|
8
|
+
files: files.cjs,
|
|
9
|
+
extends: [environments.commonjs],
|
|
10
|
+
rules: rules.commonjs,
|
|
11
|
+
});
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
2
|
+
|
|
3
|
+
import * as environments from '../environments/index.js';
|
|
4
|
+
import * as files from '../files/index.js';
|
|
5
|
+
import * as plugins from '../plugins/index.js';
|
|
6
|
+
import * as rules from '../rules/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('eslint').Linter.Config} EslintConfig
|
|
10
|
+
*
|
|
11
|
+
* @typedef {import('eslint').Linter.RulesRecord} EslintRules
|
|
12
|
+
*
|
|
13
|
+
* @typedef {Object} ConfigOptions
|
|
14
|
+
* @property {string[]} [files]
|
|
15
|
+
* @property {string[]} [ignores]
|
|
16
|
+
* @property {EslintRules} [rules]
|
|
17
|
+
* @property {EslintConfig['languageOptions']} [languageOptions]
|
|
18
|
+
* @property {Record<string, unknown>} [settings]
|
|
19
|
+
*
|
|
20
|
+
* @typedef {Object} CreateConfigInput
|
|
21
|
+
* @property {string} name
|
|
22
|
+
* @property {string[]} [files]
|
|
23
|
+
* @property {string[]} [typescriptFiles]
|
|
24
|
+
* @property {EslintConfig[]} [extends]
|
|
25
|
+
* @property {EslintRules} [rules]
|
|
26
|
+
* @property {EslintConfig[]} [extraLayers]
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Object} CreateAddonConfigInput
|
|
29
|
+
* @property {string} name
|
|
30
|
+
* @property {string[]} files
|
|
31
|
+
* @property {EslintConfig[]} extends
|
|
32
|
+
* @property {EslintRules} [rules]
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export const basePlugins = [
|
|
36
|
+
plugins.jsConfigs,
|
|
37
|
+
plugins.eslintCommentsConfigs,
|
|
38
|
+
plugins.arrayFuncConfigs,
|
|
39
|
+
plugins.importXConfigs,
|
|
40
|
+
plugins.importHelpersConfigs,
|
|
41
|
+
plugins.perfectionistConfigs,
|
|
42
|
+
plugins.regexpConfigs,
|
|
43
|
+
plugins.stylisticConfigs,
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export const baseRules = {
|
|
47
|
+
...rules.js,
|
|
48
|
+
...rules.arrayFunc,
|
|
49
|
+
...rules.importX,
|
|
50
|
+
...rules.importHelpers,
|
|
51
|
+
...rules.perfectionist,
|
|
52
|
+
...rules.stylistic,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {EslintConfig} config
|
|
57
|
+
* @param {ConfigOptions} options
|
|
58
|
+
* @returns {EslintConfig}
|
|
59
|
+
*/
|
|
60
|
+
function applyOverrides(config, options) {
|
|
61
|
+
const nextConfig = { ...config };
|
|
62
|
+
|
|
63
|
+
if (options.languageOptions) {
|
|
64
|
+
nextConfig.languageOptions = options.languageOptions;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (options.settings) {
|
|
68
|
+
nextConfig.settings = options.settings;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return nextConfig;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {CreateConfigInput} input
|
|
76
|
+
* @returns {(options?: ConfigOptions) => ReturnType<typeof defineConfig>}
|
|
77
|
+
*/
|
|
78
|
+
export function createConfig({
|
|
79
|
+
name,
|
|
80
|
+
files: defaultFiles = files.scripts,
|
|
81
|
+
typescriptFiles = files.typescript,
|
|
82
|
+
extends: extraExtends = [],
|
|
83
|
+
rules: extraRules = {},
|
|
84
|
+
extraLayers = [],
|
|
85
|
+
}) {
|
|
86
|
+
/**
|
|
87
|
+
* @param {ConfigOptions} [options]
|
|
88
|
+
*/
|
|
89
|
+
return function config(options = {}) {
|
|
90
|
+
const scriptFiles = options.files ?? defaultFiles;
|
|
91
|
+
const scriptLayer = applyOverrides(
|
|
92
|
+
{
|
|
93
|
+
name,
|
|
94
|
+
files: scriptFiles,
|
|
95
|
+
extends: [...basePlugins, ...extraExtends],
|
|
96
|
+
rules: { ...baseRules, ...extraRules },
|
|
97
|
+
},
|
|
98
|
+
options,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const configs = [
|
|
102
|
+
globalIgnores(options.ignores ?? files.ignores),
|
|
103
|
+
{
|
|
104
|
+
name: 'any/json',
|
|
105
|
+
files: files.json,
|
|
106
|
+
extends: [plugins.jsonConfigs.json],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'any/jsonc',
|
|
110
|
+
files: files.jsonc,
|
|
111
|
+
extends: [plugins.jsonConfigs.jsonc],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'any/json5',
|
|
115
|
+
files: files.json5,
|
|
116
|
+
extends: [plugins.jsonConfigs.json5],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'any/markdown',
|
|
120
|
+
files: files.markdown,
|
|
121
|
+
extends: [plugins.markdownConfigs],
|
|
122
|
+
},
|
|
123
|
+
scriptLayer,
|
|
124
|
+
{
|
|
125
|
+
name: 'any/typescript',
|
|
126
|
+
files: typescriptFiles,
|
|
127
|
+
extends: [plugins.typescriptConfigs],
|
|
128
|
+
rules: rules.typescript,
|
|
129
|
+
},
|
|
130
|
+
...extraLayers,
|
|
131
|
+
{
|
|
132
|
+
name: 'any/cjs',
|
|
133
|
+
files: ['**/*.cjs'],
|
|
134
|
+
extends: [environments.commonjs],
|
|
135
|
+
rules: rules.commonjs,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'any/prettier',
|
|
139
|
+
extends: [plugins.prettierConfigs],
|
|
140
|
+
rules: rules.prettier,
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
if (options.rules) {
|
|
145
|
+
configs.push({
|
|
146
|
+
name: `${name}/overrides`,
|
|
147
|
+
files: scriptFiles,
|
|
148
|
+
rules: options.rules,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return defineConfig(configs);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @param {CreateAddonConfigInput} input
|
|
158
|
+
* @returns {(options?: ConfigOptions) => ReturnType<typeof defineConfig>}
|
|
159
|
+
*/
|
|
160
|
+
export function createAddonConfig({
|
|
161
|
+
name,
|
|
162
|
+
files: defaultFiles,
|
|
163
|
+
extends: addonExtends,
|
|
164
|
+
rules: addonRules = {},
|
|
165
|
+
}) {
|
|
166
|
+
/**
|
|
167
|
+
* @param {ConfigOptions} [options]
|
|
168
|
+
*/
|
|
169
|
+
return function config(options = {}) {
|
|
170
|
+
const config = applyOverrides(
|
|
171
|
+
{
|
|
172
|
+
name,
|
|
173
|
+
files: options.files ?? defaultFiles,
|
|
174
|
+
extends: addonExtends,
|
|
175
|
+
rules: { ...addonRules, ...options.rules },
|
|
176
|
+
},
|
|
177
|
+
options,
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
if (options.ignores) {
|
|
181
|
+
return defineConfig([globalIgnores(options.ignores), config]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return defineConfig(config);
|
|
185
|
+
};
|
|
186
|
+
}
|
package/src/configs/index.js
CHANGED
|
@@ -1,47 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import browser from './browser.js';
|
|
2
|
+
import commonjs from './commonjs.js';
|
|
3
|
+
import jest from './jest.js';
|
|
4
|
+
import next from './next.js';
|
|
5
|
+
import node from './node.js';
|
|
6
|
+
import react from './react.js';
|
|
7
|
+
import sharedNodeAndBrowser from './sharedNodeAndBrowser.js';
|
|
8
|
+
import vitest from './vitest.js';
|
|
9
|
+
import vue from './vue.js';
|
|
10
|
+
import vue2 from './vue2.js';
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
* @typedef {import('eslint/config').ConfigObject[]} EslintFlatConfig
|
|
11
|
-
*
|
|
12
|
-
* @typedef {Object} EslintFlatConfigSetup
|
|
13
|
-
* @property {EslintFlatConfig} commonjs
|
|
14
|
-
* @property {EslintFlatConfig} jest
|
|
15
|
-
* @property {EslintFlatConfig} vitest
|
|
16
|
-
* @property {EslintFlatConfig} node
|
|
17
|
-
* @property {EslintFlatConfig} browser
|
|
18
|
-
* @property {EslintFlatConfig} sharedNodeAndBrowser
|
|
19
|
-
* @property {EslintFlatConfig} react
|
|
20
|
-
* @property {EslintFlatConfig} next
|
|
21
|
-
* @property {EslintFlatConfig} vue
|
|
22
|
-
* @property {EslintFlatConfig} vue2
|
|
23
|
-
*/
|
|
12
|
+
export { browser, commonjs, jest, next, node, react, sharedNodeAndBrowser, vitest, vue, vue2 };
|
|
24
13
|
|
|
25
|
-
/**
|
|
26
|
-
* @param {EslintFlatConfig} otherConfigs
|
|
27
|
-
* @returns {EslintFlatConfig}
|
|
28
|
-
*/
|
|
29
|
-
function mergeConfigs(otherConfigs) {
|
|
30
|
-
return [...jsConfigs, ...tsConfigs, ...otherConfigs, ...prettierConfigs];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @type {EslintFlatConfigSetup}
|
|
35
|
-
*/
|
|
36
14
|
export default {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
vue
|
|
46
|
-
vue2
|
|
15
|
+
browser,
|
|
16
|
+
commonjs,
|
|
17
|
+
jest,
|
|
18
|
+
next,
|
|
19
|
+
node,
|
|
20
|
+
react,
|
|
21
|
+
sharedNodeAndBrowser,
|
|
22
|
+
vitest,
|
|
23
|
+
vue,
|
|
24
|
+
vue2,
|
|
47
25
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import { createAddonConfig } from './create-config.js';
|
|
4
|
+
|
|
5
|
+
export default createAddonConfig({
|
|
6
|
+
name: 'any/jest',
|
|
7
|
+
files: files.test,
|
|
8
|
+
extends: [environments.jest],
|
|
9
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as plugins from '../plugins/index.js';
|
|
3
|
+
import { createConfig } from './create-config.js';
|
|
4
|
+
import { reactExtraLayers, reactScriptFiles } from './react.js';
|
|
5
|
+
|
|
6
|
+
export default createConfig({
|
|
7
|
+
name: 'any/next',
|
|
8
|
+
extends: [environments.browser],
|
|
9
|
+
extraLayers: [
|
|
10
|
+
...reactExtraLayers,
|
|
11
|
+
{
|
|
12
|
+
name: 'any/next',
|
|
13
|
+
files: reactScriptFiles,
|
|
14
|
+
extends: [plugins.nextConfigs],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import * as plugins from '../plugins/index.js';
|
|
4
|
+
import * as rules from '../rules/index.js';
|
|
5
|
+
import { createConfig } from './create-config.js';
|
|
6
|
+
|
|
7
|
+
export const reactScriptFiles = [...files.js, ...files.ts];
|
|
8
|
+
|
|
9
|
+
export const reactExtraLayers = [
|
|
10
|
+
{
|
|
11
|
+
name: 'any/react/js',
|
|
12
|
+
files: files.js,
|
|
13
|
+
extends: [plugins.reactConfigs.strict],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'any/react/ts',
|
|
17
|
+
files: files.ts,
|
|
18
|
+
extends: [plugins.reactConfigs.strictTypeChecked],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'any/react/shared',
|
|
22
|
+
files: reactScriptFiles,
|
|
23
|
+
extends: [plugins.reactConfigs.kit, plugins.jsxA11yXConfigs],
|
|
24
|
+
rules: rules.react,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export default createConfig({
|
|
29
|
+
name: 'any/react',
|
|
30
|
+
extends: [environments.browser],
|
|
31
|
+
extraLayers: reactExtraLayers,
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import { createAddonConfig } from './create-config.js';
|
|
4
|
+
|
|
5
|
+
export default createAddonConfig({
|
|
6
|
+
name: 'any/vitest',
|
|
7
|
+
files: files.test,
|
|
8
|
+
extends: [environments.vitest],
|
|
9
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import * as plugins from '../plugins/index.js';
|
|
4
|
+
import * as rules from '../rules/index.js';
|
|
5
|
+
import { createConfig } from './create-config.js';
|
|
6
|
+
|
|
7
|
+
export default createConfig({
|
|
8
|
+
name: 'any/vue',
|
|
9
|
+
files: files.scriptsAndVue,
|
|
10
|
+
typescriptFiles: files.typescriptAndVue,
|
|
11
|
+
extraLayers: [
|
|
12
|
+
{
|
|
13
|
+
name: 'any/vue',
|
|
14
|
+
files: files.vue,
|
|
15
|
+
extends: [environments.browser, plugins.Configs.parser, plugins.Configs.vue3],
|
|
16
|
+
rules: { ...rules.vue, ...rules.vue3 },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as environments from '../environments/index.js';
|
|
2
|
+
import * as files from '../files/index.js';
|
|
3
|
+
import * as plugins from '../plugins/index.js';
|
|
4
|
+
import * as rules from '../rules/index.js';
|
|
5
|
+
import { createConfig } from './create-config.js';
|
|
6
|
+
|
|
7
|
+
export default createConfig({
|
|
8
|
+
name: 'any/vue2',
|
|
9
|
+
files: files.scriptsAndVue,
|
|
10
|
+
typescriptFiles: files.typescriptAndVue,
|
|
11
|
+
extraLayers: [
|
|
12
|
+
{
|
|
13
|
+
name: 'any/vue2',
|
|
14
|
+
files: files.vue,
|
|
15
|
+
extends: [environments.browser, plugins.Configs.parser, plugins.Configs.vue2],
|
|
16
|
+
rules: { ...rules.vue, ...rules.vue2 },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import browser from './browser.js';
|
|
2
|
+
import commonjs from './commonjs.js';
|
|
3
|
+
import jest from './jest.js';
|
|
4
|
+
import node from './node.js';
|
|
5
|
+
import sharedNodeAndBrowser from './sharedNodeAndBrowser.js';
|
|
6
|
+
import vitest from './vitest.js';
|
|
7
|
+
|
|
8
|
+
export { browser, commonjs, jest, node, sharedNodeAndBrowser, vitest };
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
browser,
|
|
12
|
+
commonjs,
|
|
13
|
+
jest,
|
|
14
|
+
node,
|
|
15
|
+
sharedNodeAndBrowser,
|
|
16
|
+
vitest,
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CJS, DTS, JS, JSON, JSON5, JSONC, TEST, TS, VUE } from './extensions.js';
|
|
2
|
+
import { FileExtensionsSet } from './file-extensions-set.js';
|
|
3
|
+
import { toBlob, toDotted } from './helpers.js';
|
|
4
|
+
import ignores from './ignores.js';
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
CJS,
|
|
8
|
+
DTS,
|
|
9
|
+
FileExtensionsSet,
|
|
10
|
+
ignores,
|
|
11
|
+
JS,
|
|
12
|
+
JSON,
|
|
13
|
+
JSON5,
|
|
14
|
+
JSONC,
|
|
15
|
+
TEST,
|
|
16
|
+
toBlob,
|
|
17
|
+
toDotted,
|
|
18
|
+
TS,
|
|
19
|
+
VUE,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const scripts = toBlob(JS, TS, DTS);
|
|
23
|
+
export const scriptsAndVue = toBlob(JS, TS, DTS, VUE);
|
|
24
|
+
export const typescript = toBlob(TS, DTS);
|
|
25
|
+
export const typescriptAndVue = toBlob(TS, DTS, VUE);
|
|
26
|
+
export const js = JS.toBlobArray();
|
|
27
|
+
export const ts = TS.toBlobArray();
|
|
28
|
+
export const vue = VUE.toBlobArray();
|
|
29
|
+
export const json = JSON.toBlobArray();
|
|
30
|
+
export const jsonc = JSONC.toBlobArray();
|
|
31
|
+
export const json5 = JSON5.toBlobArray();
|
|
32
|
+
export const markdown = ['**/*.md'];
|
|
33
|
+
export const test = toBlob(TEST);
|
|
34
|
+
export const cjs = toBlob(CJS);
|