This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
93 lines (75 loc) · 2.73 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
module.exports = {
root: true,
plugins: ["prettier", "react-native"],
// Enable new features (such as class properties)
parser: "babel-eslint",
extends: [
// Airbnb's React style guide
"airbnb",
"airbnb/hooks",
// Does 3 things:
// 1. Turns prettier rules into eslint rules
// 2. Disables eslint rules that conflict with prettier
// 3. Classifies prettier rules as errors
"plugin:prettier/recommended",
// Turns off style-specific rules for different plugins
"prettier/react",
],
// All custom rule overrides go here. Each override should include an explanation
// for why it is applied
rules: {
// Turn off this rule to allow StyleSheets to be placed at the bottom of files
// It might be good to disable this in the future and strip out StyleSheets
"no-use-before-define": "off",
// Prevents unused styling rules
"react-native/no-unused-styles": "error",
// Prevents inline styles
"react-native/no-inline-styles": "error",
// Sorts styles in alphabetical order
"react-native/sort-styles": "error",
// Prevents style arrays with only one element
"react-native/no-single-element-style-arrays": "error",
// TODO: enable this rule in the future
// Enables prop spreading
"react/jsx-props-no-spreading": "off",
// Allows you to reassign the properties of function parameters
"no-param-reassign": ["error", { props: false }],
// TODO: add this in when we're ready to start stripping
// out styles that should be placed in a config file
// "react-native/no-color-literals": "error",
// Allows us to use static public properties (e.g. for `contextType`)
// However, we still want propTypes and defaultProps to be declared outside the class.
"react/static-property-placement": [
"error",
"static public field",
{
defaultProps: "property assignment",
propTypes: "property assignment",
},
],
// Allow the use of dangling underscores to indicate private variables/functions
"no-underscore-dangle": "off",
},
overrides: [
{
files: ["*.test.js", "*.test.jsx", "jest.setup.js"],
rules: {
// Often times, it is useful to use or spy on console statements in test files
"no-console": "off",
},
},
],
settings: {
"import/resolver": {
node: {
// ".native.js" is in this list so the `react-native-screens` dependency is
// recognized by ESLint (see https://github.com/software-mansion/react-native-screens/issues/62)
extensions: [".js", ".jsx", ".json", ".native.js"],
},
},
},
env: {
// Gives access to React Native globals (like `fetch()`)
"react-native/react-native": true,
},
};