-
-
Notifications
You must be signed in to change notification settings - Fork 256
/
Copy patheslint.base.config.js
111 lines (108 loc) · 3.1 KB
/
eslint.base.config.js
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
103
104
105
106
107
108
109
110
111
"use strict";
// 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`!
const fs = require("fs");
const path = require("path");
const babelOld = require("eslint-plugin-babel");
const babelNew = require("@babel/eslint-plugin");
const flowtype = require("eslint-plugin-flowtype");
const globals = require("globals");
const google = require("eslint-config-google");
const prettier = require("eslint-plugin-prettier");
const react = require("eslint-plugin-react");
const standard = require("eslint-plugin-standard");
const stylistic = require("@stylistic/eslint-plugin");
const stylisticJs = require("@stylistic/eslint-plugin-js");
const stylisticTs = require("@stylistic/eslint-plugin-ts");
const stylisticJsx = require("@stylistic/eslint-plugin-jsx");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const unicorn = require("eslint-plugin-unicorn");
const vue = require("eslint-plugin-vue");
const vueParser = require("vue-eslint-parser");
const eslintrcBase = require("./.eslintrc.base");
module.exports = [
{
ignores: fs
.readFileSync(path.join(__dirname, ".eslintignore"), "utf8")
.trim()
.split("\n"),
},
{
// 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/ts": stylisticTs,
"@stylistic/jsx": stylisticJsx,
flowtype,
prettier,
react,
standard,
unicorn,
vue,
},
},
{
rules: flowtype.configs.recommended.rules,
settings: flowtype.configs.recommended.settings,
},
{
rules: react.configs.all.rules,
},
{
rules: unicorn.configs.recommended.rules,
},
{
languageOptions: {
ecmaVersion: eslintrcBase.parserOptions.ecmaVersion,
sourceType: eslintrcBase.parserOptions.sourceType,
globals: {
...globals.es6,
...globals.node,
},
},
rules: eslintrcBase.rules,
settings: eslintrcBase.settings,
},
{
files: ["**/*.vue"],
processor: vue.processors[".vue"],
languageOptions: {
parser: vueParser,
},
rules: {
...vue.configs.base.rules,
...vue.configs.essential.rules,
...vue.configs["strongly-recommended"].rules,
...vue.configs.recommended.rules,
},
},
...eslintrcBase.overrides
.filter(({ parserOptions }) => parserOptions)
.map(({ parserOptions, ...override }) => ({
...override,
languageOptions: { parser: require(parserOptions.parser) },
})),
{ files: ["test-lint/@stylistic.js"], ...stylistic.configs["all-flat"] },
{
files: ["test-lint/@stylistic__js.js"],
...stylisticJs.configs["all-flat"],
},
{
files: ["test-lint/@stylistic__jsx.jsx"],
...stylisticJsx.configs["all-flat"],
},
{
files: ["test-lint/@stylistic__ts.ts"],
...stylisticTs.configs["all-flat"],
},
];