- 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
64 lines
1.3 KiB
JavaScript
64 lines
1.3 KiB
JavaScript
// 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",
|
|
},
|
|
},
|
|
},
|
|
];
|