|
| 1 | +import { defineConfig } from "@eslint/config-helpers"; |
1 | 2 | import * as astroESLintParser from "astro-eslint-parser"; |
2 | 3 | import astroPlugin from "eslint-plugin-astro"; |
3 | | -import tseslint from "typescript-eslint"; |
4 | 4 | import * as typescriptESLintParserForExtraFiles from "typescript-eslint-parser-for-extra-files"; |
5 | 5 |
|
6 | 6 | import { __dirname } from "../lib/dir"; |
7 | | -import { astroFiles, tsFiles } from "../utils/files"; |
| 7 | +import { prepareForExtend } from "../utils/eslint"; |
| 8 | +import { astroFiles } from "../utils/files"; |
8 | 9 | import { jsConfig } from "./js"; |
9 | 10 | import { stylisticConfig } from "./stylistic"; |
10 | 11 | import { tsConfig } from "./typescript"; |
11 | 12 |
|
12 | | -export const astroConfig = tseslint.config( |
13 | | - { |
14 | | - files: [tsFiles], |
15 | | - languageOptions: { |
| 13 | +export const astroConfig = defineConfig({ |
| 14 | + extends: prepareForExtend( |
| 15 | + jsConfig, |
| 16 | + stylisticConfig, |
| 17 | + tsConfig({ extraFiles: true }), |
| 18 | + astroPlugin.configs.recommended, |
| 19 | + astroPlugin.configs["jsx-a11y-strict"], |
| 20 | + ), |
| 21 | + files: [astroFiles], |
| 22 | + languageOptions: { |
| 23 | + parser: astroESLintParser, |
| 24 | + parserOptions: { |
16 | 25 | parser: typescriptESLintParserForExtraFiles, |
17 | | - parserOptions: { |
18 | | - project: true, |
19 | | - projectService: false, |
20 | | - tsconfigRootDir: __dirname, |
21 | | - }, |
| 26 | + project: true, |
| 27 | + projectService: false, |
| 28 | + tsconfigRootDir: __dirname, |
22 | 29 | }, |
23 | 30 | }, |
24 | | - { |
25 | | - extends: [ |
26 | | - ...jsConfig, |
27 | | - ...stylisticConfig, |
28 | | - ...tsConfig, |
29 | | - ...astroPlugin.configs.recommended, |
30 | | - ...astroPlugin.configs["jsx-a11y-strict"], |
31 | | - ], |
32 | | - files: [astroFiles], |
33 | | - languageOptions: { |
34 | | - parser: astroESLintParser, |
35 | | - parserOptions: { |
36 | | - parser: typescriptESLintParserForExtraFiles, |
37 | | - project: true, |
38 | | - projectService: false, |
39 | | - tsconfigRootDir: __dirname, |
40 | | - }, |
41 | | - }, |
42 | | - name: "@virtual-live-lab/eslint-config/astro", |
43 | | - rules: { |
44 | | - "astro/no-set-html-directive": "error", |
45 | | - "astro/no-set-text-directive": "error", |
46 | | - "astro/no-unused-css-selector": "error", |
47 | | - "astro/prefer-class-list-directive": "error", |
48 | | - "astro/prefer-object-class-list": "error", |
49 | | - "astro/prefer-split-class-list": "error", |
50 | | - "astro/sort-attributes": "error", |
51 | | - }, |
| 31 | + name: "@virtual-live-lab/eslint-config/astro", |
| 32 | + rules: { |
| 33 | + "astro/no-set-html-directive": "error", |
| 34 | + "astro/no-set-text-directive": "error", |
| 35 | + "astro/no-unused-css-selector": "error", |
| 36 | + "astro/prefer-class-list-directive": "error", |
| 37 | + "astro/prefer-object-class-list": "error", |
| 38 | + "astro/prefer-split-class-list": "error", |
| 39 | + "astro/sort-attributes": "error", |
52 | 40 | }, |
53 | | -); |
| 41 | +}); |
0 commit comments