-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
85 lines (70 loc) · 2.72 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: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended', 'plugin:import/typescript', 'prettier/react'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module', // Allows for the use of imports
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
plugins: ['prettier', 'react-hooks', 'tangerine'],
rules: {
// http://eslint.org/docs/rules/no-duplicate-imports
// handled by import/no-duplicate rule
'no-duplicate-imports': 'off',
// Superfluous because of the tangerine import order rule
'import/order': 'off',
// Superfluous because of the tangerine import order rule
'import/first': 'off',
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tx", ".tsx"] }],
// just annoying
'@typescript-eslint/explicit-function-return-type': 'off',
// all of them are in stories
'import/no-extraneous-dependencies': 'off',
// https://github.com/prettier/eslint-plugin-prettier
// enforce code formatting according to prettier
'prettier/prettier': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md
// Ensure named imports correspond to named exports in the remote file
'import/named': 'error',
// enforce default import names
'tangerine/import/default-import-names': [
'error',
[
{ source: 'react', name: 'React' },
{ source: 'prop-types', name: 'PropTypes' },
],
],
// enforce defined order of imports
'tangerine/import/order': ['error', {
moduleImports: [
[
/^react$/,
// test libraries
/^sinon$/,
/^enzyme$/,
/^@storybook/,
// "view" libraries
/^prop-types$/,
/^react/,
/^styled-components$/,
/^@atlaskit/,
// "state" libraries
/^redux/,
/^rxjs$/,
/^reselect$/,
/^icepick$/,
/^lodash/,
// catch all, otherwise would fall into a seperate group
/./,
],
],
absoluteImports: [[/^common\//]],
relativeImports: [/^common$/, /^(?!index)/, /^index/],
simpleFormattingCount: 3,
}],
}
};