Files
sam-react-prod/eslint.config.mjs

83 lines
2.1 KiB
JavaScript
Raw Normal View History

import js from "@eslint/js";
import nextPlugin from "@next/eslint-plugin-next";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
const eslintConfig = [
{
ignores: [
".next/**",
"out/**",
"build/**",
"dist/**",
"node_modules/**",
"next-env.d.ts",
],
},
js.configs.recommended,
{
files: ["**/*.{js,jsx,mjs}"],
plugins: {
"@next/next": nextPlugin,
"react": reactPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
},
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
globals: {
React: "readonly",
console: "readonly",
process: "readonly",
__dirname: "readonly",
__filename: "readonly",
Buffer: "readonly",
localStorage: "readonly",
window: "readonly",
document: "readonly",
HTMLButtonElement: "readonly",
HTMLInputElement: "readonly",
fetch: "readonly",
URL: "readonly",
RequestInit: "readonly",
Response: "readonly",
PageTransitionEvent: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
"@next/next": nextPlugin,
"react": reactPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
...tseslint.configs.recommended.rules,
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}],
},
},
];
export default eslintConfig;