-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy patheslint.config.js
More file actions
133 lines (120 loc) · 3.01 KB
/
eslint.config.js
File metadata and controls
133 lines (120 loc) · 3.01 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
122
123
124
125
126
127
128
129
130
131
132
133
/* eslint-disable import-x/no-named-as-default-member */
import eslintContainerbase from '@containerbase/eslint-plugin';
import js from '@eslint/js';
import vitest from '@vitest/eslint-plugin';
import eslintConfigPrettier from 'eslint-config-prettier';
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
import * as importX from 'eslint-plugin-import-x';
import pluginPromise from 'eslint-plugin-promise';
import globals from 'globals';
import tseslint from 'typescript-eslint';
const jsFiles = { files: ['**/*.{js,cjs,mjs,mts,ts}'] };
export default tseslint.config(
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/coverage/',
'**/html/',
'**/__mocks__/',
'**/.pnp.*',
'.yarn/*',
'**/pnpm-lock.yaml',
'**/*.snap',
],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
vitest.configs.recommended,
pluginPromise.configs['flat/recommended'],
eslintContainerbase.configs.all,
{
...jsFiles,
extends: [importX.flatConfigs.recommended, importX.flatConfigs.typescript],
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
tsconfigRootDir: import.meta.dirname,
projectService: true,
},
},
settings: {
'import-x/resolver-next': [
createTypeScriptImportResolver({ project: 'tsconfig.lint.json' }),
],
},
},
eslintConfigPrettier,
{
...jsFiles,
rules: {
curly: [2, 'all'],
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'import-x/order': [
'error',
{
alphabetize: {
order: 'asc',
},
},
],
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/explicit-function-return-type': [
2,
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
'@typescript-eslint/no-unused-vars': [
2,
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/no-floating-promises': 2,
'@containerbase/enforce-ts-extension': 0,
},
},
{
files: ['**/*.js', '**/*.mjs'],
rules: {
'@typescript-eslint/explicit-function-return-type': 0,
},
},
{
files: ['**/*.spec.ts', 'test/**'],
rules: {
'@typescript-eslint/no-require-imports': 0,
},
},
{
files: ['tools/**/*.js'],
rules: {
'import-x/default': 1,
'import-x/no-named-as-default-member': 1,
},
},
);