-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
131 lines (130 loc) · 3.17 KB
/
Copy patheslint.config.ts
File metadata and controls
131 lines (130 loc) · 3.17 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
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import { defineConfig } from 'eslint/config'
import eslintPluginPrettier from 'eslint-plugin-prettier'
import eslintConfigPrettier from 'eslint-config-prettier'
export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,vue}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: {
globals: globals.browser,
},
},
tseslint.configs.recommended,
pluginVue.configs['flat/essential'],
{
rules: {
'vue/multi-word-component-names': [
'error',
{
ignores: ['index', 'default', 'app'],
},
],
},
},
{
files: ['**/*.vue'],
languageOptions: { parserOptions: { parser: tseslint.parser } },
},
{
rules: {
'max-len': [
'warn',
{ code: 125, ignoreUrls: true, ignoreComments: true },
],
},
},
{
files: ['./**/*.js', './**/*.ts', './**/*.vue'],
rules: {
'no-console': 'error',
'prettier/prettier': 'error', // show Prettier issues as ESLint errors
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase', 'snake_case'],
},
{
selector: 'variableLike',
format: ['camelCase', 'PascalCase', 'snake_case'],
},
{
selector: 'function',
format: ['camelCase'],
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase', 'snake_case'],
leadingUnderscore: 'allow', // allow unused parameter, ex.: `_paramname`.
},
{
selector: 'typeLike', // interfaces, types, classes
format: ['PascalCase'],
},
{
selector: 'enum',
format: ['UPPER_CASE'],
},
{
selector: 'enumMember',
format: ['UPPER_CASE'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false, // e.g., disallow `IUser`, prefer `User`
},
},
{
selector: 'variable',
modifiers: ['const'],
format: ['camelCase', 'UPPER_CASE'],
filter: {
regex: '^[A-Z0-9_]+$',
match: true,
},
},
{
selector: 'objectLiteralProperty',
format: null, // disable naming convention for object literal property keys
},
],
// VUE RULES
'vue/block-order': [
'error',
{
order: ['script', 'template', 'style'],
},
],
'vue/block-lang': [
'error',
{
script: {
lang: 'ts',
},
},
],
'vue/component-api-style': ['error', ['script-setup']],
},
languageOptions: {
globals: {
...globals.browser,
},
},
plugins: {
prettier: eslintPluginPrettier,
},
},
{
rules: {
...eslintConfigPrettier.rules, // disables ESLint rules that conflict with Prettier
},
},
])