From 37429f4a9dea36b6f78686b3fd340a172ce02876 Mon Sep 17 00:00:00 2001 From: sota1235 Date: Sun, 25 Aug 2024 15:12:27 +0900 Subject: [PATCH 1/3] fix: improve types --- package-lock.json | 2 ++ package.json | 3 ++- src/base.js | 3 +-- src/react.js | 2 +- src/typescript.js | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5e4d445..b5cc1be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "typescript-eslint": "8.2.0" }, "devDependencies": { + "@types/eslint": "9.6.0", "prettier": "^3.0.0", "typescript": "^5.0.0" }, @@ -198,6 +199,7 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.0.tgz", "integrity": "sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==", + "license": "MIT", "dependencies": { "@types/estree": "*", "@types/json-schema": "*" diff --git a/package.json b/package.json index 106cb00..c7f7192 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@types/eslint__js": "8.42.3", "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", - "eslint": "9.9.0", + "eslint": ">= 9", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", "eslint-plugin-react": "^7.35.0", @@ -29,6 +29,7 @@ "typescript-eslint": "8.2.0" }, "devDependencies": { + "@types/eslint": "9.6.0", "prettier": "^3.0.0", "typescript": "^5.0.0" }, diff --git a/src/base.js b/src/base.js index 6d55f0c..9e2ba15 100644 --- a/src/base.js +++ b/src/base.js @@ -3,8 +3,7 @@ import prettier from "eslint-plugin-prettier/recommended"; import globals from "globals"; /** - * @param { { tsconfigPath?: string } } options - * @return { import("eslint").Linter.FlatConfig[] } + * @return { import("eslint").Linter.Config[] } */ export default () => [ eslint.configs.recommended, diff --git a/src/react.js b/src/react.js index ea7be2f..bbee121 100644 --- a/src/react.js +++ b/src/react.js @@ -3,7 +3,7 @@ import react from "eslint-plugin-react"; import globals from "globals"; /** - * @return { import("eslint").Linter.FlatConfig[] } + * @return { import("eslint").Linter.Config[] } */ export default () => [ ...base(), diff --git a/src/typescript.js b/src/typescript.js index 31cf38a..9bab00b 100644 --- a/src/typescript.js +++ b/src/typescript.js @@ -4,7 +4,7 @@ import base from "./base.js"; /** * @param { { tsconfigPath?: string } } options - * @return { import("eslint").Linter.FlatConfig[] } + * @return { import("eslint").Linter.Config[] } */ export default ({ tsconfigPath = "./tsconfig.json" }) => [ ...base(), From 37bb5e155ac13fe9fbac5ff8aeb5037b2bd994a7 Mon Sep 17 00:00:00 2001 From: sota1235 Date: Sun, 25 Aug 2024 15:17:55 +0900 Subject: [PATCH 2/3] modify: add @ts-check comment --- package-lock.json | 4 ++-- package.json | 2 +- src/base.js | 1 + src/index.js | 4 ++++ src/react.js | 1 + src/typescript.js | 1 + 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b5cc1be..28dfdf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@types/eslint__js": "8.42.3", "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", - "eslint": "9.9.0", + "eslint": ">= 9", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", "eslint-plugin-react": "^7.35.0", @@ -23,7 +23,7 @@ "devDependencies": { "@types/eslint": "9.6.0", "prettier": "^3.0.0", - "typescript": "^5.0.0" + "typescript": "5.5.4" }, "peerDependencies": { "eslint": ">= 9" diff --git a/package.json b/package.json index c7f7192..4ea64a4 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@types/eslint": "9.6.0", "prettier": "^3.0.0", - "typescript": "^5.0.0" + "typescript": "5.5.4" }, "peerDependencies": { "eslint": ">= 9" diff --git a/src/base.js b/src/base.js index 9e2ba15..a40ec27 100644 --- a/src/base.js +++ b/src/base.js @@ -1,3 +1,4 @@ +// @ts-check import eslint from "@eslint/js"; import prettier from "eslint-plugin-prettier/recommended"; import globals from "globals"; diff --git a/src/index.js b/src/index.js index d554555..286add8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,11 @@ +// @ts-check import base from "./base.js"; import typescript from "./typescript.js"; import react from "./react.js"; +/** + * @return { import("eslint").Linter.Config[] } + */ export const configs = { base, typescript, diff --git a/src/react.js b/src/react.js index bbee121..0d697b8 100644 --- a/src/react.js +++ b/src/react.js @@ -1,3 +1,4 @@ +// @ts-check import base from "./base.js"; import react from "eslint-plugin-react"; import globals from "globals"; diff --git a/src/typescript.js b/src/typescript.js index 9bab00b..0ed808a 100644 --- a/src/typescript.js +++ b/src/typescript.js @@ -1,3 +1,4 @@ +// @ts-check import tseslint from "typescript-eslint"; import tsPlugin from "@typescript-eslint/eslint-plugin"; import base from "./base.js"; From 0b850d5efbd84e85e6bd7aaa440f376e6f90502f Mon Sep 17 00:00:00 2001 From: sota1235 Date: Sun, 25 Aug 2024 15:18:53 +0900 Subject: [PATCH 3/3] modify: remove unnecessary package --- package-lock.json | 3 ++- package.json | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28dfdf6..ee55421 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", "eslint": ">= 9", - "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", "eslint-plugin-react": "^7.35.0", "globals": "^15.9.0", @@ -1072,6 +1071,8 @@ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "license": "MIT", + "optional": true, + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, diff --git a/package.json b/package.json index 4ea64a4..e20a70d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "src/index.js", "type": "module", "scripts": { - "lint": "eslint", + "lint": "eslint .", "lint:fix": "npm run lint -- --fix", "format": "npm run lint:fix && prettier . --write" }, @@ -22,7 +22,6 @@ "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", "eslint": ">= 9", - "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", "eslint-plugin-react": "^7.35.0", "globals": "^15.9.0",