-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.mjs
56 lines (51 loc) · 1.8 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
// @ts-check
import eslint from '@eslint/js';
import { currentModulePath } from '@tech_query/node-toolkit';
import eslintConfigPrettier from 'eslint-config-prettier';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
const tsconfigRootDir = currentModulePath();
export default tsEslint.config(
// register all of the plugins up-front
{
plugins: {
'@typescript-eslint': tsEslint.plugin,
'simple-import-sort': simpleImportSortPlugin
}
},
// config with just ignores is the replacement for `.eslintignore`
{ ignores: ['**/node_modules/**', '**/dist/**', 'type/**', '*.mjs'] },
// extends ...
eslint.configs.recommended,
...tsEslint.configs.recommended,
// base config
{
languageOptions: {
globals: { ...globals.es2022, ...globals.node },
parserOptions: {
projectService: true,
tsconfigRootDir,
warnOnUnsupportedTypeScriptVersion: false
}
},
rules: {
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn'
}
},
{
files: ['**/*.js'],
extends: [tsEslint.configs.disableTypeChecked],
rules: {
// turn off other type-aware rules
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off'
}
},
eslintConfigPrettier
);