forked from labex-labs/python-cheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
106 lines (102 loc) · 2.27 KB
/
eslint.config.js
File metadata and controls
106 lines (102 loc) · 2.27 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
import js from '@eslint/js'
import prettier from 'eslint-config-prettier'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsparser from '@typescript-eslint/parser'
import vue from 'eslint-plugin-vue'
import globals from 'globals'
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const autoImportGlobals = JSON.parse(
readFileSync(join(__dirname, '.eslintrc-auto-import.json'), 'utf-8'),
)
const customGlobals = Object.keys(autoImportGlobals.globals).reduce(
(acc, key) => {
acc[key] = 'readonly'
return acc
},
{},
)
export default [
{
ignores: [
'dist',
'src/components.d.ts',
'src/auto-imports.d.ts',
'functions/**/*.ts',
],
},
js.configs.recommended,
...vue.configs['flat/recommended'],
prettier,
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: {
parser: tsparser,
ecmaVersion: 12,
sourceType: 'module',
},
globals: {
...globals.node,
...customGlobals,
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'vue/no-unused-vars': 'off',
'vue/multi-word-component-names': 'off',
},
},
{
files: ['**/*.{js,ts}'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
globals: {
...globals.node,
...customGlobals,
},
},
plugins: {
'@typescript-eslint': tseslint,
},
},
{
files: ['src/components.d.ts', 'src/auto-imports.d.ts'],
rules: {
'eslint-comments/no-unused-disable': 'off',
},
},
{
files: ['worker.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
globals: {
...globals.node,
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'no-undef': 'off', // TypeScript handles type checking
'no-unused-vars': 'off', // Turn off base rule
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
},
},
]