119 lines
2.9 KiB
JavaScript
119 lines
2.9 KiB
JavaScript
|
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
||
|
|
import importX from "eslint-plugin-import-x";
|
||
|
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
||
|
|
import prettier from "eslint-plugin-prettier/recommended";
|
||
|
|
import react from "eslint-plugin-react";
|
||
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
||
|
|
import globals from "globals";
|
||
|
|
import tseslint from "typescript-eslint";
|
||
|
|
|
||
|
|
export default tseslint.config(
|
||
|
|
{
|
||
|
|
files: ["resources/ts/**/*.{ts,tsx,js,jsx}"],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
ignores: [
|
||
|
|
"node_modules/**",
|
||
|
|
"public/**",
|
||
|
|
"vendor/**",
|
||
|
|
"packages/**",
|
||
|
|
"resources/ts/components/ui/**",
|
||
|
|
],
|
||
|
|
},
|
||
|
|
tseslint.configs.recommended,
|
||
|
|
tseslint.configs.strictTypeChecked,
|
||
|
|
tseslint.configs.stylisticTypeChecked,
|
||
|
|
{
|
||
|
|
languageOptions: {
|
||
|
|
globals: {
|
||
|
|
...globals.browser,
|
||
|
|
...globals.es2021,
|
||
|
|
...globals.node,
|
||
|
|
},
|
||
|
|
parserOptions: {
|
||
|
|
ecmaVersion: 2020,
|
||
|
|
sourceType: "module",
|
||
|
|
ecmaFeatures: { jsx: true },
|
||
|
|
projectService: true,
|
||
|
|
tsconfigRootDir: import.meta.dirname,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
...react.configs.flat.recommended,
|
||
|
|
...react.configs.flat["jsx-runtime"],
|
||
|
|
settings: {
|
||
|
|
react: { version: "19.0" },
|
||
|
|
},
|
||
|
|
rules: {
|
||
|
|
...react.configs.flat.recommended.rules,
|
||
|
|
...react.configs.flat["jsx-runtime"].rules,
|
||
|
|
"react/jsx-filename-extension": "off",
|
||
|
|
"react/prop-types": "off",
|
||
|
|
"react/require-default-props": "off",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
reactHooks.configs.flat.recommended,
|
||
|
|
{
|
||
|
|
plugins: { "jsx-a11y": jsxA11y },
|
||
|
|
rules: { ...jsxA11y.configs.recommended.rules },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
plugins: { "import-x": importX },
|
||
|
|
settings: {
|
||
|
|
"import-x/resolver-next": [
|
||
|
|
createTypeScriptImportResolver({
|
||
|
|
project: "./tsconfig.json",
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
},
|
||
|
|
rules: {
|
||
|
|
...importX.configs.recommended.rules,
|
||
|
|
...importX.configs.typescript.rules,
|
||
|
|
"import-x/extensions": [
|
||
|
|
"error",
|
||
|
|
"ignorePackages",
|
||
|
|
{ ts: "never", tsx: "never", js: "never", jsx: "never" },
|
||
|
|
],
|
||
|
|
"import-x/order": [
|
||
|
|
"error",
|
||
|
|
{
|
||
|
|
groups: [
|
||
|
|
"builtin",
|
||
|
|
"external",
|
||
|
|
"internal",
|
||
|
|
"parent",
|
||
|
|
"sibling",
|
||
|
|
"index",
|
||
|
|
],
|
||
|
|
"newlines-between": "always",
|
||
|
|
alphabetize: { order: "asc", caseInsensitive: true },
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
rules: {
|
||
|
|
"@typescript-eslint/no-unused-vars": [
|
||
|
|
"error",
|
||
|
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||
|
|
],
|
||
|
|
"@typescript-eslint/consistent-type-imports": [
|
||
|
|
"error",
|
||
|
|
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
|
||
|
|
],
|
||
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
rules: {
|
||
|
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
files: ["*.js", "*.ts", "*.cjs", "*.mjs"],
|
||
|
|
extends: [tseslint.configs.disableTypeChecked],
|
||
|
|
},
|
||
|
|
prettier,
|
||
|
|
);
|