@book000/eslint-config 1.17.10 → 1.17.12

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.
@@ -10,8 +10,15 @@ concurrency:
10
10
  group: ${{ github.workflow }}
11
11
 
12
12
  jobs:
13
+ node-ci:
14
+ name: Node CI
15
+ permissions:
16
+ contents: read
17
+ uses: book000/templates/.github/workflows/reusable-nodejs-ci-pnpm.yml@master
18
+
13
19
  release:
14
20
  name: Release
21
+ needs: node-ci
15
22
  runs-on: ubuntu-latest
16
23
 
17
24
  permissions:
package/AGENTS.md CHANGED
@@ -38,7 +38,7 @@ The exported config is an ordered flat config array (the last matching definitio
38
38
 
39
39
  1. `neostandard({ noStyle: true })` and `tseslint.configs.recommended`.
40
40
  2. An explicit list of `eslint-plugin-unicorn` rules: a fixed snapshot of `flat/recommended` (see the comment in the file), not the preset itself.
41
- 3. TypeScript-only rules for `**/*.ts` and `**/*.tsx` (`strictTypeChecked` and `stylisticTypeChecked`, type-aware via `parserOptions.project: ["tsconfig.json"]`), with a few relaxed rules (`no-explicit-any`, `no-unsafe-assignment`, `no-unsafe-argument`, and others).
41
+ 3. TypeScript-only rules for `**/*.ts`, `**/*.tsx`, `**/*.mts`, and `**/*.cts` (`strictTypeChecked` and `stylisticTypeChecked`, type-aware via `parserOptions.project: ["tsconfig.json"]`), with a few relaxed rules (`no-explicit-any`, `no-unsafe-assignment`, `no-unsafe-argument`, and others).
42
42
  4. `unicorn/catch-error-name` and `unicorn/filename-case` overrides (including a `.vue` PascalCase override).
43
43
  5. `ignores`, then `eslint-config-prettier` last so that it can disable conflicting rules.
44
44
 
package/README.md CHANGED
@@ -40,7 +40,7 @@ export { default } from '@book000/eslint-config'
40
40
 
41
41
  - [neostandard](https://github.com/neostandard/neostandard) (without style rules) and the typescript-eslint `recommended` preset for all files.
42
42
  - An explicit list of [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) rules, with some noisy rules turned off.
43
- - For `*.ts` and `*.tsx`: typescript-eslint `strictTypeChecked` and `stylisticTypeChecked` with a few relaxed rules. A `tsconfig.json` in the project root is required.
43
+ - For `*.ts`, `*.tsx`, `*.mts`, and `*.cts`: typescript-eslint `strictTypeChecked` and `stylisticTypeChecked` with a few relaxed rules. A `tsconfig.json` in the project root is required.
44
44
  - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier), so formatting is left to Prettier.
45
45
 
46
46
  ## 📑 License
package/index.mjs CHANGED
@@ -400,7 +400,7 @@ export default tseslint.config(
400
400
  },
401
401
  },
402
402
  {
403
- files: ["**/*.ts", "**/*.tsx"],
403
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
404
404
  languageOptions: {
405
405
  globals: {
406
406
  ...globals.es2020,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@book000/eslint-config",
3
- "version": "1.17.10",
3
+ "version": "1.17.12",
4
4
  "description": "ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
package/test.mjs CHANGED
@@ -219,6 +219,22 @@ async function main() {
219
219
  shouldError: false,
220
220
  rules: ["@typescript-eslint/no-floating-promises"],
221
221
  },
222
+ ...["mts", "cts"].flatMap((extension) => [
223
+ {
224
+ name: `no-floating-promises: a plain Promise is an error in .${extension}`,
225
+ extension,
226
+ code: "Promise.resolve(1);",
227
+ shouldError: true,
228
+ rules: ["@typescript-eslint/no-floating-promises"],
229
+ },
230
+ {
231
+ name: `no-floating-promises: the void operator is allowed in .${extension}`,
232
+ extension,
233
+ code: "void Promise.resolve(1);",
234
+ shouldError: false,
235
+ rules: ["@typescript-eslint/no-floating-promises"],
236
+ },
237
+ ]),
222
238
  {
223
239
  name: "no-floating-promises: without the void operator is an error",
224
240
  code: "Promise.resolve(1);",
@@ -411,7 +427,7 @@ async function main() {
411
427
  },
412
428
  ];
413
429
 
414
- // Create temp files under src/ so they reliably match files: ["**/*.ts"] in the flat config.
430
+ // Create temp files under src/ so they match the TypeScript config.
415
431
  const srcDir = path.join(process.cwd(), "src");
416
432
  const tmpDir = path.join(srcDir, "__tmp__cli");
417
433
  if (!fs.existsSync(srcDir)) fs.mkdirSync(srcDir);
@@ -448,7 +464,7 @@ async function main() {
448
464
  esModuleInterop: true,
449
465
  skipLibCheck: true,
450
466
  },
451
- include: ["src/**/*.ts", "src/**/*.tsx"],
467
+ include: ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts", "src/**/*.cts"],
452
468
  },
453
469
  null,
454
470
  2
@@ -461,8 +477,8 @@ async function main() {
461
477
 
462
478
  // Write all temp files first; ESLint is started only once afterwards
463
479
  const tmpFilePaths = testCases.map((testCase, i) => {
464
- const { code, dir } = testCase;
465
- const kebabName = `test-${i}.ts`;
480
+ const { code, dir, extension = "ts" } = testCase;
481
+ const kebabName = `test-${i}.${extension}`;
466
482
  const targetDir = dir ? path.join(srcDir, dir) : tmpDir;
467
483
  const tmpFilePath = path.join(targetDir, kebabName);
468
484
  fs.writeFileSync(tmpFilePath, code);
@@ -487,7 +503,7 @@ async function main() {
487
503
  eslintBinPath,
488
504
  "--no-cache",
489
505
  "--ext",
490
- ".ts",
506
+ ".ts,.mts,.cts",
491
507
  "--format",
492
508
  "json",
493
509
  ...tmpFilePaths,
@@ -522,6 +538,12 @@ async function main() {
522
538
  `ESLint did not return a result for temp file: ${tmpFilePath}`
523
539
  );
524
540
  }
541
+ const fatalError = fileResult.messages.find((message) => message.fatal);
542
+ if (fatalError) {
543
+ throw new Error(
544
+ `ESLint could not lint ${tmpFilePath}: ${fatalError.message}`
545
+ );
546
+ }
525
547
 
526
548
  let errorCount = 0;
527
549
  const relevantErrors = [];