@oliver139/eslint-config 2.7.0 → 2.9.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
@@ -388,7 +388,7 @@ Since flat config requires us to explicitly provide the plugin names (instead of
388
388
 
389
389
  | New Prefix | Original Prefix | Source Plugin |
390
390
  | ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
391
- | `import/*` | `import-x/*` | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x) |
391
+ | `import/*` | `import-lite/*` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
392
392
  | `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
393
393
  | `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
394
394
  | `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
@@ -502,10 +502,10 @@ export default eslintConfig()
502
502
  )
503
503
  // overrides any named configs
504
504
  .override(
505
- 'antfu/imports',
505
+ 'antfu/stylistic/rules',
506
506
  {
507
507
  rules: {
508
- 'import/order': ['error', { 'newlines-between': 'always' }],
508
+ 'style/generator-star-spacing': ['error', { after: true, before: false }],
509
509
  }
510
510
  }
511
511
  )
package/dist/cli.js CHANGED
@@ -1,8 +1,4 @@
1
1
  import process from "node:process";
2
- import * as p$4 from "@clack/prompts";
3
- import * as p$3 from "@clack/prompts";
4
- import * as p$2 from "@clack/prompts";
5
- import * as p$1 from "@clack/prompts";
6
2
  import * as p from "@clack/prompts";
7
3
  import c, { green } from "ansis";
8
4
  import { cac } from "cac";
@@ -13,7 +9,7 @@ import parse from "parse-gitignore";
13
9
  import { execSync } from "node:child_process";
14
10
 
15
11
  //#region package.json
16
- var version = "2.7.0";
12
+ var version = "2.9.0";
17
13
 
18
14
  //#endregion
19
15
  //#region src/cli/constants.ts
@@ -152,7 +148,7 @@ async function updateEslintFiles(result) {
152
148
  const pathFlatConfig = path.join(cwd, configFileName);
153
149
  const eslintIgnores = [];
154
150
  if (fs.existsSync(pathESLintIgnore)) {
155
- p$4.log.step(c.cyan`Migrating existing .eslintignore`);
151
+ p.log.step(c.cyan`Migrating existing .eslintignore`);
156
152
  const content = await fsp.readFile(pathESLintIgnore, "utf-8");
157
153
  const parsed = parse(content);
158
154
  const globs = parsed.globs();
@@ -168,28 +164,28 @@ async function updateEslintFiles(result) {
168
164
  const additionalConfig = [];
169
165
  const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
170
166
  await fsp.writeFile(pathFlatConfig, eslintConfigContent);
171
- p$4.log.success(c.green`Created ${configFileName}`);
167
+ p.log.success(c.green`Created ${configFileName}`);
172
168
  const files = fs.readdirSync(cwd);
173
169
  const legacyConfig = [];
174
170
  files.forEach((file) => {
175
171
  if (/eslint|prettier/.test(file) && !/eslint\.config\./.test(file)) legacyConfig.push(file);
176
172
  });
177
- if (legacyConfig.length) p$4.note(c.dim(legacyConfig.join(", ")), "You can now remove those files manually");
173
+ if (legacyConfig.length) p.note(c.dim(legacyConfig.join(", ")), "You can now remove those files manually");
178
174
  }
179
175
 
180
176
  //#endregion
181
177
  //#region src/cli/constants-generated.ts
182
178
  const versionsMap = {
183
- "@eslint-react/eslint-plugin": "^1.49.0",
184
- "@unocss/eslint-plugin": "^66.1.2",
179
+ "@eslint-react/eslint-plugin": "^1.52.2",
180
+ "@unocss/eslint-plugin": "^66.3.2",
185
181
  "astro-eslint-parser": "^1.2.2",
186
- "eslint": "^9.26.0",
182
+ "eslint": "^9.30.1",
187
183
  "eslint-plugin-astro": "^1.3.1",
188
184
  "eslint-plugin-format": "^1.0.1",
189
185
  "eslint-plugin-react-hooks": "^5.2.0",
190
186
  "eslint-plugin-react-refresh": "^0.4.20",
191
187
  "eslint-plugin-solid": "^0.14.5",
192
- "eslint-plugin-svelte": "^3.7.0",
188
+ "eslint-plugin-svelte": "^3.10.1",
193
189
  "prettier-plugin-astro": "^0.14.1",
194
190
  "prettier-plugin-slidev": "^1.0.5",
195
191
  "svelte-eslint-parser": "^1.2.0"
@@ -200,7 +196,7 @@ const versionsMap = {
200
196
  async function updatePackageJson(result) {
201
197
  const cwd = process.cwd();
202
198
  const pathPackageJSON = path.join(cwd, "package.json");
203
- p$3.log.step(c.cyan`Bumping @oliver139/eslint-config to v${version}`);
199
+ p.log.step(c.cyan`Bumping @oliver139/eslint-config to v${version}`);
204
200
  const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
205
201
  const pkg = JSON.parse(pkgContent);
206
202
  pkg.devDependencies ??= {};
@@ -231,9 +227,9 @@ async function updatePackageJson(result) {
231
227
  addedPackages.push(f);
232
228
  });
233
229
  }
234
- if (addedPackages.length) p$3.note(c.dim(addedPackages.join(", ")), "Added packages");
230
+ if (addedPackages.length) p.note(c.dim(addedPackages.join(", ")), "Added packages");
235
231
  await fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
236
- p$3.log.success(c.green`Changes wrote to package.json`);
232
+ p.log.success(c.green`Changes wrote to package.json`);
237
233
  }
238
234
 
239
235
  //#endregion
@@ -246,14 +242,14 @@ async function updateVscodeSettings(result) {
246
242
  if (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });
247
243
  if (!fs.existsSync(settingsPath)) {
248
244
  await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf-8");
249
- p$2.log.success(green`Created .vscode/settings.json`);
245
+ p.log.success(green`Created .vscode/settings.json`);
250
246
  } else {
251
247
  let settingsContent = await fsp.readFile(settingsPath, "utf8");
252
248
  settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
253
249
  settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
254
250
  settingsContent += `${vscodeSettingsString}}\n`;
255
251
  await fsp.writeFile(settingsPath, settingsContent, "utf-8");
256
- p$2.log.success(green`Updated .vscode/settings.json`);
252
+ p.log.success(green`Updated .vscode/settings.json`);
257
253
  }
258
254
  }
259
255
 
@@ -264,7 +260,7 @@ async function run(options = {}) {
264
260
  const argTemplate = options.frameworks?.map((m) => m?.trim()).filter(Boolean);
265
261
  const argExtra = options.extra?.map((m) => m?.trim()).filter(Boolean);
266
262
  if (fs.existsSync(path.join(process.cwd(), "eslint.config.js"))) {
267
- p$1.log.warn(c.yellow`eslint.config.js already exists, migration wizard exited.`);
263
+ p.log.warn(c.yellow`eslint.config.js already exists, migration wizard exited.`);
268
264
  return process.exit(1);
269
265
  }
270
266
  let result = {
@@ -274,10 +270,10 @@ async function run(options = {}) {
274
270
  updateVscodeSettings: true
275
271
  };
276
272
  if (!argSkipPrompt) {
277
- result = await p$1.group({
273
+ result = await p.group({
278
274
  uncommittedConfirmed: () => {
279
275
  if (argSkipPrompt || isGitClean()) return Promise.resolve(true);
280
- return p$1.confirm({
276
+ return p.confirm({
281
277
  initialValue: false,
282
278
  message: "There are uncommitted changes in the current repository, are you sure to continue?"
283
279
  });
@@ -286,7 +282,7 @@ async function run(options = {}) {
286
282
  const isArgTemplateValid = typeof argTemplate === "string" && !!frameworks.includes(argTemplate);
287
283
  if (!results.uncommittedConfirmed || isArgTemplateValid) return;
288
284
  const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
289
- return p$1.multiselect({
285
+ return p.multiselect({
290
286
  message: c.reset(message),
291
287
  options: frameworkOptions,
292
288
  required: false
@@ -296,7 +292,7 @@ async function run(options = {}) {
296
292
  const isArgExtraValid = argExtra?.length && !argExtra.filter((element) => !extra.includes(element)).length;
297
293
  if (!results.uncommittedConfirmed || isArgExtraValid) return;
298
294
  const message = !isArgExtraValid && argExtra ? `"${argExtra}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
299
- return p$1.multiselect({
295
+ return p.multiselect({
300
296
  message: c.reset(message),
301
297
  options: extraOptions,
302
298
  required: false
@@ -304,13 +300,13 @@ async function run(options = {}) {
304
300
  },
305
301
  updateVscodeSettings: ({ results }) => {
306
302
  if (!results.uncommittedConfirmed) return;
307
- return p$1.confirm({
303
+ return p.confirm({
308
304
  initialValue: true,
309
305
  message: "Update .vscode/settings.json for better VS Code experience?"
310
306
  });
311
307
  }
312
308
  }, { onCancel: () => {
313
- p$1.cancel("Operation cancelled.");
309
+ p.cancel("Operation cancelled.");
314
310
  process.exit(0);
315
311
  } });
316
312
  if (!result.uncommittedConfirmed) return process.exit(1);
@@ -318,8 +314,8 @@ async function run(options = {}) {
318
314
  await updatePackageJson(result);
319
315
  await updateEslintFiles(result);
320
316
  await updateVscodeSettings(result);
321
- p$1.log.success(c.green`Setup completed`);
322
- p$1.outro(`Now you can update the dependencies by run ${c.blue("pnpm install")} and run ${c.blue("eslint --fix")}\n`);
317
+ p.log.success(c.green`Setup completed`);
318
+ p.outro(`Now you can update the dependencies by run ${c.blue("pnpm install")} and run ${c.blue("eslint --fix")}\n`);
323
319
  }
324
320
 
325
321
  //#endregion