/
astro.js
55 lines (51 loc) · 1.11 KB
/
astro.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
const astroPlugin = require("eslint-plugin-astro");
const astroParser = (old = true) => (old ? "astro-eslint-parser" : require("astro-eslint-parser"));
const astroPlugins = (old = true) => (old ? ["astro"] : { astro: astroPlugin });
const astroRules = {
"react/jsx-key": 0,
"react/no-unknown-property": 0,
"react/self-closing-comp": 0,
};
module.exports = {
/** @type {import('eslint').Linter.Config} */
default: {
parserOptions: {
extraFileExtensions: [".astro"],
},
overrides: [
{
files: ["**/*.astro"],
plugins: astroPlugins(),
env: {
"astro/astro": true,
},
parser: astroParser(),
rules: astroRules,
},
{
files: ["**/*.astro/*.js", "*.astro/*.js"],
},
],
},
/** @type {import('eslint').Linter.FlatConfig[]} */
flat: [
{
languageOptions: {
globals: astroPlugin.environments.astro.globals,
parserOptions: {
extraFileExtensions: [".astro"],
},
},
},
{
languageOptions: {
parser: astroParser(false),
},
plugins: astroPlugins(false),
rules: astroRules,
},
{
files: ["**/*.astro/*.js", "*.astro/*.js"],
},
],
};