-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy patheslint.config.js
More file actions
85 lines (83 loc) · 2.8 KB
/
Copy patheslint.config.js
File metadata and controls
85 lines (83 loc) · 2.8 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
// Flat config, replacing .eslintrc.json and .eslintignore.
//
// ESLint 9 no longer reads eslintrc files, and passing one via --config
// makes it try to `import` the JSON as a config module, which fails with
// ERR_IMPORT_ATTRIBUTE_MISSING. The rule set below is a direct
// translation of the previous .eslintrc.json.
import babelParser from "@babel/eslint-parser";
import importPlugin from "eslint-plugin-import";
import globals from "globals";
export default [
{
// Replaces .eslintignore, which ESLint 9 also ignores.
ignores: [
"build/**",
"coverage/**",
"src/docs/**",
"dist/**",
"test/**",
"node_modules/**",
// Both carry `"root": true` under eslintrc, so the cascade
// stopped there and the root rules never applied to them.
// Flat config has no cascade, so that exclusion is explicit
// here; they are linted by `lint:core` / `lint:web`.
"packages/core/**",
"src/ui/web/**",
],
},
importPlugin.flatConfigs.recommended,
{
files: ["*.js", "src/**/*.js"],
languageOptions: {
// `env: { es6: true, node: true }` has no flat-config equivalent;
// the globals it supplied come from the `globals` package instead.
ecmaVersion: 2020,
sourceType: "module",
parser: babelParser,
parserOptions: {
requireConfigFile: false,
},
globals: {
...globals.es2020,
...globals.node,
_: true,
},
},
rules: {
// chalk 6 dropped its `main` field in favour of conditional
// `exports`. eslint-plugin-import's node resolver reads `main`
// and not `exports`, so it reports a package that resolves
// perfectly well at runtime as unresolvable. Same `ignore`
// idiom the web config already uses for `^react$`.
"import/no-unresolved": [2, { ignore: ["^chalk$"] }],
camelcase: [1, { properties: "always" }],
"comma-dangle": 0,
"comma-spacing": [1, { before: false, after: true }],
curly: 2,
"dot-location": [2, "property"],
"eol-last": 2,
eqeqeq: 2,
indent: [2, 2, { SwitchCase: 1 }],
"key-spacing": [2, { beforeColon: false, afterColon: true }],
"keyword-spacing": 2,
"linebreak-style": 0,
"no-console": 0,
"no-irregular-whitespace": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [2, { max: 2 }],
"no-spaced-func": 2,
"no-trailing-spaces": 2,
"no-unexpected-multiline": 2,
"no-unused-vars": 2,
"no-use-before-define": [2, "nofunc"],
"operator-linebreak": [2, "after"],
quotes: [2, "double"],
semi: [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": "off",
"space-infix-ops": 0,
strict: [2, "global"],
"wrap-iife": [2, "inside"],
},
},
];