88 lines
2.0 KiB
JavaScript
88 lines
2.0 KiB
JavaScript
// @ts-check
|
|
|
|
import pluginJs from "@eslint/js";
|
|
import next from "@next/eslint-plugin-next";
|
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
import markdown from "eslint-plugin-markdown";
|
|
import react from "eslint-plugin-react";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import globals from "globals";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
const reactConfigs = tseslint.config(
|
|
{
|
|
files: ["**/*.{jsx,tsx}"],
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.{jsx,tsx}"],
|
|
languageOptions: {
|
|
parserOptions: react.configs["jsx-runtime"].parserOptions,
|
|
},
|
|
plugins: {
|
|
react: /** @type {import('eslint').ESLint.Plugin} */ (react),
|
|
},
|
|
rules: {
|
|
...react.configs.flat.recommended.rules,
|
|
...react.configs.flat["jsx-runtime"].rules,
|
|
"react/display-name": "off",
|
|
"react/no-unstable-nested-components": "warn",
|
|
"react/prop-types": "off",
|
|
},
|
|
},
|
|
reactHooks.configs["recommended-latest"],
|
|
);
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [".next/", "coverage/"],
|
|
},
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.serviceworker,
|
|
...globals.browser,
|
|
},
|
|
parserOptions: {
|
|
ecmaVersion: "latest",
|
|
project: true,
|
|
sourceType: "module",
|
|
},
|
|
},
|
|
},
|
|
pluginJs.configs.recommended,
|
|
...markdown.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
...tseslint.configs.stylistic,
|
|
...reactConfigs,
|
|
jsxA11y.flatConfigs.strict,
|
|
{
|
|
plugins: {
|
|
'@next/next': next,
|
|
},
|
|
rules: {
|
|
...next.configs.recommended.rules,
|
|
...next.configs['core-web-vitals'].rules,
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{
|
|
args: 'all',
|
|
argsIgnorePattern: '^_',
|
|
caughtErrors: 'all',
|
|
caughtErrorsIgnorePattern: '^_',
|
|
destructuredArrayIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
}
|
|
}
|
|
); |