-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
76 lines (76 loc) · 2.1 KB
/
.eslintrc.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
module.exports = {
root: true,
env: {
es2020: true, // Node.JS v14 supports es2020, v15 required for es2021
node: true,
},
extends: [
"eslint:recommended",
"plugin:prettier/recommended", // This must be last plugin
],
rules: {
// In Express, an error middleware is differentiated from a normal
// middleware by the function taking 4 arguments rather than 3 arguments
// --> last next argument is unused
"no-unused-vars": ["warn", { argsIgnorePattern: "next" }],
// Use warn instead of error for prettier issues
"prettier/prettier": "warn",
"no-console": "warn",
},
overrides: [
{
files: ["jest.setup.js"],
parserOptions: {
sourceType: "module",
},
},
{
files: "client/**/*.test.js",
globals: {
React: true,
shallow: true,
fetch: true,
},
},
{
files: "client/**/*.js",
parser: "@babel/eslint-parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
jest: true,
},
globals: {
cloudinary: true, // Cloudinary widget loaded in app.pug
},
extends: [
"plugin:import/recommended",
"plugin:react/recommended", // General React linting
"plugin:react-hooks/recommended", // React hooks linting
"plugin:jsx-a11y/recommended", // Accessibility linting
],
rules: {
"react/jsx-uses-vars": "warn",
"react/jsx-uses-react": "warn",
// Disable rule because named export is commonly used as default export.
// This is because e.g. `export default withTranslation()(FeedPanel);`
// is imported as FeedPanel.
"import/no-named-as-default": "off",
// Need to create alt texts and translations before this can be enabled
"jsx-a11y/alt-text": "off",
// Link tags are styled as button, needs refractoring
"jsx-a11y/anchor-is-valid": "off",
},
},
],
};