forked from tomer-yechiel/pino-sentry-transport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
133 lines (132 loc) · 4.31 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
const path = require('path');
module.exports = {
root: true,
env: {
node: true,
es2022: true,
},
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier',
],
ignorePatterns: ['.eslintrc.cjs'],
overrides: [
{
files: ['*.spec.ts'],
rules: {
'no-unused-expressions': 'off',
},
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
// enable the rule specifically for TypeScript files
files: ['*.ts'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['error'],
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
ecmaVersion: 13,
project: path.resolve(__dirname, 'tsconfig.json'),
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'import'],
rules: {
'class-methods-use-this': 'off',
'import/extensions': [
'error',
{
json: 'always',
js: 'never',
ts: 'never',
},
],
'import/no-default-export': 'error',
'import/no-extraneous-dependencies': ['error', { devDependencies: true, packageDir: __dirname }],
'import/prefer-default-export': 'off',
indent: 'off',
// Override airbnb's max line length rule to:
// - increase the line length limit to 120
// - Set tab width to 4 spaces
// - also ignore import statements and class inheritance
'max-len': [
'error',
120,
4,
{
ignorePattern: '^import [^,]+ from |^export | implements',
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'newline-after-var': ['error', 'always'],
// A Promise within a promise? How meta, but actually useful
// We disable this and assume developers wield this power responsibly
'no-async-promise-executor': 'off',
'no-debugger': 'warn',
'no-bitwise': 'off',
// Boolean logic is boolean logic. Developers hsould understand order of operations.
'no-mixed-operators': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// This is an old rule that is slowly not applicable anymore (i.e. for-of is ok now)
'no-restricted-syntax': 'off',
'no-shadow': 'off',
'no-underscore-dangle': ['error', { allow: ['_embedded'] }],
'no-use-before-define': 'off',
// Sometimes we just need to
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
// Default to off so we don't type check js
'@typescript-eslint/explicit-function-return-type': 'off',
// Don't enforce the rule that interfaces should not be prefix with `I`
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/type-annotation-spacing': [
'error',
{
before: false,
after: true,
overrides: {
arrow: {
before: true,
after: true,
},
},
},
],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: path.resolve(__dirname, 'tsconfig.json'),
},
},
},
};