Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
108 lines (100 loc) · 3.15 KB
/
Copy patheslint.config.mjs
File metadata and controls
108 lines (100 loc) · 3.15 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
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsParser from '@typescript-eslint/parser';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import importPlugin from 'eslint-plugin-import';
import promise from 'eslint-plugin-promise';
import unusedImports from 'eslint-plugin-unused-imports';
/** @type {import('eslint').Linter.Config[]} */
export default [
pluginJs.configs.recommended,
...tseslint.configs.strict,
eslintConfigPrettier,
{
ignores: ['**/dist/**', '**/node_modules/**', '**/eslint.*'],
},
{
files: ['packages/cli/src/**/*.ts'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
},
parserOptions: {
project: './packages/cli/tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
import: importPlugin,
promise,
'unused-imports': unusedImports,
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './packages/cli/tsconfig.json',
},
node: true,
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: false },
],
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/restrict-plus-operands': [
'error',
{ skipCompoundAssignments: true },
],
'@typescript-eslint/method-signature-style': ['error', 'property'],
'promise/always-return': 'error',
'promise/no-multiple-resolved': 'error',
'promise/no-nesting': 'warn',
'promise/no-new-statics': 'error',
'promise/no-return-in-finally': 'error',
'promise/valid-params': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-cycle': ['warn', { maxDepth: 3 }],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'unused-imports/no-unused-imports': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
},
{
files: ['test/**/*.js', 'scripts/**/*.mjs'],
languageOptions: { globals: globals.node },
},
eslintPluginPrettierRecommended,
];