@fullstacksjs/eslint-config 14.5.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -60
- package/cjs/index.js +12 -2
- package/cjs/modules/base.js +6 -2
- package/cjs/modules/cypress.js +10 -3
- package/cjs/modules/ignore.js +1 -1
- package/cjs/modules/imports.js +6 -3
- package/cjs/modules/jest.js +6 -2
- package/cjs/modules/next.js +10 -3
- package/cjs/modules/node.js +7 -3
- package/cjs/modules/perfectionist.js +8 -3
- package/cjs/modules/playwright.js +10 -3
- package/cjs/modules/prettier.js +10 -9
- package/cjs/modules/promise.js +9 -2
- package/cjs/modules/react.js +51 -29
- package/cjs/modules/regex.js +11 -3
- package/cjs/modules/storybook.js +10 -3
- package/cjs/modules/stylistic.js +7 -3
- package/cjs/modules/tailwind.js +13 -4
- package/cjs/modules/tests.js +6 -2
- package/cjs/modules/typescript.js +7 -13
- package/cjs/modules/vitest.js +7 -3
- package/cjs/{index.d.ts → types/index.d.ts} +50 -52
- package/cjs/types/modules/import.d.ts +7 -0
- package/cjs/types/modules/react.d.ts +10 -0
- package/cjs/types/modules/regex.d.ts +5 -0
- package/cjs/types/modules/tailwind.d.ts +13 -0
- package/cjs/types/modules/typescript.d.ts +38 -0
- package/cjs/utils/nextAllowExportNames.js +7 -0
- package/cjs/utils/objectOrEmpty.js +14 -0
- package/package.json +15 -14
- package/src/index.mjs +12 -2
- package/src/modules/base.mjs +8 -2
- package/src/modules/cypress.mjs +12 -3
- package/src/modules/ignore.mjs +1 -1
- package/src/modules/imports.mjs +6 -3
- package/src/modules/jest.mjs +7 -2
- package/src/modules/next.mjs +13 -3
- package/src/modules/node.mjs +9 -3
- package/src/modules/perfectionist.mjs +11 -3
- package/src/modules/playwright.mjs +12 -3
- package/src/modules/prettier.mjs +13 -9
- package/src/modules/promise.mjs +11 -2
- package/src/modules/react.mjs +55 -28
- package/src/modules/regex.mjs +14 -3
- package/src/modules/storybook.mjs +12 -3
- package/src/modules/stylistic.mjs +9 -3
- package/src/modules/tailwind.mjs +17 -5
- package/src/modules/tests.mjs +8 -2
- package/src/modules/typescript.mjs +7 -9
- package/src/modules/vitest.mjs +9 -3
- package/src/{index.d.ts → types/index.d.ts} +50 -52
- package/src/types/modules/import.d.ts +7 -0
- package/src/types/modules/react.d.ts +10 -0
- package/src/types/modules/regex.d.ts +5 -0
- package/src/types/modules/tailwind.d.ts +13 -0
- package/src/types/modules/typescript.d.ts +38 -0
- package/src/utils/nextAllowExportNames.mjs +17 -0
- package/src/utils/objectOrEmpty.mjs +8 -0
package/README.md
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
7
|
-
![download status][download-badge]
|
|
8
|
-
![version][version-badge]
|
|
9
|
-
![MIT License][license-badge]
|
|
7
|
+
![download status][download-badge] ![version][version-badge] ![MIT License][license-badge]
|
|
10
8
|
|
|
11
9
|
</div>
|
|
12
10
|
|
|
@@ -16,11 +14,12 @@
|
|
|
16
14
|
npm install --save-dev @fullstacksjs/eslint-config eslint prettier
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
⚡️ That's it, you don't need to install any eslint-plugin!
|
|
17
|
+
⚡️ That's it, you don't need to install any eslint-plugin! If you already have some plugins installed, please remove them.
|
|
20
18
|
|
|
21
19
|
## Usage
|
|
22
20
|
|
|
23
|
-
To use the configuration, all you need is to export the generated config by the `defineConfig` function. It automatically enables required
|
|
21
|
+
To use the configuration, all you need is to export the generated config by the `defineConfig` function. It automatically enables required
|
|
22
|
+
plugins with **Auto Module Detection**.
|
|
24
23
|
|
|
25
24
|
### ESM
|
|
26
25
|
|
|
@@ -30,7 +29,7 @@ import { defineConfig } from '@fullstacksjs/eslint-config';
|
|
|
30
29
|
export default defineConfig({
|
|
31
30
|
typescript: {
|
|
32
31
|
tsconfigRootDir: import.meta.dirname, // Recommended when using TypeScript
|
|
33
|
-
}
|
|
32
|
+
},
|
|
34
33
|
});
|
|
35
34
|
```
|
|
36
35
|
|
|
@@ -42,44 +41,66 @@ const { defineConfig } = require('@fullstacksjs/eslint-config');
|
|
|
42
41
|
module.exports = defineConfig({
|
|
43
42
|
typescript: {
|
|
44
43
|
tsconfigRootDir: __dirname, // Recommended when using TypeScript
|
|
45
|
-
}
|
|
44
|
+
},
|
|
46
45
|
});
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
## How Module Detection Works
|
|
50
49
|
|
|
51
|
-
Automatic module detection enables ESLint plugins based on the dependencies listed in your `package.json`. It scans your project to identify
|
|
50
|
+
Automatic module detection enables ESLint plugins based on the dependencies listed in your `package.json`. It scans your project to identify
|
|
51
|
+
which tools you're using, and then activates the corresponding ESLint plugins accordingly.
|
|
52
52
|
|
|
53
|
-
For example, if your `package.json` includes `vitest` as a dependency, the configuration will automatically enable `eslint-plugin-vitest`
|
|
53
|
+
For example, if your `package.json` includes `vitest` as a dependency, the configuration will automatically enable `eslint-plugin-vitest`
|
|
54
|
+
for you. (You don't need to install the plugin itself)
|
|
54
55
|
|
|
55
56
|
### Modules API
|
|
56
57
|
|
|
57
|
-
You can fine-tune module detection by overriding it, the `defineConfig` function accepts options as its first argument to control enabled
|
|
58
|
+
You can fine-tune module detection by overriding it, the `defineConfig` function accepts options as its first argument to control enabled
|
|
59
|
+
modules.
|
|
58
60
|
|
|
59
61
|
```typescript
|
|
60
62
|
interface Options {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
base?: boolean | ConfigWithOverrides; // controls base
|
|
64
|
+
promise?: boolean | ConfigWithOverrides; // controls promise
|
|
65
|
+
stylistic?: boolean | ConfigWithOverrides; // controls stylistic
|
|
66
|
+
react?: boolean | ReactOptions; // controls react, react-hooks, jsx/a11y plugins
|
|
67
|
+
typescript?: boolean | TypeScriptOptions; // https://typescript-eslint.io/packages/parser#configuration
|
|
68
|
+
node?: boolean | ConfigWithOverrides; // controls node plugin
|
|
69
|
+
sort?: boolean | ConfigWithOverrides; // controls perfectionist plugin
|
|
65
70
|
strict?: boolean; // controls strict rules
|
|
66
|
-
import?:
|
|
71
|
+
import?: boolean | ImportOptions; // controls import plugin
|
|
67
72
|
esm?: boolean; // controls esm plugin
|
|
68
|
-
test?: boolean; // controls test formatting plugin
|
|
69
|
-
jest?: boolean; // controls jest plugin
|
|
70
|
-
vitest?: boolean; // controls vitest plugin
|
|
71
|
-
cypress?: boolean; // controls cypress plugin
|
|
72
|
-
playwright?: boolean // controls playwright plugin
|
|
73
|
-
storybook?: boolean; // controls storybook plugin
|
|
74
|
-
tailwind?: false |
|
|
75
|
-
next?: boolean; // controls next plugin
|
|
76
|
-
prettier?: boolean; // controls prettier plugin
|
|
73
|
+
test?: boolean | ConfigWithOverrides; // controls test formatting plugin
|
|
74
|
+
jest?: boolean | ConfigWithOverrides; // controls jest plugin
|
|
75
|
+
vitest?: boolean | ConfigWithOverrides; // controls vitest plugin
|
|
76
|
+
cypress?: boolean | ConfigWithOverrides; // controls cypress plugin
|
|
77
|
+
playwright?: boolean | ConfigWithOverrides; // controls playwright plugin
|
|
78
|
+
storybook?: boolean | ConfigWithOverrides; // controls storybook plugin
|
|
79
|
+
tailwind?: false | TailwindOptions; // controls tailwindcss plugin
|
|
80
|
+
next?: boolean | ConfigWithOverrides; // controls next plugin
|
|
81
|
+
prettier?: boolean | ConfigWithOverrides; // controls prettier plugin
|
|
77
82
|
disableExpensiveRules?: boolean; // controls expensive rules
|
|
78
83
|
gitignore?: false | string; // automatically ignore paths from .gitignore
|
|
79
|
-
regex?: boolean |
|
|
84
|
+
regex?: boolean | RegexOptions; // controls regexp plugin
|
|
80
85
|
}
|
|
81
86
|
```
|
|
82
87
|
|
|
88
|
+
## Config Overrides
|
|
89
|
+
|
|
90
|
+
You can customize any generated ESLint configuration per module.
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
defineConfig({
|
|
94
|
+
stylistic: {
|
|
95
|
+
overrides: {
|
|
96
|
+
rules: {
|
|
97
|
+
'@stylistic/semi': ['error', 'always'],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
83
104
|
## What if I want to add my one rules
|
|
84
105
|
|
|
85
106
|
You can pass any number of arbitrary custom config overrides to `defineConfig` function:
|
|
@@ -92,30 +113,35 @@ export default defineConfig(
|
|
|
92
113
|
typescript: true,
|
|
93
114
|
// You can pass extends here
|
|
94
115
|
rules: {
|
|
95
|
-
'no-console': 'error'
|
|
96
|
-
}
|
|
116
|
+
'no-console': 'error',
|
|
117
|
+
},
|
|
97
118
|
},
|
|
98
119
|
// And any number of extra configurations
|
|
99
120
|
{
|
|
100
121
|
files: ['**/*.ts'],
|
|
101
122
|
rules: {},
|
|
102
|
-
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
103
125
|
rules: {},
|
|
104
|
-
}
|
|
126
|
+
},
|
|
127
|
+
);
|
|
105
128
|
```
|
|
106
129
|
|
|
107
130
|
## What If I Want to Use a Plugin That Isn't Supported?
|
|
108
131
|
|
|
109
|
-
You can still use any ESLint plugin, even if it's not supported by automatic detection. Simply install the plugin manually and add it to the
|
|
132
|
+
You can still use any ESLint plugin, even if it's not supported by automatic detection. Simply install the plugin manually and add it to the
|
|
133
|
+
`defineConfig`. There are no limitations.
|
|
110
134
|
|
|
111
135
|
```js
|
|
112
136
|
import { defineConfig } from '@fullstacksjs/eslint-config';
|
|
113
137
|
import pluginVue from 'eslint-plugin-vue';
|
|
114
138
|
|
|
115
139
|
export default defineConfig(
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
140
|
+
{
|
|
141
|
+
/* Options */
|
|
142
|
+
},
|
|
143
|
+
...pluginVue.configs['flat/recommended'],
|
|
144
|
+
);
|
|
119
145
|
```
|
|
120
146
|
|
|
121
147
|
## Tailwind
|
|
@@ -123,38 +149,43 @@ export default defineConfig(
|
|
|
123
149
|
To enable Tailwind CSS in your project, specify the path to your CSS file in the module configuration:
|
|
124
150
|
|
|
125
151
|
Tailwind 4:
|
|
152
|
+
|
|
126
153
|
```typescript
|
|
127
154
|
export default defineConfig({
|
|
128
155
|
tailwind: { entryPoint: './src/global.css' },
|
|
129
|
-
})
|
|
156
|
+
});
|
|
130
157
|
```
|
|
131
158
|
|
|
132
159
|
Tailwind 3:
|
|
160
|
+
|
|
133
161
|
```typescript
|
|
134
162
|
export default defineConfig({
|
|
135
163
|
tailwind: { tailwindConfig: './tailwind.config.js' },
|
|
136
|
-
})
|
|
164
|
+
});
|
|
137
165
|
```
|
|
138
166
|
|
|
139
167
|
## GitIgnore
|
|
140
168
|
|
|
141
|
-
By default, FullstacksJS checks for a `.gitignore` file at the root of the project. If the file exists, it will be used automatically. You
|
|
169
|
+
By default, FullstacksJS checks for a `.gitignore` file at the root of the project. If the file exists, it will be used automatically. You
|
|
170
|
+
can override this behavior by updating the configuration.
|
|
142
171
|
|
|
143
172
|
```typescript
|
|
144
173
|
export default defineConfig({
|
|
145
174
|
gitignore: './packages/acme/.gitignore', // use `false` to disable
|
|
146
|
-
})
|
|
175
|
+
});
|
|
147
176
|
```
|
|
148
177
|
|
|
149
178
|
## I'm Getting a Next.js Warning: Plugin Was Not Detected
|
|
150
179
|
|
|
151
|
-
This configuration includes built-in support for [Next.js](https://nextjs.org). The warning you're seeing from Next.js is misleading—it
|
|
180
|
+
This configuration includes built-in support for [Next.js](https://nextjs.org). The warning you're seeing from Next.js is misleading—it
|
|
181
|
+
simply checks whether the plugin is explicitly listed in your package.json.
|
|
152
182
|
|
|
153
183
|
You can safely ignore this warning. Alternatively, you can update your lint script from next lint to eslint to avoid it entirely.
|
|
154
184
|
|
|
155
185
|
## Speed Optimization!
|
|
156
186
|
|
|
157
|
-
Balancing the benefits of linting rules against their performance impact is crucial. Below is a table highlighting the most
|
|
187
|
+
Balancing the benefits of linting rules against their performance impact is crucial. Below is a table highlighting the most
|
|
188
|
+
resource-intensive linting rules encountered in a real-world React project:
|
|
158
189
|
|
|
159
190
|
| Rule | Time (ms) | Relative |
|
|
160
191
|
| -------------------------------------- | --------- | -------- |
|
|
@@ -163,7 +194,10 @@ Balancing the benefits of linting rules against their performance impact is cruc
|
|
|
163
194
|
| import/no-cycle | 1177.111 | 6.8% |
|
|
164
195
|
| import/namespace | 1148.731 | 6.7% |
|
|
165
196
|
|
|
166
|
-
As illustrated, certain rules significantly increase linting time, potentially hindering the developer experience by slowing down the
|
|
197
|
+
As illustrated, certain rules significantly increase linting time, potentially hindering the developer experience by slowing down the
|
|
198
|
+
feedback loop. To mitigate this, you may consider disabling these resource-intensive rules in the development environment. However, they can
|
|
199
|
+
remain active in environments where performance is less critical, such as Continuous Integration (CI) systems or during pre-commit checks
|
|
200
|
+
(git hooks).
|
|
167
201
|
|
|
168
202
|
To conditionally disable expensive linting rules, you can modify your configuration as follows:
|
|
169
203
|
|
|
@@ -184,7 +218,7 @@ import/no-deprecated
|
|
|
184
218
|
```js
|
|
185
219
|
export default defineConfig({
|
|
186
220
|
disableExpensiveRules: !process.env.CI || !process.env.HUSKY, // Or anywhere you want
|
|
187
|
-
prettier: false // So you should run the formatter explicitly.
|
|
221
|
+
prettier: false, // So you should run the formatter explicitly.
|
|
188
222
|
});
|
|
189
223
|
```
|
|
190
224
|
|
|
@@ -194,25 +228,26 @@ export default defineConfig({
|
|
|
194
228
|
|
|
195
229
|
## What's included?
|
|
196
230
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
- [@eslint-react/eslint-plugin](https://eslint-react.xyz)
|
|
232
|
+
- [@next/eslint-plugin-next](https://nextjs.org/docs/basic-features/eslint#eslint-plugin)
|
|
233
|
+
- [@stylistic/eslint-plugin](https://eslint.style/packages/default)
|
|
234
|
+
- [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest)
|
|
235
|
+
- [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress)
|
|
236
|
+
- [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
|
|
237
|
+
- [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
|
|
238
|
+
- [eslint-plugin-jest-formatting](https://github.com/dangreenisrael/eslint-plugin-jest-formatting)
|
|
239
|
+
- [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
|
|
240
|
+
- [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)
|
|
241
|
+
- [eslint-plugin-perfectionist](https://perfectionist.dev)
|
|
242
|
+
- [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright)
|
|
243
|
+
- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
|
|
244
|
+
- [eslint-plugin-promise](https://github.com/eslint-community/eslint-plugin-promise)
|
|
245
|
+
- [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook#readme)
|
|
246
|
+
- [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss)
|
|
247
|
+
- [typescript-eslint](https://typescript-eslint.io)
|
|
248
|
+
- [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
|
|
249
|
+
- [eslint-flat-config-utils](https://www.npmjs.com/package/eslint-flat-config-utils)
|
|
250
|
+
- [eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh)
|
|
216
251
|
|
|
217
252
|
That's all. Feel free to use 💛
|
|
218
253
|
|
package/cjs/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var _node = _interopRequireDefault(require("./modules/node.js"));
|
|
|
17
17
|
var _perfectionist = _interopRequireDefault(require("./modules/perfectionist.js"));
|
|
18
18
|
var _playwright = _interopRequireDefault(require("./modules/playwright.js"));
|
|
19
19
|
var _prettier = _interopRequireDefault(require("./modules/prettier.js"));
|
|
20
|
+
var _promise = _interopRequireDefault(require("./modules/promise.js"));
|
|
20
21
|
var _react = _interopRequireDefault(require("./modules/react.js"));
|
|
21
22
|
var _regex = _interopRequireDefault(require("./modules/regex.js"));
|
|
22
23
|
var _storybook = _interopRequireDefault(require("./modules/storybook.js"));
|
|
@@ -30,11 +31,14 @@ const testPackages = ['jest', 'vitest', 'cypress', '@playwright/test'];
|
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @typedef {import('eslint').Linter.Config} Config
|
|
33
|
-
* @typedef {import('./
|
|
34
|
+
* @typedef {import('./types').Options} Options
|
|
34
35
|
* /
|
|
35
36
|
|
|
36
37
|
/** @type {Options} */
|
|
37
38
|
const defaultOptions = {
|
|
39
|
+
base: true,
|
|
40
|
+
promise: true,
|
|
41
|
+
stylistic: true,
|
|
38
42
|
cypress: (0, _localPkg.isPackageExists)('cypress'),
|
|
39
43
|
disableExpensiveRules: false,
|
|
40
44
|
esm: false,
|
|
@@ -83,6 +87,9 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
83
87
|
};
|
|
84
88
|
}
|
|
85
89
|
const {
|
|
90
|
+
base: enableBase,
|
|
91
|
+
promise: enablePromise,
|
|
92
|
+
stylistic: enableStylistic,
|
|
86
93
|
sort: enableSort,
|
|
87
94
|
cypress: enableCypress,
|
|
88
95
|
disableExpensiveRules,
|
|
@@ -105,7 +112,10 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
105
112
|
regex: enableRegex,
|
|
106
113
|
...eslintOptions
|
|
107
114
|
} = options;
|
|
108
|
-
const rules = [(0, _ignore.default)(options)
|
|
115
|
+
const rules = [(0, _ignore.default)(options)];
|
|
116
|
+
if (enableBase) rules.push((0, _base.default)(options));
|
|
117
|
+
if (enablePromise) rules.push((0, _promise.default)(options));
|
|
118
|
+
if (enableStylistic) rules.push((0, _stylistic.default)(options));
|
|
109
119
|
if (enableSort) rules.push((0, _perfectionist.default)(options));
|
|
110
120
|
if (enableImport) rules.push((0, _imports.default)(options));
|
|
111
121
|
if (enableTailwind) rules.push((0, _tailwind.default)(options));
|
package/cjs/modules/base.js
CHANGED
|
@@ -4,15 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _globals = _interopRequireDefault(require("globals"));
|
|
8
9
|
var _conditions = require("../utils/conditions.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
/**
|
|
11
|
-
* @param { import('../
|
|
13
|
+
* @param { import('../types').Options } options
|
|
12
14
|
* @return { import('eslint').Linter.Config }
|
|
13
15
|
*/
|
|
14
16
|
function base(options = {}) {
|
|
15
|
-
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.base.overrides);
|
|
18
|
+
const baseConfig = {
|
|
16
19
|
name: 'base',
|
|
17
20
|
languageOptions: {
|
|
18
21
|
ecmaVersion: 'latest',
|
|
@@ -225,5 +228,6 @@ function base(options = {}) {
|
|
|
225
228
|
'no-console': (0, _conditions.strict)(options, 'warn')
|
|
226
229
|
}
|
|
227
230
|
};
|
|
231
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(baseConfig, overrides);
|
|
228
232
|
}
|
|
229
233
|
module.exports = base;
|
package/cjs/modules/cypress.js
CHANGED
|
@@ -4,12 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginCypress = _interopRequireDefault(require("eslint-plugin-cypress"));
|
|
8
9
|
var _globs = require("../utils/globs.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param { import('../types').Options } options
|
|
14
|
+
* @return { import('eslint').Linter.Config }
|
|
15
|
+
*/
|
|
16
|
+
function cypress(options = {}) {
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.cypress.overrides);
|
|
18
|
+
const cypressConfig = {
|
|
13
19
|
name: 'cypress',
|
|
14
20
|
files: _globs.globs.e2e,
|
|
15
21
|
plugins: {
|
|
@@ -28,5 +34,6 @@ function cypress() {
|
|
|
28
34
|
'@typescript-eslint/no-namespace': 'off'
|
|
29
35
|
}
|
|
30
36
|
};
|
|
37
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(cypressConfig, overrides);
|
|
31
38
|
}
|
|
32
39
|
module.exports = cypress;
|
package/cjs/modules/ignore.js
CHANGED
|
@@ -8,7 +8,7 @@ var _config = require("eslint/config");
|
|
|
8
8
|
var _getGitignorePatterns = require("../utils/getGitignorePatterns.js");
|
|
9
9
|
var _globs = require("../utils/globs.js");
|
|
10
10
|
/**
|
|
11
|
-
* @param { import('../
|
|
11
|
+
* @param { import('../types').Options } options
|
|
12
12
|
* @return { import('eslint').Linter.Config }
|
|
13
13
|
*/
|
|
14
14
|
function ignores(options = {}) {
|
package/cjs/modules/imports.js
CHANGED
|
@@ -4,20 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginImportX = _interopRequireDefault(require("eslint-plugin-import-x"));
|
|
8
9
|
var _conditions = require("../utils/conditions.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
const tsExtensions = ['.ts', '.tsx', '.cts', '.mts', '.ctsx', '.mtsx'];
|
|
11
13
|
const jsExtensions = ['.mjs', '.js', '.jsx', '.cjs'];
|
|
12
14
|
const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
|
-
* @param { import('../
|
|
17
|
+
* @param { import('../types').Options } options
|
|
16
18
|
* @return { import('eslint').Linter.Config }
|
|
17
19
|
*/
|
|
18
20
|
function imports(options = {}) {
|
|
19
21
|
const isObject = typeof options.import === 'object';
|
|
20
|
-
const
|
|
22
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.import.overrides);
|
|
23
|
+
const importsConfig = {
|
|
21
24
|
name: 'imports',
|
|
22
25
|
plugins: {
|
|
23
26
|
import: _eslintPluginImportX.default
|
|
@@ -116,6 +119,6 @@ function imports(options = {}) {
|
|
|
116
119
|
})
|
|
117
120
|
}
|
|
118
121
|
};
|
|
119
|
-
return
|
|
122
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(importsConfig, overrides);
|
|
120
123
|
}
|
|
121
124
|
module.exports = imports;
|
package/cjs/modules/jest.js
CHANGED
|
@@ -4,17 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginJest = _interopRequireDefault(require("eslint-plugin-jest"));
|
|
8
9
|
var _globals = _interopRequireDefault(require("globals"));
|
|
9
10
|
var _conditions = require("../utils/conditions.js");
|
|
10
11
|
var _globs = require("../utils/globs.js");
|
|
12
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
/**
|
|
13
|
-
* @param { import('../
|
|
15
|
+
* @param { import('../types').Options } options
|
|
14
16
|
* @return { import('eslint').Linter.Config } */
|
|
15
17
|
function jest(options = {}) {
|
|
16
18
|
const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
|
|
17
|
-
|
|
19
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.jest.overrides);
|
|
20
|
+
const jestConfig = {
|
|
18
21
|
name: 'jest',
|
|
19
22
|
files: _globs.globs.test,
|
|
20
23
|
plugins: {
|
|
@@ -94,5 +97,6 @@ function jest(options = {}) {
|
|
|
94
97
|
// }),
|
|
95
98
|
}
|
|
96
99
|
};
|
|
100
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(jestConfig, overrides);
|
|
97
101
|
}
|
|
98
102
|
module.exports = jest;
|
package/cjs/modules/next.js
CHANGED
|
@@ -5,10 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _eslintPluginNext = _interopRequireDefault(require("@next/eslint-plugin-next"));
|
|
8
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
9
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @param { import('../types').Options } options
|
|
13
|
+
* @return { import('eslint').Linter.Config }
|
|
14
|
+
*/
|
|
15
|
+
function next(options = {}) {
|
|
16
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.next.overrides);
|
|
17
|
+
const nextConfig = {
|
|
12
18
|
name: 'next',
|
|
13
19
|
plugins: {
|
|
14
20
|
next: _eslintPluginNext.default
|
|
@@ -37,5 +43,6 @@ function next() {
|
|
|
37
43
|
'next/no-unwanted-polyfillio': 'warn'
|
|
38
44
|
}
|
|
39
45
|
};
|
|
46
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(nextConfig, overrides);
|
|
40
47
|
}
|
|
41
48
|
module.exports = next;
|
package/cjs/modules/node.js
CHANGED
|
@@ -4,15 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginN = _interopRequireDefault(require("eslint-plugin-n"));
|
|
8
9
|
var _conditions = require("../utils/conditions.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
/**
|
|
11
|
-
* @param { import('../
|
|
13
|
+
* @param { import('../types').Options } options
|
|
12
14
|
* @return { import('eslint').Linter.Config }
|
|
13
15
|
*/
|
|
14
16
|
function node(options = {}) {
|
|
15
|
-
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.node.overrides);
|
|
18
|
+
const nodeConfig = {
|
|
16
19
|
name: 'node',
|
|
17
20
|
plugins: {
|
|
18
21
|
n: _eslintPluginN.default
|
|
@@ -39,7 +42,7 @@ function node(options = {}) {
|
|
|
39
42
|
'n/no-sync': (0, _conditions.strict)(options, 'warn'),
|
|
40
43
|
'n/no-top-level-await': 'off',
|
|
41
44
|
'n/no-unpublished-bin': 'warn',
|
|
42
|
-
'n/no-unpublished-import': '
|
|
45
|
+
'n/no-unpublished-import': 'off',
|
|
43
46
|
'n/no-unpublished-require': 'warn',
|
|
44
47
|
'n/no-unsupported-features/es-builtins': 'off',
|
|
45
48
|
// Nice but not a general rule
|
|
@@ -68,5 +71,6 @@ function node(options = {}) {
|
|
|
68
71
|
'n/no-missing-require': 'off'
|
|
69
72
|
}
|
|
70
73
|
};
|
|
74
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(nodeConfig, overrides);
|
|
71
75
|
}
|
|
72
76
|
module.exports = node;
|
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginPerfectionist = _interopRequireDefault(require("eslint-plugin-perfectionist"));
|
|
9
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
11
|
/**
|
|
10
|
-
* @
|
|
12
|
+
* @param { import('../types').Options } options
|
|
13
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
11
14
|
*/
|
|
12
|
-
function perfectionist() {
|
|
13
|
-
|
|
15
|
+
function perfectionist(options = {}) {
|
|
16
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.sort.overrides);
|
|
17
|
+
const perfectionistConfig = {
|
|
14
18
|
name: 'perfectionist',
|
|
15
19
|
plugins: {
|
|
16
20
|
perfectionist: _eslintPluginPerfectionist.default
|
|
@@ -45,5 +49,6 @@ function perfectionist() {
|
|
|
45
49
|
'perfectionist/sort-variable-declarations': 'warn'
|
|
46
50
|
}
|
|
47
51
|
};
|
|
52
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(perfectionistConfig, overrides);
|
|
48
53
|
}
|
|
49
54
|
module.exports = perfectionist;
|
|
@@ -4,12 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginPlaywright = _interopRequireDefault(require("eslint-plugin-playwright"));
|
|
8
9
|
var _globs = require("../utils/globs.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param { import('../types').Options } options
|
|
14
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
15
|
+
*/
|
|
16
|
+
function playwright(options = {}) {
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.playwright.overrides);
|
|
18
|
+
const playwrightConfig = {
|
|
13
19
|
name: 'playwright',
|
|
14
20
|
plugins: {
|
|
15
21
|
playwright: _eslintPluginPlaywright.default
|
|
@@ -78,5 +84,6 @@ function playwright() {
|
|
|
78
84
|
'playwright/valid-title': 'warn'
|
|
79
85
|
}
|
|
80
86
|
};
|
|
87
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(playwrightConfig, overrides);
|
|
81
88
|
}
|
|
82
89
|
module.exports = playwright;
|
package/cjs/modules/prettier.js
CHANGED
|
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginPrettier = _interopRequireDefault(require("eslint-plugin-prettier"));
|
|
9
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @param { import('../types').Options } options
|
|
13
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
14
|
+
*/
|
|
15
|
+
function prettier(options = {}) {
|
|
16
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.prettier.overrides);
|
|
17
|
+
const prettierConfig = {
|
|
12
18
|
name: 'prettier',
|
|
13
19
|
plugins: {
|
|
14
20
|
prettier: _eslintPluginPrettier.default
|
|
@@ -16,23 +22,19 @@ function prettier() {
|
|
|
16
22
|
rules: {
|
|
17
23
|
'prettier/prettier': 'error',
|
|
18
24
|
'curly': 'off',
|
|
19
|
-
'brace-style': 'off',
|
|
20
25
|
'no-unexpected-multiline': 'off',
|
|
21
26
|
'@typescript-eslint/lines-around-comment': 'off',
|
|
22
27
|
'@typescript-eslint/quotes': 'off',
|
|
23
28
|
'@typescript-eslint/block-spacing': 'off',
|
|
24
|
-
'@typescript-eslint/brace-style': 'off',
|
|
25
29
|
'@typescript-eslint/comma-dangle': 'off',
|
|
26
30
|
'@typescript-eslint/comma-spacing': 'off',
|
|
27
31
|
'@typescript-eslint/func-call-spacing': 'off',
|
|
28
32
|
'@typescript-eslint/indent': 'off',
|
|
29
|
-
'@typescript-eslint/key-spacing': 'off',
|
|
30
33
|
'@typescript-eslint/keyword-spacing': 'off',
|
|
31
34
|
'@typescript-eslint/member-delimiter-style': 'off',
|
|
32
35
|
'@typescript-eslint/no-extra-parens': 'off',
|
|
33
36
|
'@typescript-eslint/no-extra-semi': 'off',
|
|
34
37
|
'@typescript-eslint/semi': 'off',
|
|
35
|
-
'@typescript-eslint/space-before-blocks': 'off',
|
|
36
38
|
'@typescript-eslint/space-before-function-paren': 'off',
|
|
37
39
|
'@typescript-eslint/space-infix-ops': 'off',
|
|
38
40
|
'@typescript-eslint/type-annotation-spacing': 'off',
|
|
@@ -43,12 +45,10 @@ function prettier() {
|
|
|
43
45
|
'@stylistic/jsx-curly-spacing': 'off',
|
|
44
46
|
'@stylistic/jsx-equals-spacing': 'off',
|
|
45
47
|
'@stylistic/jsx-first-prop-new-line': 'off',
|
|
46
|
-
'@stylistic/jsx-indent': 'off',
|
|
47
48
|
'@stylistic/jsx-indent-props': 'off',
|
|
48
49
|
'@stylistic/jsx-max-props-per-line': 'off',
|
|
49
50
|
'@stylistic/jsx-newline': 'off',
|
|
50
51
|
'@stylistic/jsx-one-expression-per-line': 'off',
|
|
51
|
-
'@stylistic/jsx-props-no-multi-spaces': 'off',
|
|
52
52
|
'@stylistic/jsx-tag-spacing': 'off',
|
|
53
53
|
'@stylistic/jsx-wrap-multilines': 'off',
|
|
54
54
|
'vue/html-self-closing': 'off',
|
|
@@ -92,5 +92,6 @@ function prettier() {
|
|
|
92
92
|
'vue/template-curly-spacing': 'off'
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(prettierConfig, overrides);
|
|
95
96
|
}
|
|
96
97
|
module.exports = prettier;
|