forked from gatsby-uc/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
79 lines (78 loc) · 1.71 KB
/
eslint.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
const ts_parser = require("@typescript-eslint/parser");
const babel_parser = require("@babel/eslint-parser");
const unicorn = require("eslint-plugin-unicorn");
const prettier = require("eslint-config-prettier");
const react = require("eslint-plugin-react");
const typescript = require("@typescript-eslint/eslint-plugin");
module.exports = [
// "eslint:recomended",
{
ignores: ["**/dist", "**/*.config.js", "**/coverage"],
},
{
plugins: {
unicorn,
prettier,
},
rules: {
...prettier.rules,
...unicorn.configs.recommended.rules,
},
},
// For some reason when plugins are inside a theme, the index.js is required. This allows us to add empty index.js files in all plugins.
{
files: ["packages/*/index.js"],
rules: {
"unicorn/no-empty-file": "off",
},
},
{
files: ["packages/*/gatsby-*.js"],
languageOptions: {
sourceType: "commonjs",
},
rules: {
"unicorn/prefer-module": "off",
},
},
{
files: ["packages/**/*.js"],
settings: {
react: {
version: "18",
},
},
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: babel_parser,
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
jsx: true,
},
babelOptions: {
presets: ["@babel/preset-react"],
},
},
},
rules: {
...react.configs.recommended.rules,
},
plugins: {
react,
},
},
{
files: ["packages/**/*.ts"],
languageOptions: {
parser: ts_parser,
},
plugins: {
"@typescript-eslint": typescript,
},
rules: {
...typescript.configs.recommended.rules,
},
},
];