Skip to content

Commit

Permalink
fix(eslint-config): support typescript in astro script blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
DerYeger committed Feb 6, 2025
1 parent f647d8d commit 55a02ab
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-points-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@yeger/eslint-config': patch
---

support typescript in astro script blocks
16 changes: 9 additions & 7 deletions packages/eslint-config/src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,6 @@ export default function (...configs) {
},
{
files: ['**/*.astro'],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
},
rules: {
'antfu/no-top-level-await': 'off',
'style/indent-binary-ops': 'off',
Expand All @@ -146,6 +139,15 @@ export default function (...configs) {
'unused-imports/no-unused-vars': 'off',
},
},
{
files: ['**/*.astro/*.js'],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
},
{
files: ['**/*.bench.ts'],
rules: {
Expand Down
15 changes: 15 additions & 0 deletions packages/eslint-config/tests/Test.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
import { Image } from 'astro:assets'
async function log() {
// eslint-disable-next-line no-console
console.log(Image)
return Promise.resolve()
}
await log()
---

<script>
const test: number = 0
</script>

0 comments on commit 55a02ab

Please sign in to comment.