Skip to content

Commit 6427433

Browse files
authored
chore: Introduce prettier-eslint and upgrade eslint related packages (#882)
* chore: Update linting configuration Move to prettier-eslint in lint-staged. Upgrade eslint, babel-eslint dependencies. Rename .eslintrc -> .eslintrc.js * chore: Reformat files Reformat files using updated eslint, babel-eslint, prettier-eslint * chore: update lock hash * style: Format by prettier * chore: Upgrade to eslint@5 and related dependencies * style: Clean all eslint errors * style: Revert as [email protected] * Revert "chore: Reformat files" This reverts commit c314b18. * style: Pick useful changes * style: Lint by bash@4
1 parent a2aa221 commit 6427433

15 files changed

+1378
-639
lines changed

Diff for: .eslintrc

-186
This file was deleted.

Diff for: .eslintrc.js

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
module.exports = {
2+
extends: 'eslint-config-airbnb',
3+
plugins: ['jsx-a11y', 'import', 'react', 'react-native', 'flowtype'],
4+
parser: 'babel-eslint',
5+
env: {
6+
browser: true,
7+
node: true,
8+
es6: true,
9+
},
10+
parserOptions: {
11+
ecmaFeatures: {
12+
jsx: true,
13+
},
14+
},
15+
globals: {
16+
__DEV__: true,
17+
},
18+
settings: {
19+
'import/resolver': {
20+
'babel-module': {
21+
root: ['./src'],
22+
alias: {
23+
api: 'api',
24+
auth: 'auth',
25+
components: 'components',
26+
config: 'config',
27+
issue: 'issue',
28+
locale: 'locale',
29+
notifications: 'notifications',
30+
organization: 'organization',
31+
repository: 'repository',
32+
search: 'search',
33+
testData: './__tests__/data',
34+
user: 'user',
35+
utils: 'utils',
36+
},
37+
},
38+
},
39+
},
40+
rules: {
41+
'global-require': 'off',
42+
'import/prefer-default-export': 'off',
43+
'jsx-a11y/anchor-has-content': 'off',
44+
'jsx-a11y/no-noninteractive-element-interactions': 'off',
45+
'jsx-a11y/no-static-element-interactions': 'off',
46+
'arrow-body-style': 'off',
47+
'arrow-parens': ['error', 'as-needed'],
48+
'comma-dangle': ['error', 'always-multiline'],
49+
indent: 'off',
50+
'padding-line-between-statements': [
51+
2,
52+
{ blankLine: 'always', prev: '*', next: 'return' },
53+
{ blankLine: 'always', prev: ['var', 'let', 'const'], next: '*' },
54+
{
55+
blankLine: 'any',
56+
prev: ['var', 'let', 'const'],
57+
next: ['var', 'let', 'const'],
58+
},
59+
],
60+
'newline-per-chained-call': 'off',
61+
'no-confusing-arrow': 'off',
62+
'no-else-return': [
63+
'error',
64+
{
65+
allowElseIf: true,
66+
},
67+
],
68+
'no-mixed-operators': [
69+
'error',
70+
{
71+
groups: [
72+
['&', '|', '^', '~', '<<', '>>', '>>>'],
73+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
74+
['&&', '||'],
75+
['in', 'instanceof'],
76+
],
77+
allowSamePrecedence: true,
78+
},
79+
],
80+
'no-underscore-dangle': 'off',
81+
'max-len': 'off',
82+
'no-plusplus': [
83+
'error',
84+
{
85+
allowForLoopAfterthoughts: true,
86+
},
87+
],
88+
'space-before-function-paren': [
89+
'error',
90+
{
91+
anonymous: 'never',
92+
named: 'never',
93+
asyncArrow: 'always',
94+
},
95+
],
96+
'wrap-iife': [
97+
'error',
98+
'inside',
99+
{
100+
functionPrototypeMethods: false,
101+
},
102+
],
103+
'flowtype/define-flow-type': 1,
104+
'react/jsx-wrap-multilines': 'off',
105+
'react/jsx-closing-bracket-location': 'off',
106+
'react/jsx-curly-spacing': [
107+
'error',
108+
'never',
109+
{
110+
allowMultiline: true,
111+
},
112+
],
113+
'react/jsx-filename-extension': [
114+
'error',
115+
{
116+
extensions: ['.js', '.jsx'],
117+
},
118+
],
119+
'react/jsx-indent': 'off',
120+
'react/jsx-indent-props': 'off',
121+
'react/jsx-no-bind': 'error',
122+
'react/no-multi-comp': 'off',
123+
'react/prefer-stateless-function': 'off',
124+
'react/sort-comp': [
125+
'error',
126+
{
127+
order: [
128+
'static-methods',
129+
'lifecycle',
130+
'/^on.+$/',
131+
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
132+
'everything-else',
133+
'/^render.+$/',
134+
'render',
135+
],
136+
groups: {
137+
lifecycle: [
138+
'displayName',
139+
'props',
140+
'propTypes',
141+
'contextTypes',
142+
'childContextTypes',
143+
'mixins',
144+
'statics',
145+
'defaultProps',
146+
'state',
147+
'constructor',
148+
'getDefaultProps',
149+
'getInitialState',
150+
'getChildContext',
151+
'componentWillMount',
152+
'componentDidMount',
153+
'componentWillReceiveProps',
154+
'shouldComponentUpdate',
155+
'componentWillUpdate',
156+
'componentDidUpdate',
157+
'componentWillUnmount',
158+
],
159+
},
160+
},
161+
],
162+
// disable temporarily in order to not modify current codes
163+
'function-paren-newline': 'off',
164+
'implicit-arrow-linebreak': 'off',
165+
'lines-between-class-members': 'off',
166+
'object-curly-newline': 'off',
167+
'operator-linebreak': 'off',
168+
'prefer-destructuring': 'off',
169+
'import/named': 'off',
170+
'import/no-cycle': 'off',
171+
'jsx-a11y/anchor-is-valid': 'off',
172+
'no-restricted-globals': 'off',
173+
'react/default-props-match-prop-types': 'off',
174+
'react/destructuring-assignment': 'off',
175+
'react/jsx-one-expression-per-line': 'off',
176+
'react/no-access-state-in-setstate': 'off',
177+
'react/no-this-in-sfc': 'off',
178+
'react/no-unused-state': 'off',
179+
'react/require-default-props': 'off',
180+
},
181+
};

0 commit comments

Comments
 (0)