-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
91 lines (86 loc) · 2.27 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
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
import globals from 'globals';
import tseslint from 'typescript-eslint';
import path from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import prettierConfig from 'eslint-config-prettier';
import stylisticTsPlugin from '@stylistic/eslint-plugin-ts';
import vitestPlugin from 'eslint-plugin-vitest';
// mimic CommonJS variables -- not needed if using CommonJS
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: pluginJs.configs.recommended,
});
/** @type {import('eslint').Linter.FlatConfig} */
const flatConfig = [
{ ignores: ['/.next'] },
{
languageOptions: {
globals: { ...globals.node },
},
},
...compat.extends('standard-with-typescript'),
...tseslint.configs.recommended,
prettierConfig,
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
import: importPlugin,
'@stylistic/ts': stylisticTsPlugin,
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
'@/curly': 'error',
'@stylistic/ts/semi': 'error',
eqeqeq: 'error',
complexity: [
'error',
{
max: 15,
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'arrow-body-style': ['error', 'as-needed'],
'no-unneeded-ternary': 'error',
'prefer-arrow-callback': 'error',
'no-else-return': 'error',
'no-useless-return': 'error',
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
'array-callback-return': [
'error',
{
allowImplicit: true,
},
],
'import/order': [
'error',
{
alphabetize: { caseInsensitive: true, order: 'asc' },
groups: ['builtin', 'external', 'parent', 'sibling'],
'newlines-between': 'always',
pathGroups: [],
pathGroupsExcludedImportTypes: ['builtin'],
},
],
},
},
];
export default flatConfig;