-
Notifications
You must be signed in to change notification settings - Fork 8
/
eslint.config.mjs
79 lines (74 loc) · 2.58 KB
/
eslint.config.mjs
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
import eslint from '@eslint/js';
import mm from '@maxmilton/eslint-config';
import unicorn from 'eslint-plugin-unicorn';
import ts from 'typescript-eslint';
const OFF = 0;
const ERROR = 2;
export default ts.config(
eslint.configs.recommended,
...ts.configs.strictTypeChecked,
...ts.configs.stylisticTypeChecked,
unicorn.configs['flat/recommended'],
mm.configs.recommended,
{
linterOptions: {
reportUnusedDisableDirectives: ERROR,
},
languageOptions: {
parserOptions: {
project: ['tsconfig.json', 'tsconfig.node.json'],
projectService: {
allowDefaultProject: ['*.mjs'],
},
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// FIXME: Remove this once fixed upstream (incorrectly reports chrome as deprecated).
'@typescript-eslint/no-deprecated': OFF,
// prefer to clearly separate Bun and DOM
'unicorn/prefer-global-this': OFF,
/* Performance and byte savings */
// alternatives offer byte savings and better performance
'@typescript-eslint/prefer-string-starts-ends-with': OFF,
// byte savings at the cost of readability
'@typescript-eslint/no-confusing-void-expression': OFF, // TODO: Consider removing
// byte savings (but reduces debugging ability)
'@typescript-eslint/restrict-plus-operands': OFF,
// byte savings (but reduces debugging ability)
'@typescript-eslint/restrict-template-expressions': OFF,
// byte savings with same performance
'prefer-template': OFF,
// byte savings
'no-plusplus': OFF,
// byte savings + faster
'unicorn/explicit-length-check': OFF,
'unicorn/no-array-callback-reference': OFF,
// forEach is slower but more compact (for non-performance-critical code)
'unicorn/no-array-for-each': OFF,
'unicorn/no-await-expression-member': OFF,
// indexOf is faster (in Chrome)
'unicorn/prefer-includes': OFF,
// saves 3 bytes to use arrow function
'unicorn/prefer-native-coercion-functions': OFF,
// byte savings (minification doesn't currently automatically remove)
'unicorn/switch-case-braces': [ERROR, 'avoid'],
/* stage1 */
// underscores in synthetic event handler names
'no-underscore-dangle': OFF,
'unicorn/prefer-add-event-listener': OFF,
'unicorn/prefer-dom-node-append': OFF,
'unicorn/prefer-query-selector': OFF,
},
},
{
files: ['build.ts'],
rules: {
'no-await-in-loop': OFF,
'no-console': OFF,
},
},
{
ignores: ['**/*.bak', 'coverage/**', 'dist/**'],
},
);