@qstanay/eslint-config 1.0.0 → 1.0.1
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 +160 -25
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +92 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{nuxt-CehpYBa3.d.mts → nuxt-D-E7z44c.d.mts} +9 -2
- package/dist/{nuxt-CehpYBa3.d.mts.map → nuxt-D-E7z44c.d.mts.map} +1 -1
- package/dist/nuxt-HGf9trGQ.mjs +154 -0
- package/dist/nuxt-HGf9trGQ.mjs.map +1 -0
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +1 -1
- package/package.json +3 -3
- package/dist/nuxt-Cz6LtoZ_.mjs +0 -178
- package/dist/nuxt-Cz6LtoZ_.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# @qstanay/eslint-config
|
|
2
2
|
|
|
3
|
-
Opinionated ESLint **flat config** for
|
|
3
|
+
Opinionated ESLint **flat config** for Nuxt apps, Vue apps, and TypeScript packages.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- Vue applications
|
|
7
|
-
- TypeScript packages
|
|
5
|
+
Formatting is handled by ESLint via **@stylistic** (`eslint --fix`). Do **not** use Prettier alongside this preset unless you disable stylistic rules.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
## Quick pick
|
|
8
|
+
|
|
9
|
+
| Project type | Use this |
|
|
10
|
+
|---|---|
|
|
11
|
+
| **Nuxt** | `@qstanay/eslint-config/nuxt` with `@nuxt/eslint` + `withNuxt()` |
|
|
12
|
+
| **Vue (Vite / SPA)** | `defineConfig()` from `@qstanay/eslint-config` |
|
|
13
|
+
| **TypeScript package / library** | `defineConfig()` from `@qstanay/eslint-config` |
|
|
14
|
+
|
|
15
|
+
For Nuxt, prefer the `/nuxt` entry. It only adds opinionated rules + formatting on top of Nuxt's own TypeScript/Vue setup. It does **not** replace `@nuxt/eslint`.
|
|
10
16
|
|
|
11
17
|
## Requirements
|
|
12
18
|
|
|
13
|
-
- Node.js 18+
|
|
19
|
+
- Node.js 18+
|
|
14
20
|
- ESLint `^9 || ^10`
|
|
21
|
+
- Flat config only (`eslint.config.js` / `.mjs` / `.ts`)
|
|
15
22
|
|
|
16
23
|
## Install
|
|
17
24
|
|
|
@@ -19,13 +26,17 @@ This preset uses **@stylistic** for formatting through ESLint (single toolchain:
|
|
|
19
26
|
npm i -D eslint @qstanay/eslint-config
|
|
20
27
|
```
|
|
21
28
|
|
|
29
|
+
For Nuxt also install and enable the Nuxt ESLint module:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm i -D @nuxt/eslint
|
|
33
|
+
```
|
|
34
|
+
|
|
22
35
|
## Usage
|
|
23
36
|
|
|
24
37
|
### Nuxt (recommended)
|
|
25
38
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
1) Ensure Nuxt ESLint module is enabled in `nuxt.config.ts`:
|
|
39
|
+
1. Enable the module in `nuxt.config.ts`:
|
|
29
40
|
|
|
30
41
|
```ts
|
|
31
42
|
export default defineNuxtConfig({
|
|
@@ -33,7 +44,7 @@ export default defineNuxtConfig({
|
|
|
33
44
|
})
|
|
34
45
|
```
|
|
35
46
|
|
|
36
|
-
2
|
|
47
|
+
2. Create `eslint.config.mjs` in the project root:
|
|
37
48
|
|
|
38
49
|
```js
|
|
39
50
|
import withNuxt from './.nuxt/eslint.config.mjs'
|
|
@@ -51,6 +62,17 @@ export default withNuxt(
|
|
|
51
62
|
)
|
|
52
63
|
```
|
|
53
64
|
|
|
65
|
+
Run `nuxt prepare` (or start the dev server once) so `.nuxt/eslint.config.mjs` exists before linting.
|
|
66
|
+
|
|
67
|
+
Minimal form (defaults are fine for most projects):
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
import withNuxt from './.nuxt/eslint.config.mjs'
|
|
71
|
+
import { nuxt } from '@qstanay/eslint-config/nuxt'
|
|
72
|
+
|
|
73
|
+
export default withNuxt(...nuxt())
|
|
74
|
+
```
|
|
75
|
+
|
|
54
76
|
### Vue (Vite) app
|
|
55
77
|
|
|
56
78
|
Create `eslint.config.mjs`:
|
|
@@ -64,6 +86,14 @@ export default defineConfig({
|
|
|
64
86
|
})
|
|
65
87
|
```
|
|
66
88
|
|
|
89
|
+
If `vue` and `typescript` are already installed, auto-detection is enough:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
import { defineConfig } from '@qstanay/eslint-config'
|
|
93
|
+
|
|
94
|
+
export default defineConfig()
|
|
95
|
+
```
|
|
96
|
+
|
|
67
97
|
### TypeScript package
|
|
68
98
|
|
|
69
99
|
Create `eslint.config.mjs`:
|
|
@@ -72,17 +102,68 @@ Create `eslint.config.mjs`:
|
|
|
72
102
|
import { defineConfig } from '@qstanay/eslint-config'
|
|
73
103
|
|
|
74
104
|
export default defineConfig({
|
|
75
|
-
vue: false,
|
|
76
|
-
nuxt: false,
|
|
77
105
|
typescript: true,
|
|
78
106
|
})
|
|
79
107
|
```
|
|
80
108
|
|
|
109
|
+
Or rely on auto-detection when `typescript` is a dependency:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { defineConfig } from '@qstanay/eslint-config'
|
|
113
|
+
|
|
114
|
+
export default defineConfig()
|
|
115
|
+
```
|
|
116
|
+
|
|
81
117
|
## Options
|
|
82
118
|
|
|
119
|
+
### `defineConfig(options, ...userConfigs)`
|
|
120
|
+
|
|
121
|
+
Main entry for Vue / TypeScript projects.
|
|
122
|
+
|
|
123
|
+
| Option | Type | Default | Description |
|
|
124
|
+
|---|---|---|---|
|
|
125
|
+
| `vue` | `boolean` | auto (`vue` or `nuxt` installed) | Enable Vue rules |
|
|
126
|
+
| `typescript` | `boolean` | auto (`typescript` installed) | Enable TypeScript rules |
|
|
127
|
+
| `nuxt` | `boolean` | auto (`nuxt` installed) | Enable Nuxt plugin rule(s). Prefer `/nuxt` for Nuxt apps |
|
|
128
|
+
| `stylistic` | `false \| object` | enabled | Formatting rules (see below) |
|
|
129
|
+
| `overrides` | `Linter.RulesRecord` | `{}` | Custom rules merged last over shared rules |
|
|
130
|
+
| `ignores` | `string[]` | `[]` | Extra ignore globs |
|
|
131
|
+
|
|
132
|
+
Extra flat-config blocks can be passed as additional arguments:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
export default defineConfig(
|
|
136
|
+
{ typescript: true },
|
|
137
|
+
{
|
|
138
|
+
files: ['scripts/**/*.ts'],
|
|
139
|
+
rules: {
|
|
140
|
+
'no-console': 'off',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `nuxt(options)` — `@qstanay/eslint-config/nuxt`
|
|
147
|
+
|
|
148
|
+
Layer for Nuxt apps used with `withNuxt(...nuxt())`.
|
|
149
|
+
|
|
150
|
+
| Option | Type | Default | Description |
|
|
151
|
+
|---|---|---|---|
|
|
152
|
+
| `stylistic` | `false \| object` | enabled | Formatting rules (see below) |
|
|
153
|
+
| `overrides` | `Linter.RulesRecord` | `{}` | Custom rules merged last over shared rules |
|
|
154
|
+
|
|
155
|
+
There are no `vue` / `typescript` flags here — `@nuxt/eslint` already provides that stack. This preset adds shared opinionated rules, Vue opinionated rules, and stylistic formatting.
|
|
156
|
+
|
|
83
157
|
### `stylistic`
|
|
84
158
|
|
|
85
|
-
|
|
159
|
+
Enabled by default. Defaults:
|
|
160
|
+
|
|
161
|
+
| Key | Default |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `indent` | `2` |
|
|
164
|
+
| `quotes` | `'single'` |
|
|
165
|
+
| `semi` | `true` |
|
|
166
|
+
| `maxLen` | `100` |
|
|
86
167
|
|
|
87
168
|
```js
|
|
88
169
|
defineConfig({
|
|
@@ -95,33 +176,62 @@ defineConfig({
|
|
|
95
176
|
})
|
|
96
177
|
```
|
|
97
178
|
|
|
98
|
-
|
|
179
|
+
Disable formatting rules entirely:
|
|
99
180
|
|
|
100
|
-
|
|
181
|
+
```js
|
|
182
|
+
defineConfig({ stylistic: false })
|
|
183
|
+
// or for Nuxt:
|
|
184
|
+
nuxt({ stylistic: false })
|
|
185
|
+
```
|
|
101
186
|
|
|
102
|
-
|
|
187
|
+
### `overrides`
|
|
103
188
|
|
|
104
189
|
```js
|
|
105
190
|
defineConfig({
|
|
106
191
|
overrides: {
|
|
107
192
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
193
|
+
'no-console': 'off',
|
|
108
194
|
},
|
|
109
195
|
})
|
|
110
196
|
```
|
|
111
197
|
|
|
198
|
+
Same option works in `nuxt({ overrides: { ... } })`.
|
|
199
|
+
|
|
112
200
|
### `ignores`
|
|
113
201
|
|
|
114
|
-
|
|
202
|
+
Built-in ignores cover `node_modules`, `dist`, `.output`, `.nuxt`, `.nitro`, `coverage`, and the project `.gitignore` (when present).
|
|
115
203
|
|
|
116
204
|
```js
|
|
117
205
|
defineConfig({
|
|
118
|
-
ignores: ['**/
|
|
206
|
+
ignores: ['**/fixtures/**'],
|
|
119
207
|
})
|
|
120
208
|
```
|
|
121
209
|
|
|
210
|
+
`ignores` is only on `defineConfig`, not on the Nuxt preset (use Nuxt / ESLint ignore mechanisms there if needed).
|
|
211
|
+
|
|
212
|
+
## Prettier
|
|
213
|
+
|
|
214
|
+
**Do not use Prettier with this preset while `stylistic` is enabled.** Both tools format the same things (quotes, semicolons, indentation, line length) and will conflict.
|
|
215
|
+
|
|
216
|
+
Recommended setup:
|
|
217
|
+
|
|
218
|
+
- Keep `@stylistic` enabled
|
|
219
|
+
- Format with `eslint . --fix`
|
|
220
|
+
- Use ESLint as the editor formatter
|
|
221
|
+
|
|
222
|
+
If you must keep Prettier:
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
defineConfig({ stylistic: false })
|
|
226
|
+
// Nuxt:
|
|
227
|
+
nuxt({ stylistic: false })
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Then let Prettier own formatting and keep ESLint for logic/quality rules only.
|
|
231
|
+
|
|
122
232
|
## Scripts
|
|
123
233
|
|
|
124
|
-
|
|
234
|
+
Add to `package.json`:
|
|
125
235
|
|
|
126
236
|
```json
|
|
127
237
|
{
|
|
@@ -132,9 +242,9 @@ Suggested `package.json` scripts:
|
|
|
132
242
|
}
|
|
133
243
|
```
|
|
134
244
|
|
|
135
|
-
## VS Code
|
|
245
|
+
## VS Code / Cursor
|
|
136
246
|
|
|
137
|
-
Use ESLint as the formatter and
|
|
247
|
+
Use ESLint as the formatter and fix on save.
|
|
138
248
|
|
|
139
249
|
`.vscode/settings.json`:
|
|
140
250
|
|
|
@@ -144,12 +254,37 @@ Use ESLint as the formatter and apply fixes on save.
|
|
|
144
254
|
"editor.formatOnSave": true,
|
|
145
255
|
"editor.codeActionsOnSave": {
|
|
146
256
|
"source.fixAll.eslint": "explicit"
|
|
147
|
-
}
|
|
257
|
+
},
|
|
258
|
+
"eslint.useFlatConfig": true
|
|
148
259
|
}
|
|
149
260
|
```
|
|
150
261
|
|
|
151
|
-
|
|
262
|
+
Disable Prettier for the same file types (or uninstall / disable the Prettier extension in the project) to avoid fights on save.
|
|
263
|
+
|
|
264
|
+
## What this preset enforces (high level)
|
|
265
|
+
|
|
266
|
+
- Shared JS rules always; TypeScript opinionated rules only when TypeScript is enabled (so JS-only projects stay valid)
|
|
267
|
+
- Official `eslint-plugin-vue` `flat/recommended` when Vue is enabled, plus a small opinionated Vue layer (self-closing tags, attribute order, padding between tags)
|
|
268
|
+
- Stylistic formatting via `@stylistic` (rule namespace: `style/*`)
|
|
269
|
+
- Import hygiene via `eslint-plugin-import-x` in `defineConfig` (Nuxt relies on `@nuxt/eslint` for its own import/TS/Vue stack)
|
|
270
|
+
- `overrides` are applied in a trailing config block so they win over shared/Vue rules
|
|
152
271
|
|
|
153
|
-
|
|
154
|
-
|
|
272
|
+
## Agent / setup checklist
|
|
273
|
+
|
|
274
|
+
When adding this package to a project:
|
|
275
|
+
|
|
276
|
+
1. Install `eslint` + `@qstanay/eslint-config` as devDependencies.
|
|
277
|
+
2. Choose the correct entry:
|
|
278
|
+
- Nuxt → `@qstanay/eslint-config/nuxt` + `@nuxt/eslint` + `withNuxt(...nuxt())`
|
|
279
|
+
- Vue / TS → `defineConfig(...)`
|
|
280
|
+
3. Create root `eslint.config.mjs` (or `.ts` if the project already supports it).
|
|
281
|
+
4. Add `lint` / `lint:fix` scripts.
|
|
282
|
+
5. Do **not** add Prettier for JS/TS/Vue unless `stylistic: false`.
|
|
283
|
+
6. For Nuxt, ensure `@nuxt/eslint` is in `modules` and `.nuxt/eslint.config.mjs` exists (`nuxt prepare`).
|
|
284
|
+
7. Prefer `overrides` for project-specific exceptions instead of forking the preset.
|
|
285
|
+
|
|
286
|
+
## Notes
|
|
155
287
|
|
|
288
|
+
- Flat config only. Legacy `.eslintrc*` is not supported.
|
|
289
|
+
- Scope is Nuxt / Vue / TypeScript JS-like sources. JSON, YAML, Markdown, and CSS formatting are out of scope for now.
|
|
290
|
+
- License: MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StylisticOptions, i as OptionsConfig, n as nuxt, o as TypedFlatConfigItem, r as Awaitable } from "./nuxt-
|
|
1
|
+
import { a as StylisticOptions, i as OptionsConfig, n as nuxt, o as TypedFlatConfigItem, r as Awaitable } from "./nuxt-D-E7z44c.mjs";
|
|
2
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
declare function defineConfig(options?: OptionsConfig, ...userConfigs: (Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>)[]): FlatConfigComposer<TypedFlatConfigItem, never>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as SOURCE_FILES, c as has, i as sharedRules, l as resolveEnabled, n as vueRules, o as TYPESCRIPT_FILES, r as stylistic, s as VUE_FILES, t as nuxt, u as resolveStylisticOptions } from "./nuxt-HGf9trGQ.mjs";
|
|
2
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
-
import
|
|
4
|
-
//#region src/utils.ts
|
|
5
|
-
function resolveEnabled(explicit, detected) {
|
|
6
|
-
return explicit ?? detected;
|
|
7
|
-
}
|
|
8
|
-
function has(pkg) {
|
|
9
|
-
return isPackageExists(pkg);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
3
|
+
import gitignore from "eslint-config-flat-gitignore";
|
|
12
4
|
//#region src/configs/ignores.ts
|
|
13
5
|
function ignores(extraIgnores = []) {
|
|
14
|
-
return [{
|
|
6
|
+
return [gitignore({ strict: false }), {
|
|
15
7
|
name: "qstanay/ignores",
|
|
16
8
|
ignores: [
|
|
17
9
|
"**/node_modules/**",
|
|
@@ -19,17 +11,98 @@ function ignores(extraIgnores = []) {
|
|
|
19
11
|
"**/.output/**",
|
|
20
12
|
"**/.nuxt/**",
|
|
21
13
|
"**/.nitro/**",
|
|
14
|
+
"**/coverage/**",
|
|
22
15
|
...extraIgnores
|
|
23
16
|
]
|
|
24
17
|
}];
|
|
25
18
|
}
|
|
26
19
|
//#endregion
|
|
20
|
+
//#region src/configs/imports.ts
|
|
21
|
+
async function imports() {
|
|
22
|
+
const mod = await import("eslint-plugin-import-x");
|
|
23
|
+
return [{
|
|
24
|
+
name: "qstanay/imports",
|
|
25
|
+
plugins: { import: mod.default ?? mod },
|
|
26
|
+
rules: {
|
|
27
|
+
"import/first": "error",
|
|
28
|
+
"import/no-duplicates": "error",
|
|
29
|
+
"import/no-mutable-exports": "error",
|
|
30
|
+
"import/no-named-default": "error"
|
|
31
|
+
}
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/configs/nuxt.ts
|
|
36
|
+
async function nuxt$1() {
|
|
37
|
+
const mod = await import("@nuxt/eslint-plugin");
|
|
38
|
+
return [{
|
|
39
|
+
name: "qstanay/nuxt",
|
|
40
|
+
plugins: { nuxt: mod.default ?? mod },
|
|
41
|
+
rules: { "nuxt/prefer-import-meta": "error" }
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/configs/typescript.ts
|
|
46
|
+
function collectRules(configs) {
|
|
47
|
+
return Object.assign({}, ...configs.filter((config) => config.rules).map((config) => config.rules));
|
|
48
|
+
}
|
|
49
|
+
async function typescript() {
|
|
50
|
+
const parserMod = await import("@typescript-eslint/parser");
|
|
51
|
+
const pluginMod = await import("@typescript-eslint/eslint-plugin");
|
|
52
|
+
const parser = parserMod.default ?? parserMod;
|
|
53
|
+
const plugin = pluginMod.default ?? pluginMod;
|
|
54
|
+
const recommended = plugin.configs?.["flat/recommended"] ?? [];
|
|
55
|
+
return [{
|
|
56
|
+
name: "qstanay/typescript",
|
|
57
|
+
files: [...TYPESCRIPT_FILES],
|
|
58
|
+
languageOptions: {
|
|
59
|
+
parser,
|
|
60
|
+
parserOptions: {
|
|
61
|
+
sourceType: "module",
|
|
62
|
+
ecmaVersion: "latest",
|
|
63
|
+
extraFileExtensions: [".vue"]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
plugins: { "@typescript-eslint": plugin },
|
|
67
|
+
rules: collectRules(recommended)
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/configs/vue.ts
|
|
72
|
+
/**
|
|
73
|
+
* Vue layer based on the official flat recommended preset.
|
|
74
|
+
* Must spread the full array — it includes setup, processor, and rule packs.
|
|
75
|
+
*/
|
|
76
|
+
async function vue() {
|
|
77
|
+
const vuePluginMod = await import("eslint-plugin-vue");
|
|
78
|
+
const globalsMod = await import("globals");
|
|
79
|
+
const vuePlugin = vuePluginMod.default ?? vuePluginMod;
|
|
80
|
+
const globals = globalsMod.default ?? globalsMod;
|
|
81
|
+
return [...vuePlugin.configs?.["flat/recommended"] ?? [], {
|
|
82
|
+
name: "qstanay/vue/rules",
|
|
83
|
+
files: [...VUE_FILES],
|
|
84
|
+
languageOptions: {
|
|
85
|
+
globals: { ...globals.browser },
|
|
86
|
+
parserOptions: {
|
|
87
|
+
parser: {
|
|
88
|
+
ts: "@typescript-eslint/parser",
|
|
89
|
+
js: "espree"
|
|
90
|
+
},
|
|
91
|
+
ecmaVersion: "latest",
|
|
92
|
+
sourceType: "module",
|
|
93
|
+
extraFileExtensions: [".vue"]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
rules: { ...vueRules() }
|
|
97
|
+
}];
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
27
100
|
//#region src/index.ts
|
|
28
101
|
function defineConfig(options = {}, ...userConfigs) {
|
|
29
102
|
const enableTs = resolveEnabled(options.typescript, has("typescript"));
|
|
30
103
|
const enableVue = resolveEnabled(options.vue, has("vue") || has("nuxt"));
|
|
31
104
|
const enableNuxt = resolveEnabled(options.nuxt, has("nuxt"));
|
|
32
|
-
const stylisticOptions = options.stylistic
|
|
105
|
+
const stylisticOptions = resolveStylisticOptions(options.stylistic);
|
|
33
106
|
const configs = [];
|
|
34
107
|
configs.push(Promise.resolve(ignores(options.ignores)));
|
|
35
108
|
if (enableTs) configs.push(typescript());
|
|
@@ -39,11 +112,13 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
39
112
|
if (enableNuxt) configs.push(nuxt$1());
|
|
40
113
|
configs.push(Promise.resolve([{
|
|
41
114
|
name: "qstanay/shared-rules",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
115
|
+
files: [...SOURCE_FILES],
|
|
116
|
+
rules: sharedRules({ typescript: enableTs })
|
|
117
|
+
}]));
|
|
118
|
+
if (options.overrides) configs.push(Promise.resolve([{
|
|
119
|
+
name: "qstanay/overrides",
|
|
120
|
+
files: [...SOURCE_FILES],
|
|
121
|
+
rules: options.overrides
|
|
47
122
|
}]));
|
|
48
123
|
const composer = new FlatConfigComposer();
|
|
49
124
|
composer.append(...configs, ...userConfigs);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["typescriptConfig","stylisticConfig","vueConfig","nuxtConfig"],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["nuxt","typescriptConfig","stylisticConfig","vueConfig","nuxtConfig"],"sources":["../src/configs/ignores.ts","../src/configs/imports.ts","../src/configs/nuxt.ts","../src/configs/typescript.ts","../src/configs/vue.ts","../src/index.ts"],"sourcesContent":["import type { TypedFlatConfigItem } from '../types';\n\nimport gitignore from 'eslint-config-flat-gitignore';\n\nexport function ignores(extraIgnores: string[] = []): TypedFlatConfigItem[] {\n return [\n // Prefer project .gitignore when present; do not fail if missing.\n gitignore({ strict: false }),\n {\n name: 'qstanay/ignores',\n ignores: [\n '**/node_modules/**',\n '**/dist/**',\n '**/.output/**',\n '**/.nuxt/**',\n '**/.nitro/**',\n '**/coverage/**',\n ...extraIgnores,\n ],\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function imports(): Promise<TypedFlatConfigItem[]> {\n const mod = await import('eslint-plugin-import-x');\n const plugin = (mod as any).default ?? mod;\n\n return [\n {\n name: 'qstanay/imports',\n plugins: {\n import: plugin,\n },\n rules: {\n 'import/first': 'error',\n 'import/no-duplicates': 'error',\n 'import/no-mutable-exports': 'error',\n 'import/no-named-default': 'error',\n },\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function nuxt(): Promise<TypedFlatConfigItem[]> {\n const mod = await import('@nuxt/eslint-plugin');\n const plugin = (mod as any).default ?? mod;\n\n return [\n {\n name: 'qstanay/nuxt',\n plugins: {\n nuxt: plugin,\n },\n rules: {\n // keep this minimal; Nuxt base config already provides most of it\n 'nuxt/prefer-import-meta': 'error',\n },\n },\n ];\n}\n","import type { Linter } from 'eslint';\n\nimport type { TypedFlatConfigItem } from '../types';\n\nimport { TYPESCRIPT_FILES } from '../utils';\n\nfunction collectRules(configs: TypedFlatConfigItem[]): Linter.RulesRecord {\n return Object.assign(\n {},\n ...configs\n .filter(config => config.rules)\n .map(config => config.rules),\n );\n}\n\nexport async function typescript(): Promise<TypedFlatConfigItem[]> {\n const parserMod = await import('@typescript-eslint/parser');\n const pluginMod = await import('@typescript-eslint/eslint-plugin');\n\n const parser = (parserMod as any).default ?? parserMod;\n const plugin = (pluginMod as any).default ?? pluginMod;\n\n const recommended = (plugin.configs?.['flat/recommended'] ?? []) as TypedFlatConfigItem[];\n\n return [\n {\n name: 'qstanay/typescript',\n files: [...TYPESCRIPT_FILES],\n languageOptions: {\n parser,\n parserOptions: {\n sourceType: 'module',\n ecmaVersion: 'latest',\n extraFileExtensions: ['.vue'],\n },\n },\n plugins: {\n '@typescript-eslint': plugin,\n },\n rules: collectRules(recommended),\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nimport { VUE_FILES } from '../utils';\nimport { vueRules } from './vue-rules';\n\n/**\n * Vue layer based on the official flat recommended preset.\n * Must spread the full array — it includes setup, processor, and rule packs.\n */\nexport async function vue(): Promise<TypedFlatConfigItem[]> {\n const vuePluginMod = await import('eslint-plugin-vue');\n const globalsMod = await import('globals');\n\n const vuePlugin = (vuePluginMod as any).default ?? vuePluginMod;\n const globals = (globalsMod as any).default ?? globalsMod;\n\n const recommended = (vuePlugin.configs?.['flat/recommended'] ?? []) as TypedFlatConfigItem[];\n\n return [\n ...recommended,\n {\n name: 'qstanay/vue/rules',\n files: [...VUE_FILES],\n languageOptions: {\n globals: {\n ...globals.browser,\n },\n parserOptions: {\n // Keep vue-eslint-parser as the root parser (from recommended),\n // and parse <script lang=\"ts\"> with the TS parser.\n parser: {\n ts: '@typescript-eslint/parser',\n js: 'espree',\n },\n ecmaVersion: 'latest',\n sourceType: 'module',\n extraFileExtensions: ['.vue'],\n },\n },\n rules: {\n ...vueRules(),\n },\n },\n ];\n}\n","import type { Awaitable, OptionsConfig, TypedFlatConfigItem } from './types';\n\nimport { FlatConfigComposer } from 'eslint-flat-config-utils';\nimport { has, resolveEnabled, resolveStylisticOptions, SOURCE_FILES } from './utils';\nimport { ignores } from './configs/ignores';\nimport { sharedRules } from './configs/shared-rules';\nimport { imports } from './configs/imports';\nimport { nuxt as nuxtConfig } from './configs/nuxt';\nimport { stylistic as stylisticConfig } from './configs/stylistic';\nimport { typescript as typescriptConfig } from './configs/typescript';\nimport { vue as vueConfig } from './configs/vue';\n\nexport { nuxt } from './nuxt';\nexport * from './types';\n\nexport function defineConfig(\n options: OptionsConfig = {},\n ...userConfigs: (Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>)[]\n) {\n const enableTs = resolveEnabled(options.typescript, has('typescript'));\n const enableVue = resolveEnabled(options.vue, has('vue') || has('nuxt'));\n const enableNuxt = resolveEnabled(options.nuxt, has('nuxt'));\n const stylisticOptions = resolveStylisticOptions(options.stylistic);\n\n const configs: (Awaitable<TypedFlatConfigItem[]>)[] = [];\n\n configs.push(Promise.resolve(ignores(options.ignores)));\n\n if (enableTs) {\n configs.push(typescriptConfig());\n }\n\n configs.push(imports());\n\n if (stylisticOptions) {\n configs.push(stylisticConfig(stylisticOptions));\n }\n\n if (enableVue) {\n configs.push(vueConfig());\n }\n\n if (enableNuxt) {\n configs.push(nuxtConfig());\n }\n\n configs.push(Promise.resolve([\n {\n name: 'qstanay/shared-rules',\n files: [...SOURCE_FILES],\n rules: sharedRules({ typescript: enableTs }),\n },\n ]));\n\n if (options.overrides) {\n // Trailing block so project overrides win over shared/vue/ts packs.\n configs.push(Promise.resolve([\n {\n name: 'qstanay/overrides',\n files: [...SOURCE_FILES],\n rules: options.overrides,\n },\n ]));\n }\n\n const composer = new FlatConfigComposer<TypedFlatConfigItem>();\n composer.append(...configs, ...userConfigs as any);\n return composer;\n}\n"],"mappings":";;;;AAIA,SAAgB,QAAQ,eAAyB,CAAC,GAA0B;CAC1E,OAAO,CAEL,UAAU,EAAE,QAAQ,MAAM,CAAC,GAC3B;EACE,MAAM;EACN,SAAS;GACP;GACA;G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ionsConfig {
|
|
|
35
35
|
//#region src/nuxt.d.ts
|
|
36
36
|
interface NuxtPresetOptions {
|
|
37
37
|
stylistic?: boolean | StylisticOptions;
|
|
38
|
-
overrides?:
|
|
38
|
+
overrides?: Linter.RulesRecord;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Opinionated layer for Nuxt apps.
|
|
42
|
+
*
|
|
43
|
+
* Intended to be used with `@nuxt/eslint` + `withNuxt()`:
|
|
44
|
+
* Nuxt already provides TypeScript/Vue/import plugins, so this preset
|
|
45
|
+
* only adds stylistic formatting and shared opinionated rules.
|
|
46
|
+
*/
|
|
40
47
|
declare function nuxt(options?: NuxtPresetOptions): Promise<TypedFlatConfigItem[]>[];
|
|
41
48
|
//#endregion
|
|
42
49
|
export { StylisticOptions as a, OptionsConfig as i, nuxt as n, TypedFlatConfigItem as o, Awaitable as r, NuxtPresetOptions as t };
|
|
43
|
-
//# sourceMappingURL=nuxt-
|
|
50
|
+
//# sourceMappingURL=nuxt-D-E7z44c.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt-
|
|
1
|
+
{"version":3,"file":"nuxt-D-E7z44c.d.mts","names":[],"sources":["../src/types.ts","../src/nuxt.ts"],"mappings":";;KAEY,UAAU,KAAK,IAAI,QAAQ;KAE3B,sBAAsB,OAAO;UAExB;EACf;EACA;EACA;EACA;;UAGe;;;;EAIf;;;;EAIA;;;;EAIA;EACA,sBAAsB;;;;EAItB;;;;EAIA,YAAY,OAAO;;;;UCzBJ;EACf,sBAAsB;EACtB,YAAY,OAAO;;;;;;;;;iBAUL,KAAK,UAAS,oBAAsB,QAAA"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { isPackageExists } from "local-pkg";
|
|
2
|
+
//#region src/utils.ts
|
|
3
|
+
function resolveEnabled(explicit, detected) {
|
|
4
|
+
return explicit ?? detected;
|
|
5
|
+
}
|
|
6
|
+
function has(pkg) {
|
|
7
|
+
return isPackageExists(pkg);
|
|
8
|
+
}
|
|
9
|
+
function resolveStylisticOptions(stylistic) {
|
|
10
|
+
if (stylistic === false) return false;
|
|
11
|
+
if (typeof stylistic === "object") return stylistic;
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const SOURCE_FILES = ["**/*.{js,jsx,ts,tsx,cts,mts,vue}"];
|
|
15
|
+
const TYPESCRIPT_FILES = ["**/*.{ts,tsx,cts,mts}", "**/*.vue"];
|
|
16
|
+
const VUE_FILES = ["**/*.vue"];
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/configs/shared-rules.ts
|
|
19
|
+
function javascriptRules() {
|
|
20
|
+
return {
|
|
21
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
22
|
+
"no-debugger": "error",
|
|
23
|
+
"eqeqeq": ["error", "always"],
|
|
24
|
+
"object-shorthand": ["error", "always"],
|
|
25
|
+
"prefer-template": "error",
|
|
26
|
+
"curly": ["error", "all"],
|
|
27
|
+
"arrow-body-style": ["error", "as-needed"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function typescriptRules() {
|
|
31
|
+
return {
|
|
32
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
33
|
+
argsIgnorePattern: "^_",
|
|
34
|
+
varsIgnorePattern: "^_",
|
|
35
|
+
caughtErrorsIgnorePattern: "^_",
|
|
36
|
+
destructuredArrayIgnorePattern: "^_"
|
|
37
|
+
}],
|
|
38
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
39
|
+
prefer: "type-imports",
|
|
40
|
+
disallowTypeAnnotations: false
|
|
41
|
+
}],
|
|
42
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
43
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
44
|
+
"@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
|
|
45
|
+
"@typescript-eslint/no-magic-numbers": ["warn", {
|
|
46
|
+
ignore: [
|
|
47
|
+
-1,
|
|
48
|
+
0,
|
|
49
|
+
1,
|
|
50
|
+
2,
|
|
51
|
+
1e3
|
|
52
|
+
],
|
|
53
|
+
ignoreEnums: true,
|
|
54
|
+
ignoreArrayIndexes: true,
|
|
55
|
+
ignoreDefaultValues: true,
|
|
56
|
+
ignoreClassFieldInitialValues: true,
|
|
57
|
+
ignoreReadonlyClassProperties: true
|
|
58
|
+
}]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Shared opinionated rules.
|
|
63
|
+
* TypeScript rules are included only when `typescript` is true,
|
|
64
|
+
* so JS-only projects do not reference a missing plugin.
|
|
65
|
+
*/
|
|
66
|
+
function sharedRules(options = {}) {
|
|
67
|
+
return {
|
|
68
|
+
...javascriptRules(),
|
|
69
|
+
...options.typescript ? typescriptRules() : {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/configs/stylistic.ts
|
|
74
|
+
async function loadStylistic() {
|
|
75
|
+
const mod = await import("@stylistic/eslint-plugin");
|
|
76
|
+
return mod.default ?? mod;
|
|
77
|
+
}
|
|
78
|
+
async function stylistic(options = {}) {
|
|
79
|
+
const { indent = 2, quotes = "single", semi = true, maxLen = 100 } = options;
|
|
80
|
+
const plugin = await loadStylistic();
|
|
81
|
+
const config = plugin.configs.customize({
|
|
82
|
+
indent,
|
|
83
|
+
quotes,
|
|
84
|
+
semi,
|
|
85
|
+
jsx: false,
|
|
86
|
+
pluginName: "style"
|
|
87
|
+
});
|
|
88
|
+
return [{
|
|
89
|
+
name: "qstanay/stylistic",
|
|
90
|
+
plugins: { style: plugin },
|
|
91
|
+
rules: {
|
|
92
|
+
...config.rules ?? {},
|
|
93
|
+
"style/max-len": ["warn", {
|
|
94
|
+
code: maxLen,
|
|
95
|
+
ignoreUrls: true,
|
|
96
|
+
ignoreStrings: true,
|
|
97
|
+
ignoreTemplateLiterals: true,
|
|
98
|
+
ignoreComments: true,
|
|
99
|
+
ignoreTrailingComments: true,
|
|
100
|
+
ignoreRegExpLiterals: true
|
|
101
|
+
}]
|
|
102
|
+
}
|
|
103
|
+
}];
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/configs/vue-rules.ts
|
|
107
|
+
function vueRules() {
|
|
108
|
+
return {
|
|
109
|
+
"vue/html-self-closing": ["error", {
|
|
110
|
+
html: {
|
|
111
|
+
void: "always",
|
|
112
|
+
normal: "always",
|
|
113
|
+
component: "always"
|
|
114
|
+
},
|
|
115
|
+
svg: "always",
|
|
116
|
+
math: "always"
|
|
117
|
+
}],
|
|
118
|
+
"vue/attributes-order": "error",
|
|
119
|
+
"vue/padding-line-between-tags": "error"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/nuxt.ts
|
|
124
|
+
/**
|
|
125
|
+
* Opinionated layer for Nuxt apps.
|
|
126
|
+
*
|
|
127
|
+
* Intended to be used with `@nuxt/eslint` + `withNuxt()`:
|
|
128
|
+
* Nuxt already provides TypeScript/Vue/import plugins, so this preset
|
|
129
|
+
* only adds stylistic formatting and shared opinionated rules.
|
|
130
|
+
*/
|
|
131
|
+
function nuxt(options = {}) {
|
|
132
|
+
const stylisticOptions = resolveStylisticOptions(options.stylistic);
|
|
133
|
+
const configs = [];
|
|
134
|
+
if (stylisticOptions) configs.push(stylistic(stylisticOptions));
|
|
135
|
+
configs.push(Promise.resolve([{
|
|
136
|
+
name: "qstanay/nuxt/shared-rules",
|
|
137
|
+
files: [...SOURCE_FILES],
|
|
138
|
+
rules: sharedRules({ typescript: true })
|
|
139
|
+
}, {
|
|
140
|
+
name: "qstanay/nuxt/vue-rules",
|
|
141
|
+
files: [...VUE_FILES],
|
|
142
|
+
rules: { ...vueRules() }
|
|
143
|
+
}]));
|
|
144
|
+
if (options.overrides) configs.push(Promise.resolve([{
|
|
145
|
+
name: "qstanay/nuxt/overrides",
|
|
146
|
+
files: [...SOURCE_FILES],
|
|
147
|
+
rules: options.overrides
|
|
148
|
+
}]));
|
|
149
|
+
return configs;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { SOURCE_FILES as a, has as c, sharedRules as i, resolveEnabled as l, vueRules as n, TYPESCRIPT_FILES as o, stylistic as r, VUE_FILES as s, nuxt as t, resolveStylisticOptions as u };
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=nuxt-HGf9trGQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuxt-HGf9trGQ.mjs","names":["stylisticConfig"],"sources":["../src/utils.ts","../src/configs/shared-rules.ts","../src/configs/stylistic.ts","../src/configs/vue-rules.ts","../src/nuxt.ts"],"sourcesContent":["import type { StylisticOptions } from './types';\n\nimport { isPackageExists } from 'local-pkg';\n\nexport function resolveEnabled(explicit: boolean | undefined, detected: boolean) {\n return explicit ?? detected;\n}\n\nexport function has(pkg: string) {\n return isPackageExists(pkg);\n}\n\nexport function resolveStylisticOptions(\n stylistic: boolean | StylisticOptions | undefined,\n): false | StylisticOptions {\n if (stylistic === false) {\n return false;\n }\n\n if (typeof stylistic === 'object') {\n return stylistic;\n }\n\n return {};\n}\n\nexport const SOURCE_FILES = ['**/*.{js,jsx,ts,tsx,cts,mts,vue}'] as const;\nexport const TYPESCRIPT_FILES = ['**/*.{ts,tsx,cts,mts}', '**/*.vue'] as const;\nexport const VUE_FILES = ['**/*.vue'] as const;\n","import type { Linter } from 'eslint';\n\nexport function javascriptRules(): Linter.RulesRecord {\n return {\n 'no-console': ['error', { allow: ['warn', 'error'] }],\n 'no-debugger': 'error',\n 'eqeqeq': ['error', 'always'],\n 'object-shorthand': ['error', 'always'],\n 'prefer-template': 'error',\n 'curly': ['error', 'all'],\n 'arrow-body-style': ['error', 'as-needed'],\n };\n}\n\nexport function typescriptRules(): Linter.RulesRecord {\n return {\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n argsIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n caughtErrorsIgnorePattern: '^_',\n destructuredArrayIgnorePattern: '^_',\n },\n ],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { prefer: 'type-imports', disallowTypeAnnotations: false },\n ],\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-non-null-assertion': 'error',\n '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],\n '@typescript-eslint/no-magic-numbers': [\n 'warn',\n {\n ignore: [-1, 0, 1, 2, 1000],\n ignoreEnums: true,\n ignoreArrayIndexes: true,\n ignoreDefaultValues: true,\n ignoreClassFieldInitialValues: true,\n ignoreReadonlyClassProperties: true,\n },\n ],\n };\n}\n\n/**\n * Shared opinionated rules.\n * TypeScript rules are included only when `typescript` is true,\n * so JS-only projects do not reference a missing plugin.\n */\nexport function sharedRules(options: { typescript?: boolean } = {}): Linter.RulesRecord {\n return {\n ...javascriptRules(),\n ...(options.typescript ? typescriptRules() : {}),\n };\n}\n","import type { TypedFlatConfigItem, StylisticOptions } from '../types';\n\nasync function loadStylistic() {\n const mod = await import('@stylistic/eslint-plugin');\n return mod.default ?? mod;\n}\n\nexport async function stylistic(\n options: StylisticOptions = {},\n): Promise<TypedFlatConfigItem[]> {\n const {\n indent = 2,\n quotes = 'single',\n semi = true,\n maxLen = 100,\n } = options;\n\n const plugin = await loadStylistic();\n\n // `customize()` gives us a coherent bundle of stylistic rules.\n // Plugin name is fixed to `style` for stable rule IDs.\n const config = plugin.configs.customize({\n indent,\n quotes,\n semi,\n jsx: false,\n pluginName: 'style',\n }) as TypedFlatConfigItem;\n\n return [\n {\n name: 'qstanay/stylistic',\n plugins: {\n style: plugin,\n },\n rules: {\n ...(config.rules ?? {}),\n // Keep max line length aligned across all projects.\n 'style/max-len': [\n 'warn',\n {\n code: maxLen,\n ignoreUrls: true,\n ignoreStrings: true,\n ignoreTemplateLiterals: true,\n ignoreComments: true,\n ignoreTrailingComments: true,\n ignoreRegExpLiterals: true,\n },\n ],\n },\n },\n ];\n}\n","import type { Linter } from 'eslint';\n\nexport function vueRules(): Linter.RulesRecord {\n return {\n 'vue/html-self-closing': [\n 'error',\n {\n html: {\n void: 'always',\n normal: 'always',\n component: 'always',\n },\n svg: 'always',\n math: 'always',\n },\n ],\n 'vue/attributes-order': 'error',\n 'vue/padding-line-between-tags': 'error',\n };\n}\n","import type { Linter } from 'eslint';\n\nimport type { StylisticOptions, TypedFlatConfigItem } from './types';\n\nimport { sharedRules } from './configs/shared-rules';\nimport { stylistic as stylisticConfig } from './configs/stylistic';\nimport { vueRules } from './configs/vue-rules';\nimport { resolveStylisticOptions, SOURCE_FILES, VUE_FILES } from './utils';\n\nexport interface NuxtPresetOptions {\n stylistic?: boolean | StylisticOptions;\n overrides?: Linter.RulesRecord;\n}\n\n/**\n * Opinionated layer for Nuxt apps.\n *\n * Intended to be used with `@nuxt/eslint` + `withNuxt()`:\n * Nuxt already provides TypeScript/Vue/import plugins, so this preset\n * only adds stylistic formatting and shared opinionated rules.\n */\nexport function nuxt(options: NuxtPresetOptions = {}) {\n const stylisticOptions = resolveStylisticOptions(options.stylistic);\n const configs: Promise<TypedFlatConfigItem[]>[] = [];\n\n if (stylisticOptions) {\n configs.push(stylisticConfig(stylisticOptions));\n }\n\n configs.push(Promise.resolve([\n {\n name: 'qstanay/nuxt/shared-rules',\n files: [...SOURCE_FILES],\n // Host (@nuxt/eslint) registers @typescript-eslint; include TS rules.\n rules: sharedRules({ typescript: true }),\n },\n {\n name: 'qstanay/nuxt/vue-rules',\n files: [...VUE_FILES],\n rules: {\n ...vueRules(),\n },\n },\n ]));\n\n if (options.overrides) {\n // Dedicated trailing block so overrides always win over vue/shared rules.\n configs.push(Promise.resolve([\n {\n name: 'qstanay/nuxt/overrides',\n files: [...SOURCE_FILES],\n rules: options.overrides,\n },\n ]));\n }\n\n return configs;\n}\n"],"mappings":";;AAIA,SAAgB,eAAe,UAA+B,UAAmB;CAC/E,OAAO,YAAY;AACrB;AAEA,SAAgB,IAAI,KAAa;CAC/B,OAAO,gBAAgB,GAA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from "./nuxt-
|
|
1
|
+
import { n as nuxt, t as NuxtPresetOptions } from "./nuxt-D-E7z44c.mjs";
|
|
2
2
|
export { NuxtPresetOptions, nuxt };
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as nuxt } from "./nuxt-
|
|
1
|
+
import { t as nuxt } from "./nuxt-HGf9trGQ.mjs";
|
|
2
2
|
export { nuxt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qstanay/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Opinionated ESLint flat config for Nuxt, Vue and TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"lint": "eslint .",
|
|
16
16
|
"lint:fix": "eslint . --fix",
|
|
17
17
|
"test": "vitest",
|
|
18
|
-
"typecheck": "tsc --noEmit"
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
19
20
|
},
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"eslint-flat-config-utils": "^3.2.0",
|
|
49
50
|
"eslint-plugin-import-x": "^4.0.0",
|
|
50
51
|
"eslint-plugin-vue": "^10.0.0",
|
|
51
|
-
"eslint-processor-vue-blocks": "^2.0.0",
|
|
52
52
|
"globals": "^17.0.0",
|
|
53
53
|
"local-pkg": "^1.2.0",
|
|
54
54
|
"vue-eslint-parser": "^10.0.0"
|
package/dist/nuxt-Cz6LtoZ_.mjs
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
//#region src/configs/shared-rules.ts
|
|
2
|
-
function sharedRules() {
|
|
3
|
-
return {
|
|
4
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
5
|
-
"no-debugger": "error",
|
|
6
|
-
"eqeqeq": ["error", "always"],
|
|
7
|
-
"object-shorthand": ["error", "always"],
|
|
8
|
-
"prefer-template": "error",
|
|
9
|
-
"curly": ["error", "all"],
|
|
10
|
-
"arrow-body-style": ["error", "as-needed"],
|
|
11
|
-
"@typescript-eslint/no-unused-vars": ["error", {
|
|
12
|
-
argsIgnorePattern: "^_",
|
|
13
|
-
varsIgnorePattern: "^_",
|
|
14
|
-
caughtErrorsIgnorePattern: "^_",
|
|
15
|
-
destructuredArrayIgnorePattern: "^_"
|
|
16
|
-
}],
|
|
17
|
-
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
18
|
-
prefer: "type-imports",
|
|
19
|
-
disallowTypeAnnotations: false
|
|
20
|
-
}],
|
|
21
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
22
|
-
"@typescript-eslint/no-non-null-assertion": "error",
|
|
23
|
-
"@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
|
|
24
|
-
"@typescript-eslint/no-magic-numbers": ["warn", {
|
|
25
|
-
ignore: [
|
|
26
|
-
-1,
|
|
27
|
-
0,
|
|
28
|
-
1,
|
|
29
|
-
2,
|
|
30
|
-
1e3
|
|
31
|
-
],
|
|
32
|
-
ignoreEnums: true,
|
|
33
|
-
ignoreArrayIndexes: true,
|
|
34
|
-
ignoreDefaultValues: true,
|
|
35
|
-
ignoreClassFieldInitialValues: true,
|
|
36
|
-
ignoreReadonlyClassProperties: true
|
|
37
|
-
}]
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/configs/imports.ts
|
|
42
|
-
async function imports() {
|
|
43
|
-
const mod = await import("eslint-plugin-import-x");
|
|
44
|
-
return [{
|
|
45
|
-
name: "qstanay/imports",
|
|
46
|
-
plugins: { import: mod.default ?? mod },
|
|
47
|
-
rules: {
|
|
48
|
-
"import/first": "error",
|
|
49
|
-
"import/no-duplicates": "error",
|
|
50
|
-
"import/no-mutable-exports": "error",
|
|
51
|
-
"import/no-named-default": "error"
|
|
52
|
-
}
|
|
53
|
-
}];
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/configs/nuxt.ts
|
|
57
|
-
async function nuxt$1() {
|
|
58
|
-
const mod = await import("@nuxt/eslint-plugin");
|
|
59
|
-
return [{
|
|
60
|
-
name: "qstanay/nuxt",
|
|
61
|
-
plugins: { nuxt: mod.default ?? mod },
|
|
62
|
-
rules: { "nuxt/prefer-import-meta": "error" }
|
|
63
|
-
}];
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/configs/stylistic.ts
|
|
67
|
-
async function loadStylistic() {
|
|
68
|
-
const mod = await import("@stylistic/eslint-plugin");
|
|
69
|
-
return mod.default ?? mod;
|
|
70
|
-
}
|
|
71
|
-
async function stylistic(options = {}) {
|
|
72
|
-
const { indent = 2, quotes = "single", semi = true, maxLen = 100 } = options;
|
|
73
|
-
const plugin = await loadStylistic();
|
|
74
|
-
const config = plugin.configs.customize({
|
|
75
|
-
indent,
|
|
76
|
-
quotes,
|
|
77
|
-
semi,
|
|
78
|
-
jsx: false,
|
|
79
|
-
pluginName: "style"
|
|
80
|
-
});
|
|
81
|
-
return [{
|
|
82
|
-
name: "qstanay/stylistic",
|
|
83
|
-
plugins: { style: plugin },
|
|
84
|
-
rules: {
|
|
85
|
-
...config.rules ?? {},
|
|
86
|
-
"style/max-len": ["warn", {
|
|
87
|
-
code: maxLen,
|
|
88
|
-
ignoreUrls: true,
|
|
89
|
-
ignoreStrings: true,
|
|
90
|
-
ignoreTemplateLiterals: true,
|
|
91
|
-
ignoreComments: true,
|
|
92
|
-
ignoreTrailingComments: true,
|
|
93
|
-
ignoreRegExpLiterals: true
|
|
94
|
-
}]
|
|
95
|
-
}
|
|
96
|
-
}];
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/configs/typescript.ts
|
|
100
|
-
async function typescript() {
|
|
101
|
-
const parserMod = await import("@typescript-eslint/parser");
|
|
102
|
-
const pluginMod = await import("@typescript-eslint/eslint-plugin");
|
|
103
|
-
const parser = parserMod.default ?? parserMod;
|
|
104
|
-
const plugin = pluginMod.default ?? pluginMod;
|
|
105
|
-
return [{
|
|
106
|
-
name: "qstanay/typescript",
|
|
107
|
-
files: ["**/*.{ts,tsx,cts,mts,vue}"],
|
|
108
|
-
languageOptions: {
|
|
109
|
-
parser,
|
|
110
|
-
parserOptions: {
|
|
111
|
-
sourceType: "module",
|
|
112
|
-
ecmaVersion: "latest"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
plugins: { "@typescript-eslint": plugin },
|
|
116
|
-
rules: { ...plugin.configs?.recommended?.rules ?? {} }
|
|
117
|
-
}];
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/configs/vue.ts
|
|
121
|
-
async function vue() {
|
|
122
|
-
const vuePluginMod = await import("eslint-plugin-vue");
|
|
123
|
-
const vueParserMod = await import("vue-eslint-parser");
|
|
124
|
-
const vuePlugin = vuePluginMod.default ?? vuePluginMod;
|
|
125
|
-
return [{
|
|
126
|
-
name: "qstanay/vue",
|
|
127
|
-
files: ["**/*.vue"],
|
|
128
|
-
languageOptions: {
|
|
129
|
-
parser: vueParserMod.default ?? vueParserMod,
|
|
130
|
-
parserOptions: {
|
|
131
|
-
parser: {
|
|
132
|
-
ts: "@typescript-eslint/parser",
|
|
133
|
-
js: "espree"
|
|
134
|
-
},
|
|
135
|
-
ecmaVersion: "latest",
|
|
136
|
-
sourceType: "module",
|
|
137
|
-
extraFileExtensions: [".vue"]
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
plugins: { vue: vuePlugin },
|
|
141
|
-
rules: {
|
|
142
|
-
...vuePlugin.configs?.["flat/recommended"]?.[0]?.rules ?? {},
|
|
143
|
-
"vue/html-self-closing": ["error", {
|
|
144
|
-
html: {
|
|
145
|
-
void: "always",
|
|
146
|
-
normal: "always",
|
|
147
|
-
component: "always"
|
|
148
|
-
},
|
|
149
|
-
svg: "always",
|
|
150
|
-
math: "always"
|
|
151
|
-
}],
|
|
152
|
-
"vue/attributes-order": "error",
|
|
153
|
-
"vue/padding-line-between-tags": "error"
|
|
154
|
-
}
|
|
155
|
-
}];
|
|
156
|
-
}
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/nuxt.ts
|
|
159
|
-
function nuxt(options = {}) {
|
|
160
|
-
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
161
|
-
const configs = [
|
|
162
|
-
typescript(),
|
|
163
|
-
imports(),
|
|
164
|
-
vue(),
|
|
165
|
-
nuxt$1(),
|
|
166
|
-
Promise.resolve([{
|
|
167
|
-
name: "qstanay/nuxt/shared-rules",
|
|
168
|
-
files: ["**/*.{js,jsx,ts,tsx,cts,mts,vue}"],
|
|
169
|
-
rules: { ...sharedRules() }
|
|
170
|
-
}])
|
|
171
|
-
];
|
|
172
|
-
if (stylisticOptions) configs.unshift(stylistic(stylisticOptions));
|
|
173
|
-
return configs;
|
|
174
|
-
}
|
|
175
|
-
//#endregion
|
|
176
|
-
export { nuxt$1 as a, stylistic as i, vue as n, imports as o, typescript as r, sharedRules as s, nuxt as t };
|
|
177
|
-
|
|
178
|
-
//# sourceMappingURL=nuxt-Cz6LtoZ_.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt-Cz6LtoZ_.mjs","names":["nuxt","typescriptConfig","vueConfig","nuxtConfig","stylisticConfig"],"sources":["../src/configs/shared-rules.ts","../src/configs/imports.ts","../src/configs/nuxt.ts","../src/configs/stylistic.ts","../src/configs/typescript.ts","../src/configs/vue.ts","../src/nuxt.ts"],"sourcesContent":["import type { Linter } from 'eslint';\n\nexport function sharedRules(): Linter.RulesRecord {\n return {\n // JavaScript logic\n 'no-console': ['error', { allow: ['warn', 'error'] }],\n 'no-debugger': 'error',\n 'eqeqeq': ['error', 'always'],\n 'object-shorthand': ['error', 'always'],\n 'prefer-template': 'error',\n 'curly': ['error', 'all'],\n 'arrow-body-style': ['error', 'as-needed'],\n\n // TypeScript logic\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n argsIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n caughtErrorsIgnorePattern: '^_',\n destructuredArrayIgnorePattern: '^_',\n },\n ],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { prefer: 'type-imports', disallowTypeAnnotations: false },\n ],\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-non-null-assertion': 'error',\n '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],\n '@typescript-eslint/no-magic-numbers': [\n 'warn',\n {\n ignore: [-1, 0, 1, 2, 1000],\n ignoreEnums: true,\n ignoreArrayIndexes: true,\n ignoreDefaultValues: true,\n ignoreClassFieldInitialValues: true,\n ignoreReadonlyClassProperties: true,\n },\n ],\n };\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function imports(): Promise<TypedFlatConfigItem[]> {\n const mod = await import('eslint-plugin-import-x');\n const plugin = (mod as any).default ?? mod;\n\n return [\n {\n name: 'qstanay/imports',\n plugins: {\n import: plugin,\n },\n rules: {\n 'import/first': 'error',\n 'import/no-duplicates': 'error',\n 'import/no-mutable-exports': 'error',\n 'import/no-named-default': 'error',\n },\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function nuxt(): Promise<TypedFlatConfigItem[]> {\n const mod = await import('@nuxt/eslint-plugin');\n const plugin = (mod as any).default ?? mod;\n\n return [\n {\n name: 'qstanay/nuxt',\n plugins: {\n nuxt: plugin,\n },\n rules: {\n // keep this minimal; Nuxt base config already provides most of it\n 'nuxt/prefer-import-meta': 'error',\n },\n },\n ];\n}\n","import type { TypedFlatConfigItem, StylisticOptions } from '../types';\n\nasync function loadStylistic() {\n const mod = await import('@stylistic/eslint-plugin');\n return mod.default ?? mod;\n}\n\nexport async function stylistic(\n options: StylisticOptions = {},\n): Promise<TypedFlatConfigItem[]> {\n const {\n indent = 2,\n quotes = 'single',\n semi = true,\n maxLen = 100,\n } = options;\n\n const plugin = await loadStylistic();\n\n // `customize()` gives us a coherent bundle of stylistic rules.\n // Plugin name is fixed to `style` for stable rule IDs.\n const config = plugin.configs.customize({\n indent,\n quotes,\n semi,\n jsx: false,\n pluginName: 'style',\n }) as TypedFlatConfigItem;\n\n return [\n {\n name: 'qstanay/stylistic',\n plugins: {\n style: plugin,\n },\n rules: {\n ...(config.rules ?? {}),\n // Keep max line length aligned across all projects.\n 'style/max-len': [\n 'warn',\n {\n code: maxLen,\n ignoreUrls: true,\n ignoreStrings: true,\n ignoreTemplateLiterals: true,\n ignoreComments: true,\n ignoreTrailingComments: true,\n ignoreRegExpLiterals: true,\n },\n ],\n },\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function typescript(): Promise<TypedFlatConfigItem[]> {\n const parserMod = await import('@typescript-eslint/parser');\n const pluginMod = await import('@typescript-eslint/eslint-plugin');\n\n const parser = (parserMod as any).default ?? parserMod;\n const plugin = (pluginMod as any).default ?? pluginMod;\n\n return [\n {\n name: 'qstanay/typescript',\n files: ['**/*.{ts,tsx,cts,mts,vue}'],\n languageOptions: {\n parser,\n parserOptions: {\n sourceType: 'module',\n ecmaVersion: 'latest',\n },\n },\n plugins: {\n '@typescript-eslint': plugin,\n },\n rules: {\n ...(plugin.configs?.recommended?.rules ?? {}),\n },\n },\n ];\n}\n","import type { TypedFlatConfigItem } from '../types';\n\nexport async function vue(): Promise<TypedFlatConfigItem[]> {\n const vuePluginMod = await import('eslint-plugin-vue');\n const vueParserMod = await import('vue-eslint-parser');\n\n const vuePlugin = (vuePluginMod as any).default ?? vuePluginMod;\n const vueParser = (vueParserMod as any).default ?? vueParserMod;\n\n return [\n {\n name: 'qstanay/vue',\n files: ['**/*.vue'],\n languageOptions: {\n parser: vueParser,\n parserOptions: {\n parser: {\n ts: '@typescript-eslint/parser',\n js: 'espree',\n },\n ecmaVersion: 'latest',\n sourceType: 'module',\n extraFileExtensions: ['.vue'],\n },\n },\n plugins: {\n vue: vuePlugin,\n },\n rules: {\n ...(vuePlugin.configs?.['flat/recommended']?.[0]?.rules ?? {}),\n 'vue/html-self-closing': [\n 'error',\n {\n html: {\n void: 'always',\n normal: 'always',\n component: 'always',\n },\n svg: 'always',\n math: 'always',\n },\n ],\n 'vue/attributes-order': 'error',\n 'vue/padding-line-between-tags': 'error',\n },\n },\n ];\n}\n","import type { StylisticOptions, TypedFlatConfigItem } from './types';\n\nimport { sharedRules } from './configs/shared-rules';\nimport { imports } from './configs/imports';\nimport { nuxt as nuxtConfig } from './configs/nuxt';\nimport { stylistic as stylisticConfig } from './configs/stylistic';\nimport { typescript as typescriptConfig } from './configs/typescript';\nimport { vue as vueConfig } from './configs/vue';\n\nexport interface NuxtPresetOptions {\n stylistic?: boolean | StylisticOptions;\n overrides?: Record<string, unknown>;\n}\n\nexport function nuxt(options: NuxtPresetOptions = {}) {\n const stylisticOptions = options.stylistic === false\n ? false\n : typeof options.stylistic === 'object'\n ? options.stylistic\n : {};\n\n const configs: Promise<TypedFlatConfigItem[]>[] = [\n typescriptConfig(),\n imports(),\n vueConfig(),\n nuxtConfig(),\n Promise.resolve([\n {\n name: 'qstanay/nuxt/shared-rules',\n files: ['**/*.{js,jsx,ts,tsx,cts,mts,vue}'],\n rules: {\n ...sharedRules(),\n },\n },\n ]),\n ];\n\n if (stylisticOptions) {\n configs.unshift(stylisticConfig(stylisticOptions));\n }\n\n return configs;\n}\n"],"mappings":";AAEA,SAAgB,cAAkC;CAChD,OAAO;EAEL,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,OAAO,EAAE,CAAC;EACpD,eAAe;EACf,UAAU,CAAC,SAAS,QAAQ;EAC5B,oBAAoB,CAAC,SAAS,QAAQ;EACtC,mBAAmB;EACnB,SAAS,CAAC,SAAS,KAAK;EACxB,oBAAoB,CAAC,SAAS,WAAW;EAGzC,qCAAqC,CACnC,SACA;GAC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