Skip to content

Commit bf05baa

Browse files
authored
chore: add typecheck to ts config files (#1481)
<!-- πŸ‘‹ Hi, thanks for sending a PR to eslint-plugin-package-json! πŸ—‚ Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [ ] Addresses an existing open issue: fixes #000 - [ ] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md) were taken > [!NOTE] > Actually this is a followup of #1480 ## Overview I noticed that were some typescript errors in - `eslint.config.ts` - `perfectionist.configs` is possibly undefined - `vitest.config.ts` - `coverage.all` option no longer is not a valid option in `vitest@4` To fix them I added `*.config.ts` to `tsconfig#includes` and updated `languageOptions.parserOptions.projectService` accordingly
1 parent 48b5fb6 commit bf05baa

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

β€Žeslint.config.tsβ€Ž

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-expect-error - no types
1+
// @ts-expect-error - no types - https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/214
22
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
33
import eslint from "@eslint/js";
44
import markdown from "@eslint/markdown";
@@ -13,7 +13,7 @@ import perfectionist from "eslint-plugin-perfectionist";
1313
import * as regexp from "eslint-plugin-regexp";
1414
import unicorn from "eslint-plugin-unicorn";
1515
import yml from "eslint-plugin-yml";
16-
import { defineConfig } from "eslint/config";
16+
import { defineConfig, globalIgnores } from "eslint/config";
1717
import tseslint from "typescript-eslint";
1818

1919
import packageJson from "./src/index.ts";
@@ -23,27 +23,25 @@ const TS_FILES = ["**/*.ts"];
2323
const JS_TS_FILES = [...JS_FILES, ...TS_FILES];
2424

2525
export default defineConfig(
26-
{
27-
ignores: [
28-
"**/*.snap",
29-
".eslint-doc-generatorrc.js",
30-
"coverage",
31-
"docs/rules/*/*.ts",
32-
"lib",
33-
"node_modules",
34-
"pnpm-lock.yaml",
35-
"src/tests/__fixtures__",
36-
],
37-
},
26+
globalIgnores([
27+
"**/*.snap",
28+
".eslint-doc-generatorrc.js",
29+
"coverage",
30+
"docs/rules/*/*.ts",
31+
"lib",
32+
"node_modules",
33+
"pnpm-lock.yaml",
34+
"src/tests/__fixtures__",
35+
]),
3836
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
3937
{
4038
extends: [
4139
eslint.configs.recommended,
42-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/214
40+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4341
comments.recommended,
4442
eslintPlugin.configs.recommended,
4543
n.configs["flat/recommended"],
46-
perfectionist.configs["recommended-natural"],
44+
perfectionist.configs?.["recommended-natural"],
4745
regexp.configs["flat/recommended"],
4846
unicorn.configs.unopinionated,
4947
],
@@ -124,7 +122,7 @@ export default defineConfig(
124122
files: JS_TS_FILES,
125123
languageOptions: {
126124
parserOptions: {
127-
projectService: { allowDefaultProject: ["*.config.*s"] },
125+
projectService: { allowDefaultProject: ["*.config.js"] },
128126
tsconfigRootDir: import.meta.dirname,
129127
},
130128
},

β€Žtsconfig.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"target": "ES2024",
1212
"rewriteRelativeImportExtensions": true
1313
},
14-
"include": ["src"]
14+
"include": ["src", "*.config.ts"]
1515
}

β€Žvitest.config.tsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default defineConfig({
44
test: {
55
clearMocks: true,
66
coverage: {
7-
all: true,
87
exclude: ["lib", "src/index.ts", "src/rules/index.ts", "src/tests"],
98
include: ["src"],
109
reporter: ["html", "lcov", "text"],

0 commit comments

Comments
Β (0)