-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy patheslint.config.mjs
More file actions
90 lines (82 loc) · 2.33 KB
/
eslint.config.mjs
File metadata and controls
90 lines (82 loc) · 2.33 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { default as svelteConfig } from '@dfinity/eslint-config-oisy-wallet/svelte';
import { default as vitestConfig } from '@dfinity/eslint-config-oisy-wallet/vitest';
const ZERO_BIGINT_RESTRICTION = {
selector: "Literal[raw='0n']",
message: 'Use the shared constant `ZERO` instead of `0n`.'
};
export default [
...vitestConfig,
...svelteConfig,
{
rules: {
'local-rules/use-option-type-wrapper': 'error',
// TODO: re-enable this rule when it includes `expect` statements nested in callable functions.
'vitest/expect-expect': ['off'],
// TODO: re-enable this rule once typescript-eslint stops flagging assertions
// that are required for compilation (e.g. on mocked values whose receiver type
// is wider than what TypeScript actually infers without the assertion).
'@typescript-eslint/no-unnecessary-type-assertion': 'off'
}
},
{
files: ['src/frontend/src/**/*'],
rules: {
'local-rules/no-relative-imports': 'error'
}
},
{
rules: {
'no-restricted-syntax': ['error', ZERO_BIGINT_RESTRICTION]
}
},
{
files: ['src/frontend/src/**/*'],
ignores: ['src/frontend/src/lib/utils/console.utils.ts', 'src/frontend/src/tests/**/*'],
rules: {
'no-restricted-syntax': [
'error',
ZERO_BIGINT_RESTRICTION,
{
selector: "MemberExpression[object.name='console'][property.name='error']",
message:
'Use `consoleError` from `$lib/utils/console.utils` instead of `console.error` to format IC canister errors.'
},
{
selector: "MemberExpression[object.name='console'][property.name='warn']",
message:
'Use `consoleWarn` from `$lib/utils/console.utils` instead of `console.warn` to format IC canister errors.'
}
]
}
},
// TODO: re-enable this rule when we fix all the warnings that it causes.
{
rules: {
'svelte/no-navigation-without-resolve': 'off',
'vitest/no-conditional-expect': 'off',
'vitest/no-disabled-tests': 'off',
'vitest/no-standalone-expect': 'off'
}
},
{
ignores: [
'**/.DS_Store',
'**/node_modules',
'build',
'.dfx',
'.svelte-kit',
'package',
'**/.env',
'**/.env.*',
'!**/.env.example',
'**/pnpm-lock.yaml',
'**/package-lock.json',
'**/yarn.lock',
'src/declarations/**/*',
'src/frontend/src/env/tokens/tokens.sns.json',
'**/playwright-report',
'**/coverage',
'**/.vitest-reports'
]
}
];