-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
64 lines (61 loc) · 1.76 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
import js from '@eslint/js';
import globals from 'globals';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import unusedImports from 'eslint-plugin-unused-imports';
import astroParser from 'astro-eslint-parser';
import astroPlugin from 'eslint-plugin-astro';
// Shared base configuration
const baseConfig = {
ignores: ['dist/**', 'node_modules/**'],
plugins: {
'@typescript-eslint': tsPlugin,
'unused-imports': unusedImports,
'astro': astroPlugin,
},
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/triple-slash-reference': 'off',
'no-unused-vars': 'off',
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
'no-trailing-spaces': 'error',
},
};
export default [
// JavaScript/TypeScript configuration
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
...baseConfig,
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
},
// Astro configuration
{
files: ['**/*.astro'],
...baseConfig,
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: ['.astro'],
},
},
rules: {
...baseConfig.rules,
'astro/semi': ['error', 'always'],
},
},
];