-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy patheslint.config.js
More file actions
90 lines (84 loc) · 2.07 KB
/
eslint.config.js
File metadata and controls
90 lines (84 loc) · 2.07 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const { FlatCompat } = require("@eslint/eslintrc");
const eslintJs = require("@eslint/js");
const globals = require("globals");
const osnConfig = require("@osn/eslint-config");
const nextCoreWebVitals = require("eslint-config-next/core-web-vitals");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: eslintJs.configs.recommended,
});
const nextAppFiles = [
"packages/next/**/*.{js,jsx}",
"packages/collectives-next/**/*.{js,jsx}",
"packages/kintsugi-next/**/*.{js,jsx}",
];
const nextCommonFiles = ["packages/next-common/**/*.{js,jsx}"];
const ignores = [
"**/node_modules/**",
"**/.next/**",
"**/.turbo/**",
"**/dist/**",
"**/.yalc/**",
];
const withFiles = (configs, files) =>
configs.map((config) => ({
...config,
files,
ignores: Array.from(new Set([...(config.ignores || []), ...ignores])),
}));
module.exports = [
{
ignores,
},
{
files: ["**/*.{js,jsx}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
},
},
},
...withFiles(
[].concat(nextCoreWebVitals),
nextAppFiles.concat(nextCommonFiles),
),
{
files: nextAppFiles,
rules: {
...osnConfig.rules,
"@next/next/no-img-element": "off",
"no-unused-vars": ["error", { argsIgnorePattern: "(^_|^req|^context)" }],
"react-hooks/set-state-in-effect": "off",
"react/react-in-jsx-scope": "off",
"import/no-anonymous-default-export": "off",
},
ignores,
},
...withFiles([eslintJs.configs.recommended], nextCommonFiles),
...withFiles(
compat.extends(
"plugin:react/recommended",
"plugin:react-hooks/recommended",
),
nextCommonFiles,
),
{
files: nextCommonFiles,
rules: {
...osnConfig.rules,
"react/prop-types": "off",
"react-hooks/set-state-in-effect": "off",
"react/react-in-jsx-scope": "off",
"import/no-anonymous-default-export": "off",
},
settings: {
react: {
version: "detect",
},
},
ignores,
},
];