-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.mjs
More file actions
121 lines (115 loc) · 4.07 KB
/
eslint.config.mjs
File metadata and controls
121 lines (115 loc) · 4.07 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import eslint from '@eslint/js'
import { defineConfig } from 'eslint/config'
import importPlugin from 'eslint-plugin-import-x'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import tseslint from 'typescript-eslint'
export default defineConfig(
{
ignores: [
'webpack.config.js',
'src/wasm/*',
'dist/*',
'crate/*',
'esm/*',
'esm_*/*',
'example/*',
'benchmarks/*',
'eslint.config.mjs',
'coverage',
],
},
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.lint.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.strictTypeChecked,
importPlugin.flatConfigs.recommended,
eslintPluginUnicorn.configs.recommended,
{
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'no-underscore-dangle': 'off',
curly: 'error',
eqeqeq: 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-expect-error': 'allow-with-description', 'ts-ignore': true },
],
semi: ['error', 'never'],
// keep off: new Array(n) pre-allocation is intentional for performance
'unicorn/no-new-array': 'off',
'unicorn/no-empty-file': 'off',
'unicorn/prefer-type-error': 'off',
// keep off: bitwise ops in bgzfBlockScan.ts/long.ts are intentional 32-bit integer arithmetic
'unicorn/prefer-modern-math-apis': 'off',
'unicorn/prefer-math-trunc': 'off',
// keep off: (await x).property pattern used in bgzFilehandle.ts
'unicorn/no-await-expression-member': 'off',
// keep off: port.onmessage assignment used in workerPoolHost.ts
'unicorn/prefer-add-event-listener': 'off',
// keep off: top-level await not applicable for library exports
'unicorn/prefer-top-level-await': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-lonely-if': 'off',
'unicorn/consistent-destructuring': 'off',
'unicorn/no-useless-undefined': 'off',
// keep off: files use camelCase
'unicorn/filename-case': 'off',
// keep off: codebase uses many abbreviations (fd, fh, buf, pos, etc.)
'unicorn/prevent-abbreviations': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/number-literal-case': 'off',
// keep off: primary code path in negated condition is more readable as-is
'unicorn/no-negated-condition': 'off',
// keep off: indexed for-loops that track index/position are intentional
'unicorn/no-for-loop': 'off',
'unicorn/explicit-length-check': 'off',
'unicorn/prefer-switch': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/no-deprecated': 'warn',
// keep off: non-null assertions are used intentionally on bounds-checked array access
'@typescript-eslint/no-non-null-assertion': 'off',
'import-x/no-unresolved': 'off',
'import-x/extensions': ['error', 'ignorePackages'],
'import-x/order': [
'error',
{
named: true,
'newlines-between': 'always',
alphabetize: {
order: 'asc',
},
groups: [
'builtin',
['external', 'internal'],
['parent', 'sibling', 'index', 'object'],
'type',
],
},
],
},
},
)