-
Notifications
You must be signed in to change notification settings - Fork 26
/
.eslintrc.js
88 lines (87 loc) · 2.09 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
86
87
88
/* eslint-disable @typescript-eslint/no-var-requires */
const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
module.exports = {
env: {
node: true,
},
parser: 'babel-eslint',
extends: [
'airbnb',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/react',
'prettier/@typescript-eslint',
],
plugins: ['prettier'],
rules: {
'prettier/prettier': 'error',
'react/jsx-filename-extension': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'.eslintrc.js',
'rollup.config.js',
'**/__tests__/**/*',
'setupTest.ts',
'codegen/**/*',
],
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
devDependencies: [
'rollup.config.js',
'.eslintrc.js',
'**/__tests__/**/*',
],
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.tsx'],
},
},
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
// NOTE: Workaround for no nested extends possible.
// See https://github.com/eslint/eslint/issues/8813.
// Working solution would be following, if we had nested extends:
// ```
// extends: [
// 'airbnb-base',
// 'plugin:@typescript-eslint/recommended',
// 'prettier/@typescript-eslint',
// 'prettier',
// ],
// ```
plugins: ['@typescript-eslint', 'prettier'],
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-function-return-type': 'error',
},
),
},
{
files: [
'setupTest.js',
'setupTest.ts',
'*.spec.js',
'*.spec.ts',
'*.spec.tsx',
],
env: {
jest: true,
},
},
],
};