forked from FormidableLabs/victory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
114 lines (113 loc) · 3.27 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
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
const path = require("path");
const BABEL_PATH = path.resolve(__dirname, ".babelrc.js"); // eslint-disable-line no-undef
module.exports = {
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".ts", ".tsx"],
},
},
},
extends: [
"formidable/configurations/es6-react",
"plugin:react-hooks/recommended",
"plugin:eslint-comments/recommended",
"prettier",
],
rules: {
"eslint-comments/disable-enable-pair": "off",
"func-style": "off",
"arrow-body-style": "off",
"consistent-return": "off", // we're migrating to TS and this is more properly handled there.
"react/sort-comp": "off",
"import/no-unresolved": ["error", { ignore: ["victory*"] }],
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["victory*/src", "victory*/src/**"],
message:
"Be sure to import directly from Victory packages, not from /src folders!",
},
],
},
],
"max-statements": "off",
complexity: ["error", { max: 16 }],
"no-magic-numbers": [
"error",
{ ignore: [-1, 0, 0.5, 1, 2, 90, 180, 270, 360] },
],
},
parser: "@babel/eslint-parser",
parserOptions: {
babelOptions: {
configFile: BABEL_PATH,
},
},
plugins: ["jest"],
env: {
"jest/globals": true,
},
overrides: [
{
files: ["**/*.test.*", "./test/**/*"],
rules: {
"react/sort-comp": "off",
"no-magic-numbers": "off",
"max-statements": "off",
"import/no-unresolved": "off",
"no-undef": "off",
"max-nested-callbacks": "off",
"@typescript-eslint/no-empty-function": "off",
"react/prop-types": "off",
},
},
{
files: ["*.ts", "*.tsx"],
excludedFiles: ["*.d.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.base.json"],
// eslint-disable-next-line no-undef
tsconfigRootDir: __dirname,
},
plugins: ["@typescript-eslint"],
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
rules: {
"no-use-before-define": "off",
"valid-jsdoc": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{
// Relax this rule; still prevents errors:
variables: false,
classes: false,
functions: false,
enums: false,
typedefs: false,
},
],
"no-invalid-this": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/restrict-plus-operands": "off",
},
},
],
};