-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
120 lines (109 loc) · 2.95 KB
/
index.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
112
113
114
115
116
117
118
119
120
const appRoot = require("app-root-dir").get()
const existsSync = require("fs").existsSync
const join = require("path").join
const hasGraphQL = existsSync(join(appRoot, ".graphqlconfig"))
/* eslint-disable import/no-commonjs */
module.exports = {
extends: [
"./rules/basics.yml",
"./rules/cssmodules.yml",
"./rules/docs.yml",
"./rules/filenames.yml",
hasGraphQL ? "./rules/graphql.yml" : null,
"./rules/import.yml",
"./rules/jsx-a11y.yml",
"./rules/modern.yml",
"./rules/promise.yml",
"./rules/quality.yml",
"./rules/react.yml",
"./rules/style.yml"
].filter(Boolean),
overrides:
[
{
files: [
// Dot files
".*.js",
// Cosmiconfig files
"**/*.config.*.js"
],
env: {
node: true
},
rules: {
// Allow commonjs in these typically non-transpiled files
"import/no-commonjs": "off"
}
},
// Relax some settings for Storybook files
{
files: [
"**/*.story.js"
],
rules: {
// Don't enforce usage of translation features inside Stories
"react/jsx-no-literals": "off"
}
},
// Automatically tweak for test related files
{
files: [
// Typical approach for central test files
"**/__tests__/**/*.js",
// Typical approach for co-located test files
"**/*.spec.js",
"**/*.test.js"
],
env: {
jest: true
},
rules: {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/no-jasmine-globals": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
"jest/prefer-to-be-null": "warn",
"jest/prefer-to-be-undefined": "warn",
"jest/no-large-snapshots": [
"warn", { maxSize: 50 }
],
// The otherwise useful concept to let all then-blocks return something
// is often not required in tests where this mainly functions as an async helper.
"promise/always-return": "off",
// File names in tests typically follow other conversations
"filenames/match-regex": "off"
}
},
// Auto enable node environment for files inside "client", "browser" or "web" folders.
{
files: [
"**/client/**/*.js",
"**/browser/**/*.js",
"**/web/**/*.js"
],
env: {
browser: true,
node: false
}
},
// Auto enable node environment for files inside "server", "node" or "cli" folders.
{
files: [
"**/server/**/*.js",
"**/node/**/*.js",
"**/cli/**/*.js"
],
env: {
node: true,
browser: false
},
rules: {
// This is super useful for browser development as it uses `browserslist`.
// Unfortunately this does not offer any support for NodeJS.
"compat/compat": "off"
}
}
]
}