-
Notifications
You must be signed in to change notification settings - Fork 34
/
eslint.config.js
103 lines (102 loc) · 2.18 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const globals = require("globals");
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,
"unicorn/expiring-todo-comments": "off",
},
},
// 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,
"unicorn/import-style": [
"error",
{
styles: {
"node:path": {
named: true,
},
},
},
],
},
},
{
files: ["packages/gatsby-source-strapi/**/*.js"],
rules: {
"no-undef": "error",
"no-unused-vars": "error",
},
languageOptions: {
globals: {
...globals.node,
},
},
},
];