Skip to content

Commit 8a186ec

Browse files
authored
build: convert eslint.config to typescript and add our plugin (#1112)
<!-- πŸ‘‹ 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 - [x] Addresses an existing open issue: fixes #1099 - [x] 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 ## Overview This change migrates the eslint config to typescript, and adds our plugin's recommended config. Tested locally to verify our plugin is working as expected. (This'll be great as an e2e smoke test) ![screenshot](https://github.com/user-attachments/assets/e745417f-3520-4b8e-bdf0-079dbc3e6152)
1 parent fa2e195 commit 8a186ec

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import * as regexp from "eslint-plugin-regexp";
1111
import yml from "eslint-plugin-yml";
1212
import tseslint from "typescript-eslint";
1313

14+
import packageJson from "./src/index.js";
15+
1416
export default tseslint.config(
1517
{
1618
ignores: [
@@ -26,7 +28,9 @@ export default tseslint.config(
2628
},
2729
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
2830
eslint.configs.recommended,
31+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access -- https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/214
2932
comments.recommended,
33+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access -- https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/487
3034
eslintPlugin.configs["flat/recommended"],
3135
jsdoc.configs["flat/contents-typescript-error"],
3236
jsdoc.configs["flat/logical-typescript-error"],
@@ -111,4 +115,8 @@ export default tseslint.config(
111115
"n/no-unsupported-features/node-builtins": "off",
112116
},
113117
},
118+
{
119+
extends: [packageJson.configs.recommended],
120+
files: ["package.json"],
121+
},
114122
);

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"eslint-plugin-regexp": "2.9.0",
8282
"eslint-plugin-yml": "1.18.0",
8383
"husky": "9.1.7",
84+
"jiti": "^2.4.2",
8485
"jsonc-eslint-parser": "2.4.0",
8586
"knip": "5.60.0",
8687
"lint-staged": "16.1.0",

β€Žpnpm-lock.yamlβ€Ž

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žsrc/tests/index.test.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe("configs", () => {
1010
const eslint = new ESLint({
1111
baseConfig: plugin.configs.recommended as Linter.Config,
1212
fix: true,
13+
overrideConfigFile: true,
1314
});
1415
const code = await readFile(
1516
resolve(import.meta.filename, "../../../package.json"),

0 commit comments

Comments
Β (0)