96 lines
2.4 KiB
JavaScript
96 lines
2.4 KiB
JavaScript
import typescriptParser from "@typescript-eslint/parser";
|
|
import {defineConfig} from "eslint/config";
|
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
import nextTs from "eslint-config-next/typescript";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
import reactRefreshPlugin from "eslint-plugin-react-refresh";
|
|
import globals from "globals";
|
|
|
|
import baseConfig from "./base.mjs";
|
|
|
|
const config = defineConfig([
|
|
// Next.js configs - handle both array and object formats
|
|
...(Array.isArray(nextVitals) ? nextVitals : [nextVitals]),
|
|
...(Array.isArray(nextTs) ? nextTs : [nextTs]),
|
|
...baseConfig,
|
|
{
|
|
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.es2025,
|
|
},
|
|
parser: typescriptParser,
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: {
|
|
react: reactPlugin,
|
|
"react-hooks": reactHooksPlugin,
|
|
"react-refresh": reactRefreshPlugin,
|
|
},
|
|
rules: {
|
|
"@next/next/no-html-link-for-pages": "off",
|
|
"@next/next/no-img-element": "off",
|
|
"no-console": "off",
|
|
"react-hooks/exhaustive-deps": "off",
|
|
"react-refresh/only-export-components": "off",
|
|
"react/jsx-boolean-value": [
|
|
"error",
|
|
"never",
|
|
{
|
|
always: ["personal"],
|
|
},
|
|
],
|
|
"react/jsx-curly-brace-presence": [
|
|
"error",
|
|
{
|
|
children: "never",
|
|
props: "never",
|
|
},
|
|
],
|
|
"react/jsx-no-leaked-render": [
|
|
"error",
|
|
{
|
|
validStrategies: ["coerce", "ternary"],
|
|
},
|
|
],
|
|
"react/jsx-sort-props": [
|
|
"error",
|
|
{
|
|
callbacksLast: true,
|
|
ignoreCase: true,
|
|
locale: "auto",
|
|
multiline: "last",
|
|
noSortAlphabetically: false,
|
|
reservedFirst: true,
|
|
shorthandFirst: true,
|
|
shorthandLast: false,
|
|
},
|
|
],
|
|
"react/jsx-uses-react": "off",
|
|
"react/no-unescaped-entities": "off",
|
|
"react/prop-types": "off",
|
|
"react/react-in-jsx-scope": "off",
|
|
"react/self-closing-comp": [
|
|
"error",
|
|
{
|
|
component: true,
|
|
html: true,
|
|
},
|
|
],
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
},
|
|
},
|
|
]);
|
|
|
|
export default config;
|