forked from aruzikulov/platform-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
78 lines (74 loc) · 2.06 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
const tsConfig = require("./tsconfig.json");
const config = require("@neufund/eslint-config");
/**
* Plugin and parser resolution has been updated in ESLint 7.0 therefore it's not longer compatible
* with out monorepo given typescript version is not in sync in monorepo
* @see https://eslint.org/docs/user-guide/migrating-to-7.0.0#plugin-resolution-has-been-updated
*/
const eslint7Patch = {
parser: config.parser,
plugins: config.plugins,
};
module.exports = {
...eslint7Patch,
root: true,
extends: "@neufund/eslint-config/react-native",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json", "./tsconfig.*.json"],
},
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "react-native",
importNames: ["Platform"],
message: `Please use Platform from "utils/Platform" instead to have better type-safety.`,
},
],
},
],
"@typescript-eslint/no-magic-numbers": [
"error",
{
ignore: [0, 0.5, 1, 2, 3, 4, 10],
ignoreEnums: true,
ignoreNumericLiteralTypes: true,
ignoreReadonlyClassProperties: true,
},
],
"import/order": [
"error",
{
groups: [
["builtin", "external"],
["internal", "parent", "sibling", "index"],
],
"newlines-between": "always",
alphabetize: {
order: "asc",
},
pathGroups: Object.keys(tsConfig.compilerOptions.paths).map(path => ({
// e.g. "assets/*" => "assets/**"
pattern: `${path}*`,
group: "external",
position: "after",
})),
pathGroupsExcludedImportTypes: ["builtin"],
},
],
"import/no-relative-parent-imports": "error",
},
overrides: [
{
files: ["**/*.stories.*", "**/*.spec.*", "**/e2e/**"],
rules: {
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
},
},
],
};