-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy patheslint.config.js
69 lines (68 loc) · 1.84 KB
/
eslint.config.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
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import * as mdx from 'eslint-plugin-mdx';
import eslintPluginAstro from 'eslint-plugin-astro';
import tsParser from "@typescript-eslint/parser";
import astroParser from 'astro-eslint-parser';
export default [
{files: ["**/*.{js,mjs,cjs,ts,md,mdx}"]},
{languageOptions: { globals: globals.browser }},
{
...pluginJs.configs.recommended,
files: ["**/*.{js,mjs,cjs}"]
},
...(tseslint.configs.recommended.map(config => ({
...config,
files: ["**/*.ts"]
}))),
{
name: 'ts-overrides',
rules: {
}
},
...(eslintPluginAstro.configs['flat/base'].map(config => {
return {
...config,
files: ["**/*.astro"],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: ['.astro'],
project: './tsconfig.json',
sourceType: 'module',
}
}
}})),
{
...mdx.flat,
// optional, if you want to lint code blocks at the same
processor: mdx.createRemarkProcessor({
lintCodeBlocks: false,
// optional, if you want to disable language mapper, set it to `false`
// if you want to override the default language mapper inside, you can provide your own
languageMapper: {},
}),
rules: {
...mdx.flat.rules,
// if you want to override some rules for md/mdx files
'mdx/remark': 'error',
'no-unused-expressions': 'off',
'remark-lint-no-undefined-references': 'off',
'no-undef': 'off',
}
},
{
files: ['**/*.astro'],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: ['.astro'],
project: './tsconfig.json',
sourceType: 'module',
}
}
}
];