-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
48 lines (44 loc) · 1.48 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
/** @type {import('eslint').Linter.ParserOptions} */
const parserOptions = {
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
}
/** @type {import('eslint').Linter.ParserOptions} */
const configFileParserOptions = { ...parserOptions, project: ['./tsconfig.json'] }
/** @type {import('eslint').Linter.Config} */
const config = {
extends: ['@detachhead/eslint-config'],
parserOptions: {
...parserOptions,
project: ['./src/tsconfig.json'],
},
rules: {
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['.eslintrc.cjs', 'test/**/*.ts'] },
],
'@typescript-eslint/no-shadow': 'off',
},
overrides: [
{
files: ['test/**/*.ts'],
parserOptions: { ...parserOptions, project: ['./test/tsconfig.json'] },
},
{
files: ['jest.config.ts'],
parserOptions: configFileParserOptions,
},
{
files: ['.eslintrc.js'],
parserOptions: configFileParserOptions,
rules: {
// commonjs cant use esm imports, duh
'@typescript-eslint/no-var-requires': 'off',
// typescript-eslint enables these for typescript files only, but the js config files can benefit from it too because we aren't targeting an ancient node version
'no-var': 'error',
'prefer-const': 'error',
},
},
],
}
module.exports = config