-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
96 lines (72 loc) · 2.7 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
const restrictedGlobals = require("confusing-browser-globals");
/** @type {import("eslint").Linter.Config} */
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:eslint-comments/recommended",
"plugin:unicorn/recommended",
"plugin:promise/recommended",
"plugin:jsx-a11y/recommended",
"airbnb",
"airbnb-typescript",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
"./extra",
],
settings: {
// Register `@/` as an import alias to `src/**/*`.
"import/resolver": {
alias: {
map: [['@', './src/']],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
overrides: [
// Custom overrides for Cypress.
{
files: ["cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}", "**/tests/e2e/**/*.{js,ts,jsx,tsx}"],
extends: ["plugin:cypress/recommended"],
},
],
rules: {
// Prefer to use named exports instead of default exports.
"import/prefer-default-export": "off",
// Prefer arrow-function when defining a React functional component.
"react/function-component-definition": [2, { "namedComponents": "arrow-function" }],
// Disable no props spreading React rule, as it"s a common pattern in React
// that can be used for very specific cases (e.g. atomic UI components).
"react/jsx-props-no-spreading": "off",
// Not needed since React v17.
"react/jsx-uses-react": "off",
// Honestly we don't use prop-types since we migrated to TypeScript.
"react/prop-types": "off",
// Not needed since React v17.
"react/react-in-jsx-scope": "off",
// Disable since we use TypeScript to do typechecking on our props.
"react/require-default-props": "off",
// Enable prettier rules.
"prettier/prettier": "error",
"promise/always-return": "warn",
// Especially with React component, we like to have all our functions inside the component
// function declaration, even if those functions can be scoped outside the component declaration.
"unicorn/consistent-function-scoping": "off",
// We can have some specific file-naming convention with React projects.
"unicorn/filename-case": "off",
// Let me use this syntax.
"unicorn/no-array-for-each": "off",
// We prefer to use null instead of undefined when a variable is meant to contain a value later.
"unicorn/no-null": "off",
// Conflict with anything that is TypeScript related, especially `env.d.ts`.
"unicorn/prevent-abbreviations": "off",
// Do not force destructuring.
"prefer-destructuring": "off",
// Avoid confusing globals.
"no-restricted-globals": ["error"].concat(restrictedGlobals),
},
};