-
-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy patheslint.base.config.mjs
More file actions
102 lines (97 loc) · 2.94 KB
/
eslint.base.config.mjs
File metadata and controls
102 lines (97 loc) · 2.94 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
91
92
93
94
95
96
97
98
99
100
101
102
// This file is only used in `./eslint.config.js` and in the tests – it’s not part
// of the eslint-config-prettier npm package.
//
// NOTE: Keep this file in sync with `./.eslintrc.base.js`!
import { createRequire } from "node:module";
import babelNew from "@babel/eslint-plugin";
import { fixupPluginRules } from "@eslint/compat";
import stylistic from "@stylistic/eslint-plugin";
import stylisticJs from "@stylistic/eslint-plugin-js";
import stylisticJsx from "@stylistic/eslint-plugin-jsx";
import stylisticTs from "@stylistic/eslint-plugin-ts";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import standard from "eslint-plugin-standard";
import babelOld from "eslint-plugin-babel";
import flowtype from "eslint-plugin-flowtype";
import google from "eslint-config-google";
import prettier from "eslint-plugin-prettier/recommended";
import react from "eslint-plugin-react";
import unicorn from "eslint-plugin-unicorn";
import vue from "eslint-plugin-vue";
import globals from "globals";
import eslintrcBase from "./.eslintrc.base.js";
const require = createRequire(import.meta.url);
export default [
{
ignores: require("./package.json").eslintIgnore,
},
{
// TODO: Figure out how to get flowtype running in flat config.
ignores: ["test-lint/flowtype.js"],
},
google,
{
plugins: {
"@typescript-eslint": typescriptEslint,
"babel": babelOld,
"@babel": babelNew,
"@stylistic": stylistic,
"@stylistic/js": stylisticJs,
"@stylistic/jsx": stylisticJsx,
"@stylistic/ts": stylisticTs,
"flowtype": fixupPluginRules(flowtype),
standard,
},
},
{
rules: flowtype.configs.recommended.rules,
settings: flowtype.configs.recommended.settings,
},
prettier,
unicorn.configs["flat/recommended"],
...vue.configs["flat/base"],
...vue.configs["flat/essential"],
...vue.configs["flat/strongly-recommended"],
...vue.configs["flat/recommended"],
{
languageOptions: {
...eslintrcBase.parserOptions,
globals: {
...globals.es6,
...globals.node,
},
},
rules: eslintrcBase.rules,
settings: eslintrcBase.settings,
},
...eslintrcBase.overrides
.filter(({ parser, parserOptions }) => parser || parserOptions)
.map(({ parser, parserOptions, ...override }) => ({
...override,
languageOptions: parser
? { parser: require(parser), ...parserOptions }
: parserOptions,
})),
{
files: ["test-lint/react.js"],
...react.configs.flat.all,
rules: {
...react.configs.flat.all.rules,
"react/jsx-filename-extension": "off",
"react/jsx-no-bind": "off",
},
},
{ files: ["test-lint/@stylistic.js"], ...stylistic.configs.all },
{
files: ["test-lint/@stylistic__js.js"],
...stylisticJs.configs.all,
},
{
files: ["test-lint/@stylistic__jsx.jsx"],
...stylisticJsx.configs.all,
},
{
files: ["test-lint/@stylistic__ts.ts"],
...stylisticTs.configs.all,
},
];