-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy patheslint.config.js
75 lines (73 loc) · 2.45 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
eslintPluginPrettierRecommended,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/no-use-before-define': ['off'],
'@typescript-eslint/no-empty-object-type': ['off'],
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-restricted-types': [
'error',
{
types: {
String: {
message: 'Use string instead',
fixWith: 'string',
},
Boolean: {
message: 'Use boolean instead',
fixWith: 'boolean',
},
Number: {
message: 'Use number instead',
fixWith: 'number',
},
Symbol: {
message: 'Use symbol instead',
fixWith: 'symbol',
},
// object typing
Object: {
message:
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.\n- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.\n- If you want a type meaning "any value", you probably want `unknown` instead.',
},
object: {
message:
'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).\nConsider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys.',
},
},
},
],
},
},
{
plugins: { 'chai-friendly': pluginChaiFriendly },
files: ['test/**/*.@(ts|js|mts|cts)'],
rules: {
'no-unused-expressions': 'off', // disable original rule
'@typescript-eslint/no-unused-expressions': 'off', // disable original rule
'chai-friendly/no-unused-expressions': 'error',
},
},
{
ignores: [
'testResources/**/*.ts',
'reports',
'.nyc_output',
'dist',
'eslint.config.js',
],
},
);