-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.eslintrc.js
57 lines (53 loc) · 1.67 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
module.exports = {
extends: 'eslint-config-egg/typescript',
env: {
browser: true,
},
// for experimental features support
parser: '@typescript-eslint/parser',
parserOptions: {
// for es6 module
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: [
'react',
'@typescript-eslint',
'sort-imports-es6-autofix',
],
rules: {
/**
* Prevent React to be incorrectly marked as unused
* @see https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
*/
'react/jsx-uses-react': [ 'error' ],
/**
* Prevent variables used in JSX to be incorrectly marked as unused
* @see https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
*/
'react/jsx-uses-vars': 'error',
/**
* This rule enforces spacing after the `*` of generator functions, but omitting before that
* @see http://eslint.org/docs/rules/generator-star-spacing
*/
'generator-star-spacing': [ 'error', { before: true, after: false }],
/**
* 这里是因为之前的代码都这么写了,所以off掉
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
*/
'@typescript-eslint/no-use-before-define': 'off',
/**
* @see https://www.npmjs.com/package/eslint-plugin-sort-imports-es6-autofix
*/
'sort-imports-es6-autofix/sort-imports-es6': [ 2, {
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: [ 'none', 'all', 'single', 'multiple' ],
}],
},
parserOptions: {
project: './tsconfig.json',
},
}