-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
80 lines (75 loc) · 3.11 KB
/
.eslintrc.cjs
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
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
extends: [
'eslint:recommended',
'plugin:unicorn/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/strict-type-checked',
// not sure if we want this or not
// 'plugin:@typescript-eslint/stylistic-type-checked',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
plugins: ['simple-import-sort', '@typescript-eslint', 'import'],
settings: {
'import/resolver': { typescript: {} },
},
rules: {
'simple-import-sort/imports': [
'error',
{
// Custom import grouping see https://github.com/lydell/eslint-plugin-simple-import-sort#custom-grouping
// Type imports always go last in their group (we use String.raw to avoid a bunch of escaping)
groups: [
// Side effect imports. (import './file.ts')
[String.raw`^\u0000`],
// Node.js builtins prefixed with `node:`. (they get enforced by 'unicorn/prefer-node-protocol')
[String.raw`^node:`, String.raw`^node:.*\u0000$`],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
// But not local monorepo packages.
[String.raw`^@?\w`, String.raw`^@?\w.*\u0000$`],
// Local package imports.
// Anything that starts with a dot or ~/
[
String.raw`^\.`,
String.raw`^`,
String.raw`^~/`,
String.raw`^\..*\u0000$`,
String.raw`^[^.].*\u0000$`,
String.raw`^~/.*\u0000$`,
],
],
},
],
'object-shorthand': ['error', 'always'],
'prefer-const': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-non-null-assertion': 'warn',
'unicorn/no-null': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/prefer-event-target': 'off',
'unicorn/template-indent': ['error', { indent: 4 }],
'unicorn/no-for-loop': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-object-as-default-parameter': 'off',
},
});