forked from unkn-wn/boilerclasses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
65 lines (61 loc) · 1.82 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";
import tseslint from "typescript-eslint";
import { FlatCompat } from "@eslint/eslintrc";
import { fileURLToPath } from "url";
import path from "path";
//https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname
});
const commonRules = {
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_[^_].*$|^_$",
"varsIgnorePattern": "^_[^_].*$|^_$",
"caughtErrorsIgnorePattern": "^_[^_].*$|^_$"
}
]
};
const common = {rules: commonRules};
export default [
...tseslint.config({
files: ["client/**/*.{ts,tsx,js,jsx}", "shared/**/*.ts"],
extends: [
pluginReact.configs.flat.recommended,
...compat.extends("plugin:react-hooks/recommended"),
pluginJs.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...compat.extends("plugin:@next/next/recommended"),
common
],
settings: {
next: { rootDir: "client" },
react: { version: "detect" }
},
languageOptions: {
globals: {...globals.browser, ...globals.node},
parserOptions: { projectService: true },
}
}, {
files: ["server/scripts/**.{ts,js}", "shared/*.ts"],
extends: [
pluginJs.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
common
],
languageOptions: {
globals: globals.node,
parserOptions: { projectService: true },
}
}, {
ignores: ["client/.next", "client/public/"]
})
];