chore: add unified ESLint config for TS, Astro, and JSX
- 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
This commit is contained in:
parent
398bfcbb11
commit
e4d551a551
1 changed files with 64 additions and 0 deletions
64
eslint.config.js
Normal file
64
eslint.config.js
Normal file
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue