-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.config.js
55 lines (54 loc) · 2.14 KB
/
eslint.config.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
import eslint from '@eslint/js'
import stylistic from '@stylistic/eslint-plugin'
import onlyWarn from 'eslint-plugin-only-warn'
import tsdoc from 'eslint-plugin-tsdoc'
import tsEslint from 'typescript-eslint'
export default tsEslint.config(
eslint.configs.recommended,
stylistic.configs.recommended,
tsEslint.configs.recommendedTypeChecked,
tsEslint.configs.strictTypeChecked,
tsEslint.configs.eslintRecommended,
tsEslint.configs.stylisticTypeChecked,
{
ignores: ['build', 'eslint.config.js'],
},
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
// https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
tsdoc: tsdoc,
// This makes it so the IDE reports lint rejections as warnings only. This is
// better than errors because most lint rejections are not runtime errors. This
// allows IDE errors to be exclusive for e.g. static type errors which often are
// reflective of real runtime errors.
// https://github.com/bfanger/eslint-plugin-only-warn
onlyWarn,
'@stylistic': stylistic,
},
rules: {
'@stylistic/quotes': ['warn', 'backtick'],
'@typescript-eslint/consistent-type-imports': 'warn',
'tsdoc/syntax': 'warn',
// TypeScript makes these safe & effective
'no-case-declarations': 'off',
// Same approach used by TypeScript noUnusedLocals
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
// Needed when working with .mts/.cts where a lone e.g. <T> is not allowed
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
// Useful for organizing Types
'@typescript-eslint/no-namespace': 'off',
// Turn training wheels off. When we want these we want these.
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-expect-error': false }],
},
},
)