-
Notifications
You must be signed in to change notification settings - Fork 9
/
.eslintrc.js
72 lines (66 loc) · 2.19 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
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
'plugin:prettier/recommended',
],
plugins: ['sort-imports-es6-autofix'],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true,
},
},
overrides: [
{
files: ['*.js'],
rules: {
// And as mentioned here this rule will freak out on .js files as well
// https://github.com/typescript-eslint/typescript-eslint/issues/906
//
// So we disable it for .js files using overrides
'@typescript-eslint/explicit-function-return-type': 0,
// And the same goes for member accessibility
//
// See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
'@typescript-eslint/explicit-member-accessibility': 0,
// And last but not least require() calls are enabled in js files
'@typescript-eslint/no-var-requires': 0,
},
},
{
files: ['test/**.spec.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 1,
},
},
],
rules: {
// Prevent forgotten console.* statements
'no-console': 2,
'react/prop-types': 0,
// Make sure imports get sorted
'sort-imports-es6-autofix/sort-imports-es6': [
2,
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'@typescript-eslint/no-use-before-define': [2, { functions: false, classes: false }],
'@typescript-eslint/explicit-function-return-type': 0,
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
'import/resolver': {
node: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
},
},
};