-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.eslintrc.js
More file actions
46 lines (45 loc) · 1.56 KB
/
.eslintrc.js
File metadata and controls
46 lines (45 loc) · 1.56 KB
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
/** @type {import('eslint').Linter.ParserOptions} */
const parserOptions = {
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
project: ['./tsconfig.json'],
}
/** @type {import('eslint').Linter.Config} */
const config = {
extends: ['@detachhead/eslint-config'],
parserOptions,
rules: {
// typescript-eslint enables this 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',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'playwright.config.ts',
'.eslintrc.cjs',
'src/browser/**/*.ts',
'tests/**/*.ts',
],
},
],
// we aren't making a public api
'@typescript-eslint/explicit-module-boundary-types': 'off',
// eslint-plugin-import needs the type keyword to detect type imports
'@typescript-eslint/consistent-type-imports': 'error',
},
overrides: [
...['src/common', 'src/browser', 'src/node', 'tests'].map((path) => ({
files: [`${path}/**/*.ts`],
parserOptions: { ...parserOptions, project: [`./${path}/tsconfig.json`] },
})),
{
files: ['.eslintrc.cjs'],
parserOptions,
rules: {
// commonjs cant use esm imports, duh
'@typescript-eslint/no-var-requires': 'off',
},
},
],
}
module.exports = config