Skip to content

Commit e91099c

Browse files
committed
Add eslint config
1 parent 1451662 commit e91099c

15 files changed

+10930
-334
lines changed

.eslintrc.js

+62-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,64 @@
11
module.exports = {
2-
root: true,
3-
extends: '@react-native-community',
2+
root: true,
3+
parserOptions: {
4+
ecmaFeatures: {
5+
jsx: true,
6+
},
7+
ecmaVersion: 2018,
8+
},
9+
plugins: ['react', 'react-native', '@react-native-community', 'prettier'],
10+
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:prettier/recommended', '@react-native-community'],
11+
rules: {
12+
// eslint
13+
semi: 'off',
14+
curly: ['warn', 'multi-or-nest', 'consistent'],
15+
'no-bitwise': 'off', // required for blurhash
16+
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
17+
'no-async-promise-executor': 'warn',
18+
'require-await': 'warn',
19+
'no-return-await': 'warn',
20+
'no-await-in-loop': 'warn',
21+
'comma-dangle': 'off', // prettier already detects this
22+
// prettier
23+
'prettier/prettier': ['warn'],
24+
// react plugin
25+
'react/no-unescaped-entities': 'off',
26+
// react native plugin
27+
'react-native/no-unused-styles': 'warn',
28+
'react-native/split-platform-components': 'warn',
29+
'react-native/no-inline-styles': 'warn', // TODO: 'off'?
30+
'react-native/no-color-literals': 'warn',
31+
'react-native/no-raw-text': 'off',
32+
'react-native/no-single-element-style-arrays': 'warn',
33+
},
34+
env: {
35+
node: true,
36+
'react-native/react-native': true,
37+
},
38+
settings: {
39+
react: {
40+
version: 'latest',
41+
},
42+
'import/resolver': {
43+
extensions: [
44+
'.js',
45+
'.jsx',
46+
'.ts',
47+
'.tsx',
48+
'.d.ts',
49+
'.android.js',
50+
'.android.jsx',
51+
'.android.ts',
52+
'.android.tsx',
53+
'.ios.js',
54+
'.ios.jsx',
55+
'.ios.ts',
56+
'.ios.tsx',
57+
'.web.js',
58+
'.web.jsx',
59+
'.web.ts',
60+
'.web.tsx',
61+
],
62+
},
63+
},
464
};

.github/workflows/build-ios.yml

-38
This file was deleted.

.prettierrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
bracketSpacing: true,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
semi: true,
7+
tabWidth: 2,
8+
useTabs: true,
9+
printWidth: 150
10+
};

example/.eslintrc.js

+67-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,69 @@
11
module.exports = {
2-
root: true,
3-
extends: '@react-native-community',
2+
root: true,
3+
parserOptions: {
4+
ecmaFeatures: {
5+
jsx: true,
6+
},
7+
ecmaVersion: 2018,
8+
},
9+
plugins: ['react', 'react-native', '@react-native-community', 'prettier', 'react-hooks'],
10+
extends: [
11+
'eslint:recommended',
12+
'plugin:react/recommended',
13+
'plugin:prettier/recommended',
14+
'@react-native-community',
15+
'plugin:react-hooks/recommended',
16+
],
17+
rules: {
18+
// eslint
19+
semi: 'off',
20+
curly: ['warn', 'multi-or-nest', 'consistent'],
21+
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
22+
'no-async-promise-executor': 'warn',
23+
'require-await': 'warn',
24+
'no-return-await': 'warn',
25+
'no-await-in-loop': 'warn',
26+
'comma-dangle': 'off', // prettier already detects this
27+
// prettier
28+
'prettier/prettier': ['warn'],
29+
// react plugin
30+
'react/no-unescaped-entities': 'off',
31+
// react native plugin
32+
'react-native/no-unused-styles': 'warn',
33+
'react-native/split-platform-components': 'warn',
34+
'react-native/no-inline-styles': 'warn', // TODO: 'off'?
35+
'react-native/no-color-literals': 'warn',
36+
'react-native/no-raw-text': 'off',
37+
'react-native/no-single-element-style-arrays': 'warn',
38+
},
39+
env: {
40+
node: true,
41+
'react-native/react-native': true,
42+
},
43+
settings: {
44+
react: {
45+
version: 'latest',
46+
},
47+
'import/resolver': {
48+
extensions: [
49+
'.js',
50+
'.jsx',
51+
'.ts',
52+
'.tsx',
53+
'.d.ts',
54+
'.android.js',
55+
'.android.jsx',
56+
'.android.ts',
57+
'.android.tsx',
58+
'.ios.js',
59+
'.ios.jsx',
60+
'.ios.ts',
61+
'.ios.tsx',
62+
'.web.js',
63+
'.web.jsx',
64+
'.web.ts',
65+
'.web.tsx',
66+
],
67+
},
68+
},
469
};

example/.prettierrc.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module.exports = {
2-
bracketSpacing: false,
3-
jsxBracketSameLine: true,
4-
singleQuote: true,
5-
trailingComma: 'all',
2+
bracketSpacing: true,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
semi: true,
7+
tabWidth: 2,
8+
useTabs: true,
9+
printWidth: 150
610
};

0 commit comments

Comments
 (0)