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", + }, + }, + }, +];