forked from Path-Check/safeplaces-dct-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
85 lines (85 loc) · 3.69 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
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jest/recommended',
],
parser: 'babel-eslint',
plugins: ['react', 'react-hooks', 'react-native', 'detox'],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
modules: true,
},
},
env: {
commonjs: true,
es6: true,
'react-native/react-native': true,
'detox/detox': true,
node: true,
jest: true,
'jest/globals': true,
mocha: true,
},
settings: {
react: {
version: 'detect',
},
},
ignorePatterns: ['android/**', 'ios/**'],
rules: {
// 0 is for off, 1 is for warning, 2 is for error
'eol-last': 2, // Require file to end with single newline
'no-constant-condition': 2, // Disallow use of constant expressions in conditions
'no-dupe-keys': 2, // Disallow Duplicate Keys
'no-empty': 2, // Disallow Empty Block Statements
'no-extra-boolean-cast': 2, // Disallow Extra Boolean Casts
'no-prototype-builtins': 2, // Disallow use of Object.prototypes builtins directly
'no-undef': 2, // Disallow Undeclared Variables
'no-underscore-dangle': 2, // Disallow dangling underscores in identifiers
'no-unreachable': 2, // Disallow unreachable code after return, throw, continue, and break statements
'no-unused-vars': 2, // Disallow Unused Variables
'no-useless-escape': 2, // Disallow unnecessary escape usage
'no-console': 0, // disallow the use of console
'no-var': 2, // require let or const instead of var
strict: [2, 'global'], // require or disallow strict mode directives
'react-native/no-color-literals': 1, // Detect StyleSheet rules and inline styles containing color literals instead of variables
'react-native/no-inline-styles': 0, // For keeping styles away from the logic, we can switch it to 1 in future
'react-native/no-raw-text': ['error', { skip: ['Trans'] }], // This is to make sure everything is translated in the app
'react-native/no-unused-styles': 1, // Detect StyleSheet rules which are not used in your React components
'react/jsx-boolean-value': 2, // Enforce boolean attributes notation in JSX (fixable)
'react/jsx-key': 2, // Report missing key props in iterators/collection literals
'react/jsx-no-duplicate-props': 2, // Enforce no duplicate props
'react/jsx-no-undef': 2, // Disallow undeclared variables in JSX
'react/jsx-sort-props': 0, // Enforce props alphabetical sorting (fixable)
'react/jsx-wrap-multilines': 2, // Prevent missing parentheses around multilines JSX (fixable)
'react/no-deprecated': 1, // Prevent usage of deprecated methods
'react/no-did-mount-set-state': 1, // Prevent usage of setState in componentDidMount
'react/no-did-update-set-state': 1, // Prevent usage of setState in componentDidUpdate
'react/no-multi-comp': 0, // Prevent multiple component definition per file
'react/no-string-refs': 1, // Prevent string definitions for references and prevent referencing this.refs
'react/prop-types': 0, // Prevent missing props validation in a React component definition
'react/react-in-jsx-scope': 2, // Prevent missing React when using JSX
'react/self-closing-comp': 2, // Prevent extra closing tags for components without children,
'react/prefer-stateless-function': 2, // Use functional components vs classes
},
overrides: [
{
files: ['*.spec.js'], // Or *.test.js
rules: {
'react-native/no-raw-text': 0,
},
},
{
files: ['e2e/**/*.js'], // Or *.test.js
rules: {
'jest/expect-expect': 0, // these files do expectations inside page objects
},
},
],
};