-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
86 lines (78 loc) · 2.29 KB
/
Copy patheslint.config.mjs
File metadata and controls
86 lines (78 loc) · 2.29 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
import eslintConfigPrettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import unusedImports from 'eslint-plugin-unused-imports';
import pluginVue from 'eslint-plugin-vue';
import tseslint from 'typescript-eslint';
const eslintConfig = tseslint.config(
// Vue ルール
...pluginVue.configs['flat/recommended'],
// TypeScript ルール
{
files: ['**/*.ts'],
extends: tseslint.configs.recommended,
},
// Vue SFC 内の TypeScript を解析するためのサブパーサー設定
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
},
},
},
{
/*
プラグイン
- import : import の順番を rules のとおりに整理する
- unused-imports : 使われていない import を削除する
*/
plugins: {
'import': importPlugin,
'unused-imports': unusedImports,
},
rules: {
// import の並び順
'import/order': [
'error',
{
/*
import の並び順とグルーピングのルール
- builtin : ex) from 'path'
- external : ex) from 'vue'
- internal : ex) from '@/components/Button.vue'
- parent : ex) from '../services'
- sibling : ex) from './validateForm'
- index : ex) from './'
- object
- type : ex) from '@/types/users'
*/
'groups': [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
// グループ間の改行なし
'newlines-between': 'never',
// グループ内は ABC 順
'alphabetize': { order: 'asc' },
},
],
// 使われていない import を削除
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-unused-vars': 'off',
// 同じライブラリから import されている module を 1 行に
'import/no-duplicates': 'error',
},
},
{
ignores: ['node_modules/**', 'dist/**', 'src-tauri/**'],
},
// Prettier と競合する ESLint ルールを無効化
eslintConfigPrettier,
);
export default eslintConfig;