|
| 1 | +import astroEslintParser from 'astro-eslint-parser'; |
| 2 | +import eslintPluginAstro from 'eslint-plugin-astro'; |
| 3 | +import globals from 'globals'; |
| 4 | +import js from '@eslint/js'; |
| 5 | +import tseslint from 'typescript-eslint'; |
| 6 | +import typescriptParser from '@typescript-eslint/parser'; |
| 7 | + |
| 8 | +export default [ |
| 9 | + js.configs.recommended, |
| 10 | + ...eslintPluginAstro.configs['flat/recommended'], |
| 11 | + ...tseslint.configs.recommended, |
| 12 | + { |
| 13 | + languageOptions: { |
| 14 | + globals: { |
| 15 | + ...globals.browser, |
| 16 | + }, |
| 17 | + }, |
| 18 | + }, |
| 19 | + { |
| 20 | + files: ['**/*.astro'], |
| 21 | + languageOptions: { |
| 22 | + parser: astroEslintParser, |
| 23 | + parserOptions: { |
| 24 | + parser: '@typescript-eslint/parser', |
| 25 | + extraFileExtensions: ['.astro'], |
| 26 | + }, |
| 27 | + }, |
| 28 | + }, |
| 29 | + { |
| 30 | + files: ['**/*.{js,jsx,astro}'], |
| 31 | + rules: { |
| 32 | + 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'], |
| 33 | + }, |
| 34 | + }, |
| 35 | + { |
| 36 | + // Define the configuration for `<script>` tag. |
| 37 | + // Script in `<script>` is assigned a virtual file name with the `.js` extension. |
| 38 | + files: ['**/*.{ts,tsx}', '**/*.astro/*.js'], |
| 39 | + languageOptions: { |
| 40 | + parser: typescriptParser, |
| 41 | + }, |
| 42 | + rules: { |
| 43 | + // Note: you must disable the base rule as it can report incorrect errors |
| 44 | + 'no-unused-vars': 'off', |
| 45 | + '@typescript-eslint/no-unused-vars': [ |
| 46 | + 'error', |
| 47 | + { |
| 48 | + argsIgnorePattern: '^_', |
| 49 | + destructuredArrayIgnorePattern: '^_', |
| 50 | + }, |
| 51 | + ], |
| 52 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 53 | + }, |
| 54 | + }, |
| 55 | + { |
| 56 | + ignores: ['dist', 'node_modules', '.github', 'types.generated.d.ts'], |
| 57 | + }, |
| 58 | +]; |
0 commit comments