This repository was archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path.eslintrc.cjs
101 lines (98 loc) · 2.63 KB
/
.eslintrc.cjs
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
89
90
91
92
93
94
95
96
97
98
99
100
101
const fs = require('fs')
let config = {
root: true,
settings: {
react: {
version: '17.0.2'
}
},
extends: [
'eslint:recommended',
'plugin:jest/recommended',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
plugins: ['@typescript-eslint', 'react', 'jest', 'import', 'prettier'],
rules: {
'eol-last': 'warn',
'no-console': 'warn',
'no-multiple-empty-lines': ['warn', { max: 1 }],
'lines-between-class-members': [
'warn',
'always',
{ exceptAfterSingleLine: true }
],
'no-unneeded-ternary': 'error',
'no-nested-ternary': 'warn',
'prefer-object-spread': 'warn',
'import/no-default-export': 'error',
'import/newline-after-import': 'warn',
'import/order': [
'warn',
{
'newlines-between': 'always',
groups: [
'builtin',
['internal', 'external'],
'parent',
'sibling',
'index'
]
}
]
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: `${__dirname}/tsconfig.eslint.json`,
// This is the default, likely want to override it for use with an IDE
createDefaultProgram: false
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
semi: ['error', 'never']
}
},
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/indent': ['off', 2],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
// There are ways around this so ...
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/promise-function-async': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/ban-types': [
'warn',
{
extendDefaults: true,
types: {
Function:
'its OK to eat functions cause they dont have any feelings'
}
}
]
}
}
],
env: {
node: true,
'jest/globals': true
}
}
const path = `${__dirname}/.eslintrc.local.cjs`
if (fs.existsSync(path)) {
config = require(path)(config)
}
module.exports = config