From e4d551a5514404b86674773dab202e4fa06d157a Mon Sep 17 00:00:00 2001 From: Daisuke Date: Wed, 31 Dec 2025 21:01:21 +0900 Subject: [PATCH] chore: add unified ESLint config for TS, Astro, and JSX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Introduce eslint.config.js with flat‑config structure - Enable TypeScript linting using @typescript-eslint parser and plugin - Add Astro parser/plugin with recommended rules - Configure React/Preact JSX linting including react-hooks rules - Apply project-aware parserOptions for TypeScript --- eslint.config.js | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..2a8acfe --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,64 @@ +// eslint.config.js +import js from "@eslint/js"; +import tseslint from "@typescript-eslint/eslint-plugin"; +import tsParser from "@typescript-eslint/parser"; +import astroPlugin from "eslint-plugin-astro"; +import astroParser from "astro-eslint-parser"; +import reactPlugin from "eslint-plugin-react"; +import reactHooks from "eslint-plugin-react-hooks"; + +export default [ + js.configs.recommended, + + // TypeScript + { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: tsParser, + parserOptions: { + project: "./tsconfig.json", + }, + }, + plugins: { + "@typescript-eslint": tseslint, + }, + rules: { + ...tseslint.configs.recommended.rules, + }, + }, + + // Astro + { + files: ["**/*.astro"], + languageOptions: { + parser: astroParser, + parserOptions: { + parser: tsParser, + }, + }, + plugins: { + astro: astroPlugin, + }, + rules: { + ...astroPlugin.configs.recommended.rules, + }, + }, + + // JSX / Preact + { + files: ["**/*.jsx", "**/*.tsx"], + plugins: { + react: reactPlugin, + "react-hooks": reactHooks, + }, + rules: { + ...reactPlugin.configs.recommended.rules, + ...reactHooks.configs.recommended.rules, + }, + settings: { + react: { + version: "detect", + }, + }, + }, +];