-
-
Notifications
You must be signed in to change notification settings - Fork 253
/
eslint.base.config.js
88 lines (85 loc) · 2.33 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
"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 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,
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.map(({ parserOptions, ...override }) => ({
...override,
languageOptions: { parser: require(parserOptions.parser) },
})),
];