-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
98 lines (93 loc) · 2.16 KB
/
index.js
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
import 'eslint-plugin-only-warn'
import js from '@eslint/js'
import importX from 'eslint-plugin-import-x'
import tsParser from '@typescript-eslint/parser'
import tseslint from 'typescript-eslint'
const tsConfigPath = process.cwd()
/** @type {import("eslint").Linter.Config} */
export default [
js.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
...tseslint.configs.recommended,
{
ignores: [
// Ignore dotfiles
'*.config.*',
'node_modules/',
'eslint.config.mjs',
],
languageOptions: {
parser: tsParser,
parserOptions: {
project: true,
tsconfigRootDir: tsConfigPath,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: {
'import-x/resolver': {
typescript: {
project: tsConfigPath,
},
},
node: {
extensions: ['.mjs', '.cjs', '.js', '.jsx', '.ts', '.tsx'],
},
},
rules: {
// JS
'no-unused-vars': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-unused-vars': 0,
'arrow-body-style': ['error', 'as-needed'],
'prefer-arrow-callback': 'error',
'consistent-return': 'error',
// TS
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
// Import
'import-x/order': [
'error',
{
groups: [
['builtin', 'external'],
'internal',
['sibling', 'parent', 'index'],
'object',
'type',
],
pathGroups: [
{
pattern: '@/**',
group: 'internal',
position: 'after',
},
{
pattern: 'next/**',
group: 'builtin',
position: 'before',
},
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['type'],
'newlines-between': 'always',
},
],
'import-x/extensions': 'off',
'import-x/no-unresolved': 'off',
'import-x/no-extraneous-dependencies': 'off',
'import-x/prefer-default-export': 'off',
},
},
]