-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
149 lines (140 loc) · 5.13 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
const OFF = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
env: {
es6: true,
jest: true,
jasmine: true,
"shared-node-browser": true,
},
globals: {
fetch: true,
device: true,
element: true,
by: true,
Response: true,
},
extends: ["@react-native-community", "airbnb", "prettier", "prettier/react"],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["prettier", "react", "react-native-a11y", "unicorn"],
rules: {
"no-unused-vars": OFF,
"no-use-before-define": OFF,
"class-methods-use-this": OFF,
"no-nested-ternary": OFF,
"comma-dangle": [
ERROR,
{
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
},
],
"default-case": OFF,
eqeqeq: [ERROR, "always", {null: "ignore"}],
"max-classes-per-file": OFF,
"no-async-promise-executor": WARN,
"no-case-declarations": OFF,
"no-extra-boolean-cast": OFF,
"no-underscore-dangle": OFF,
"prefer-promise-reject-errors": OFF,
radix: WARN,
"sort-imports": OFF,
// eslint-plugin-import
"import/first": OFF,
"import/prefer-default-export": OFF,
"import/no-cycle": WARN,
"import/no-extraneous-dependencies": [
ERROR,
{
devDependencies: [
"**/{shell,config,storybook}/**", // nfl
"**/test/**", // tape, common npm pattern
"**/__stor{y,ies}__/**", // storybook
"**/story.{js,jsx}", // storybook
"**/tests/**", // also common npm pattern
"**/specs/**", // mocha, rspec-like pattern
"**/__{tests,snapshots}__/**", // jest pattern
"test.{js,jsx}", // repos with a single test file
"test-*.{js,jsx}", // repos with multiple top-level test files
"**/*.{test,spec}.{js,jsx}", // tests where the extension denotes that it is a test
"**/e2e/**", // detox e2e integration setup
"**/jest.config.js", // jest config
"**/webpack.config.js", // webpack config
"**/webpack.config.*.js", // webpack config
"**/rollup.config.js", // rollup config
"**/rollup.config.*.js", // rollup config
"**/gulpfile.js", // gulp config
"**/gulpfile.*.js", // gulp config
"**/Gruntfile{,.js}", // grunt config
"**/protractor.conf.js", // protractor config
"**/protractor.conf.*.js", // protractor config
"**/*.config.js", // React Native config
],
optionalDependencies: false,
},
],
"import/order": OFF,
// eslint-plugin-jsx-a11y
"jsx-a11y/accessible-emoji": OFF,
// eslint-plugin-react
"react/default-props-match-prop-types": OFF,
"react/no-children-prop": OFF,
"react/destructuring-assignment": OFF,
"react/no-unescaped-entities": OFF,
"react/no-unused-prop-types": OFF,
"react/jsx-boolean-value": OFF,
"react/jsx-filename-extension": OFF,
"react/jsx-props-no-spreading": OFF,
// Enforce props alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
"react/jsx-sort-props": [
ERROR,
{
ignoreCase: true,
callbacksLast: true,
shorthandFirst: true,
},
],
"react/require-default-props": OFF,
"react/sort-comp": OFF,
"react/state-in-constructor": OFF,
"react/static-property-placement": OFF,
"react-hooks/rules-of-hooks": WARN,
// eslint-plugin-react-native-a11y
"react-native-a11y/has-accessibility-props": WARN,
"react-native-a11y/has-valid-accessibility-component-type": WARN,
"react-native-a11y/has-valid-accessibility-traits": WARN,
"react-native-a11y/has-valid-important-for-accessibility": WARN,
"react-native-a11y/no-nested-touchables": WARN,
// eslint-plugin-prettier
"prettier/prettier": [
ERROR,
{
printWidth: 90,
tabWidth: 4,
singleQuote: false,
trailingComma: "es5",
bracketSpacing: false,
semi: true,
useTabs: false,
jsxBracketSameLine: false,
},
],
// eslint-plugin-unicorn
"unicorn/no-abusive-eslint-disable": ERROR,
// LEGACY
yoda: [ERROR, "never"],
"no-cond-assign": [ERROR, "except-parens"],
},
};