-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy patheslint.config.js
More file actions
63 lines (61 loc) · 2.2 KB
/
Copy patheslint.config.js
File metadata and controls
63 lines (61 loc) · 2.2 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';
// Temporary relaxed rules while we tighten up our TypeScript code
// TODO: Remove these rules once we eliminate all of the unnecessary `any` types in the code
const relaxedTypedRules = {
// Allow us to write async functions that don't use await
// Intresting commentary on this: https://github.com/standard/eslint-config-standard-with-typescript/issues/217
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
};
export default tseslint.config(
{
ignores: ['dist/**', 'node_modules/**'],
},
eslint.configs.recommended,
{
files: ['src/**/*.{ts,tsx}'],
extends: [...tseslint.configs.recommended], // recommendedTypeChecked
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
warnOnUnsupportedTypeScriptVersion: false,
},
globals: {
...globals.browser,
...globals.es2022,
},
},
rules: {
...relaxedTypedRules,
'@typescript-eslint/no-unused-vars': [
'warn',
{
caughtErrorsIgnorePattern: '^(e|er|err|error)$',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
prettierConfig,
);