@oliver139/eslint-config 2.1.0 → 2.2.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 CHANGED
@@ -563,6 +563,27 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
563
563
  npm i -D eslint-plugin-vuejs-accessibility
564
564
  ```
565
565
 
566
+ #### Vue Accessibility
567
+
568
+ To enable Vue accessibility support, you need to explicitly turn it on:
569
+
570
+ ```js
571
+ // eslint.config.js
572
+ import antfu from '@antfu/eslint-config'
573
+
574
+ export default antfu({
575
+ vue: {
576
+ a11y: true
577
+ },
578
+ })
579
+ ```
580
+
581
+ Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
582
+
583
+ ```bash
584
+ npm i -D eslint-plugin-vuejs-accessibility
585
+ ```
586
+
566
587
  ### Optional Configs
567
588
 
568
589
  We provide some optional configs for specific use cases, that we don't include their dependencies by default.
package/dist/cli.js CHANGED
@@ -4,197 +4,18 @@ import * as p5 from "@clack/prompts";
4
4
  import c5 from "ansis";
5
5
  import { cac } from "cac";
6
6
 
7
- // src/cli/constants.ts
8
- import c from "ansis";
9
-
10
7
  // package.json
11
- var package_default = {
12
- name: "@oliver139/eslint-config",
13
- type: "module",
14
- version: "2.1.0",
15
- packageManager: "pnpm@10.6.2",
16
- description: " Oliver's ESLint config preset powered by @antfu/eslint-config",
17
- author: "Oliver Mak <oliver139.working@gmail.com> (https://github.com/oliver139)",
18
- license: "MIT",
19
- homepage: "https://github.com/oliver139/eslint-config-new",
20
- repository: {
21
- type: "git",
22
- url: "git+https://github.com/oliver139/eslint-config-new.git"
23
- },
24
- bugs: {
25
- url: "https://github.com/antfu/eslint-config/issues"
26
- },
27
- keywords: [
28
- "eslint-config"
29
- ],
30
- exports: {
31
- ".": "./dist/index.js"
32
- },
33
- main: "./dist/index.js",
34
- types: "./dist/index.d.ts",
35
- bin: "./bin/index.js",
36
- files: [
37
- "bin",
38
- "dist"
39
- ],
40
- scripts: {
41
- build: "nr typegen && tsup --clean --dts",
42
- stub: "tsup",
43
- dev: "npx @eslint/config-inspector --config eslint.config.ts",
44
- "build:inspector": "pnpm build && npx @eslint/config-inspector build",
45
- watch: "tsup --watch",
46
- lint: "eslint --fix",
47
- "lint:check": "eslint",
48
- typegen: "tsx scripts/typegen.ts",
49
- prepack: "nr build",
50
- release: "bumpp && pnpm publish",
51
- test: "vitest",
52
- typecheck: "tsc --noEmit",
53
- prepare: "simple-git-hooks"
54
- },
55
- peerDependencies: {
56
- "@eslint-react/eslint-plugin": "^1.19.0",
57
- "@prettier/plugin-xml": "^3.4.1",
58
- "@unocss/eslint-plugin": ">=0.50.0",
59
- "astro-eslint-parser": "^1.0.2",
60
- eslint: "^9.10.0",
61
- "eslint-plugin-astro": "^1.2.0",
62
- "eslint-plugin-format": ">=0.1.0",
63
- "eslint-plugin-react-hooks": "^5.0.0",
64
- "eslint-plugin-react-refresh": "^0.4.4",
65
- "eslint-plugin-solid": "^0.14.3",
66
- "eslint-plugin-svelte": ">=2.35.1",
67
- "eslint-plugin-vuejs-accessibility": "^2.4.1",
68
- "prettier-plugin-astro": "^0.14.0",
69
- "prettier-plugin-slidev": "^1.0.5",
70
- "svelte-eslint-parser": ">=0.37.0"
71
- },
72
- peerDependenciesMeta: {
73
- "@eslint-react/eslint-plugin": {
74
- optional: true
75
- },
76
- "@prettier/plugin-xml": {
77
- optional: true
78
- },
79
- "@unocss/eslint-plugin": {
80
- optional: true
81
- },
82
- "astro-eslint-parser": {
83
- optional: true
84
- },
85
- "eslint-plugin-astro": {
86
- optional: true
87
- },
88
- "eslint-plugin-format": {
89
- optional: true
90
- },
91
- "eslint-plugin-react-hooks": {
92
- optional: true
93
- },
94
- "eslint-plugin-react-refresh": {
95
- optional: true
96
- },
97
- "eslint-plugin-solid": {
98
- optional: true
99
- },
100
- "eslint-plugin-svelte": {
101
- optional: true
102
- },
103
- "eslint-plugin-vuejs-accessibility": {
104
- optional: true
105
- },
106
- "prettier-plugin-astro": {
107
- optional: true
108
- },
109
- "prettier-plugin-slidev": {
110
- optional: true
111
- },
112
- "svelte-eslint-parser": {
113
- optional: true
114
- }
115
- },
116
- dependencies: {
117
- "@antfu/install-pkg": "catalog:prod",
118
- "@clack/prompts": "catalog:prod",
119
- "@eslint-community/eslint-plugin-eslint-comments": "catalog:prod",
120
- "@eslint/markdown": "catalog:prod",
121
- "@stylistic/eslint-plugin": "catalog:prod",
122
- "@typescript-eslint/eslint-plugin": "catalog:prod",
123
- "@typescript-eslint/parser": "catalog:prod",
124
- "@vitest/eslint-plugin": "catalog:prod",
125
- ansis: "catalog:prod",
126
- cac: "catalog:prod",
127
- "eslint-config-flat-gitignore": "catalog:prod",
128
- "eslint-flat-config-utils": "catalog:prod",
129
- "eslint-merge-processors": "catalog:prod",
130
- "eslint-plugin-antfu": "catalog:prod",
131
- "eslint-plugin-command": "catalog:prod",
132
- "eslint-plugin-import-x": "catalog:prod",
133
- "eslint-plugin-jsdoc": "catalog:prod",
134
- "eslint-plugin-jsonc": "catalog:prod",
135
- "eslint-plugin-n": "catalog:prod",
136
- "eslint-plugin-no-only-tests": "catalog:prod",
137
- "eslint-plugin-perfectionist": "catalog:prod",
138
- "eslint-plugin-pnpm": "catalog:prod",
139
- "eslint-plugin-regexp": "catalog:prod",
140
- "eslint-plugin-toml": "catalog:prod",
141
- "eslint-plugin-unicorn": "catalog:prod",
142
- "eslint-plugin-unused-imports": "catalog:prod",
143
- "eslint-plugin-vue": "catalog:prod",
144
- "eslint-plugin-yml": "catalog:prod",
145
- "eslint-processor-vue-blocks": "catalog:prod",
146
- globals: "catalog:prod",
147
- "jsonc-eslint-parser": "catalog:prod",
148
- "local-pkg": "catalog:prod",
149
- "parse-gitignore": "catalog:prod",
150
- "toml-eslint-parser": "catalog:prod",
151
- "vue-eslint-parser": "catalog:prod",
152
- "yaml-eslint-parser": "catalog:prod"
153
- },
154
- devDependencies: {
155
- "@antfu/ni": "catalog:dev",
156
- "@eslint-react/eslint-plugin": "catalog:peer",
157
- "@eslint/config-inspector": "catalog:dev",
158
- "@oliver139/eslint-config": "workspace:*",
159
- "@prettier/plugin-xml": "catalog:peer",
160
- "@stylistic/eslint-plugin-migrate": "catalog:dev",
161
- "@types/node": "catalog:dev",
162
- "@unocss/eslint-plugin": "catalog:peer",
163
- "astro-eslint-parser": "catalog:peer",
164
- bumpp: "catalog:dev",
165
- eslint: "catalog:peer",
166
- "eslint-plugin-astro": "catalog:peer",
167
- "eslint-plugin-format": "catalog:peer",
168
- "eslint-plugin-react-hooks": "catalog:peer",
169
- "eslint-plugin-react-refresh": "catalog:peer",
170
- "eslint-plugin-solid": "catalog:peer",
171
- "eslint-plugin-svelte": "catalog:peer",
172
- "eslint-plugin-vuejs-accessibility": "catalog:peer",
173
- "eslint-typegen": "catalog:dev",
174
- execa: "catalog:dev",
175
- jiti: "catalog:dev",
176
- "lint-staged": "catalog:dev",
177
- "prettier-plugin-astro": "catalog:peer",
178
- "prettier-plugin-slidev": "catalog:peer",
179
- "simple-git-hooks": "catalog:dev",
180
- svelte: "catalog:peer",
181
- "svelte-eslint-parser": "catalog:peer",
182
- tinyglobby: "catalog:dev",
183
- tsup: "catalog:dev",
184
- tsx: "catalog:dev",
185
- typescript: "catalog:dev",
186
- vitest: "catalog:dev",
187
- vue: "catalog:peer"
188
- },
189
- "simple-git-hooks": {
190
- "pre-commit": "npx lint-staged"
191
- },
192
- "lint-staged": {
193
- "*": "eslint --fix"
194
- }
195
- };
8
+ var version = "2.2.0";
9
+
10
+ // src/cli/run.ts
11
+ import fs3 from "node:fs";
12
+ import path4 from "node:path";
13
+ import process4 from "node:process";
14
+ import * as p4 from "@clack/prompts";
15
+ import c4 from "ansis";
196
16
 
197
17
  // src/cli/constants.ts
18
+ import c from "ansis";
198
19
  var vscodeSettingsString = `
199
20
  // Disable the default formatter, use eslint instead
200
21
  "prettier.enable": false,
@@ -290,6 +111,12 @@ var dependenciesMap = {
290
111
  "eslint-plugin-astro",
291
112
  "astro-eslint-parser"
292
113
  ],
114
+ formatter: [
115
+ "eslint-plugin-format"
116
+ ],
117
+ formatterAstro: [
118
+ "prettier-plugin-astro"
119
+ ],
293
120
  react: [
294
121
  "@eslint-react/eslint-plugin",
295
122
  "eslint-plugin-react-hooks",
@@ -305,16 +132,12 @@ var dependenciesMap = {
305
132
  "eslint-plugin-svelte",
306
133
  "svelte-eslint-parser"
307
134
  ],
135
+ unocss: [
136
+ "@unocss/eslint-plugin"
137
+ ],
308
138
  vue: []
309
139
  };
310
140
 
311
- // src/cli/run.ts
312
- import fs3 from "node:fs";
313
- import path4 from "node:path";
314
- import process4 from "node:process";
315
- import * as p4 from "@clack/prompts";
316
- import c4 from "ansis";
317
-
318
141
  // src/cli/stages/update-eslint-files.ts
319
142
  import fs from "node:fs";
320
143
  import fsp from "node:fs/promises";
@@ -405,36 +228,53 @@ import path2 from "node:path";
405
228
  import process2 from "node:process";
406
229
  import * as p2 from "@clack/prompts";
407
230
  import c3 from "ansis";
231
+
232
+ // src/cli/constants-generated.ts
233
+ var versionsMap = {
234
+ "@eslint-react/eslint-plugin": "^1.37.3",
235
+ "@unocss/eslint-plugin": "^66.0.0",
236
+ "astro-eslint-parser": "^1.2.2",
237
+ "eslint": "^9.23.0",
238
+ "eslint-plugin-astro": "^1.3.1",
239
+ "eslint-plugin-format": "^1.0.1",
240
+ "eslint-plugin-react-hooks": "^5.2.0",
241
+ "eslint-plugin-react-refresh": "^0.4.19",
242
+ "eslint-plugin-solid": "^0.14.5",
243
+ "eslint-plugin-svelte": "^3.3.3",
244
+ "prettier-plugin-astro": "^0.14.1",
245
+ "prettier-plugin-slidev": "^1.0.5",
246
+ "svelte-eslint-parser": "^1.1.0"
247
+ };
248
+
249
+ // src/cli/stages/update-package-json.ts
408
250
  async function updatePackageJson(result) {
409
251
  const cwd = process2.cwd();
410
252
  const pathPackageJSON = path2.join(cwd, "package.json");
411
- p2.log.step(c3.cyan`Bumping @oliver139/eslint-config to v${package_default.version}`);
253
+ p2.log.step(c3.cyan`Bumping @oliver139/eslint-config to v${version}`);
412
254
  const pkgContent = await fsp2.readFile(pathPackageJSON, "utf-8");
413
255
  const pkg = JSON.parse(pkgContent);
414
256
  pkg.devDependencies ??= {};
415
- pkg.devDependencies["@oliver139/eslint-config"] = `^${package_default.version}`;
416
- pkg.devDependencies.eslint ??= package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, "");
257
+ pkg.devDependencies["@oliver139/eslint-config"] = `^${version}`;
258
+ pkg.devDependencies.eslint ??= versionsMap.eslint;
417
259
  const addedPackages = [];
418
260
  if (result.extra.length) {
419
261
  result.extra.forEach((item) => {
420
262
  switch (item) {
421
263
  case "formatter":
422
264
  [
423
- "eslint-plugin-format",
424
- result.frameworks.includes("astro") ? "prettier-plugin-astro" : null
265
+ ...dependenciesMap.formatter,
266
+ ...result.frameworks.includes("astro") ? dependenciesMap.formatterAstro : []
425
267
  ].forEach((f) => {
426
268
  if (!f) {
427
269
  return;
428
270
  }
429
- pkg.devDependencies[f] = package_default.devDependencies[f];
271
+ pkg.devDependencies[f] = versionsMap[f];
430
272
  addedPackages.push(f);
431
273
  });
432
274
  break;
433
275
  case "unocss":
434
- [
435
- "@unocss/eslint-plugin"
436
- ].forEach((f) => {
437
- pkg.devDependencies[f] = package_default.devDependencies[f];
276
+ dependenciesMap.unocss.forEach((f) => {
277
+ pkg.devDependencies[f] = versionsMap[f];
438
278
  addedPackages.push(f);
439
279
  });
440
280
  break;
@@ -445,7 +285,7 @@ async function updatePackageJson(result) {
445
285
  const deps = dependenciesMap[framework];
446
286
  if (deps) {
447
287
  deps.forEach((f) => {
448
- pkg.devDependencies[f] = package_default.devDependencies[f];
288
+ pkg.devDependencies[f] = versionsMap[f];
449
289
  addedPackages.push(f);
450
290
  });
451
291
  }
@@ -569,7 +409,7 @@ async function run(options = {}) {
569
409
  // src/cli/index.ts
570
410
  function header() {
571
411
  console.log("\n");
572
- p5.intro(`${c5.green`@oliver139/eslint-config `}${c5.dim`v${package_default.version}`}`);
412
+ p5.intro(`${c5.green`@oliver139/eslint-config `}${c5.dim`v${version}`}`);
573
413
  }
574
414
  var cli = cac("@oliver139/eslint-config");
575
415
  cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip prompts and use default values", { default: false }).option("--template, -t <template>", "Use the framework template for optimal customization: vue / react / svelte / astro", { type: [] }).option("--extra, -e <extra>", "Use the extra utils: formatter / perfectionist / unocss", { type: [] }).action(async (args) => {
@@ -583,5 +423,5 @@ cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip
583
423
  }
584
424
  });
585
425
  cli.help();
586
- cli.version(package_default.version);
426
+ cli.version(version);
587
427
  cli.parse();