diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:56:55 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:56:55 +0300 |
| commit | c735556726e75428550a3d28a2cf58e2c8490b7d (patch) | |
| tree | fd0ae29d1636b825abeedff6b99d3376bb383135 /eslint.config.js | |
Initial template
Diffstat (limited to 'eslint.config.js')
| -rw-r--r-- | eslint.config.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..3961a84 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,59 @@ +import astroEslintParser from 'astro-eslint-parser'; +import eslintPluginAstro from 'eslint-plugin-astro'; +import globals from 'globals'; +import js from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import typescriptParser from '@typescript-eslint/parser'; + +export default [ + js.configs.recommended, + ...eslintPluginAstro.configs['flat/recommended'], + ...tseslint.configs.recommended, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + }, + { + files: ['**/*.astro'], + languageOptions: { + parser: astroEslintParser, + parserOptions: { + parser: '@typescript-eslint/parser', + extraFileExtensions: ['.astro'], + }, + }, + }, + { + files: ['**/*.{js,jsx,astro}'], + rules: { + 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'], + }, + }, + { + // Define the configuration for `<script>` tag. + // Script in `<script>` is assigned a virtual file name with the `.js` extension. + files: ['**/*.{ts,tsx}', '**/*.astro/*.js'], + languageOptions: { + parser: typescriptParser, + }, + rules: { + // Note: you must disable the base rule as it can report incorrect errors + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + }, + ], + '@typescript-eslint/no-non-null-assertion': 'off', + }, + }, + { + ignores: ['dist', 'node_modules', '.github', 'types.generated.d.ts', '.astro'], + }, +]; |
