Skip to content

Commit 51a1740

Browse files
committed
Fix eslint config to allow dot notation in .astro layout files
1 parent 52f4619 commit 51a1740

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎eslint.config.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'node:path'
2+
import { fileURLToPath } from 'node:url'
13
import eslint from '@eslint/js'
24
import astroPlugin from 'eslint-plugin-astro'
35
import importPlugin from 'eslint-plugin-import'
@@ -11,6 +13,7 @@ import noHtmlElementAssertionsRule from './test/eslint/no-html-element-assertion
1113
import noQuerySelectorOutsideSelectorsRule from './test/eslint/no-query-selector-outside-selectors-rule'
1214

1315
const level = 'error'
16+
const tsconfigRootDir = path.dirname(fileURLToPath(import.meta.url))
1417

1518
const errorDefinitionIgnores = [
1619
'src/lib/errors/**/*',
@@ -300,6 +303,15 @@ export default [
300303
'src/components/**/*.astro',
301304
'src/pages/**/*.astro',
302305
],
306+
languageOptions: {
307+
parser: astroPlugin.parser,
308+
parserOptions: {
309+
parser: tsPlugin.parser,
310+
project: './tsconfig.json',
311+
tsconfigRootDir,
312+
extraFileExtensions: ['.astro'],
313+
},
314+
},
303315
rules: {
304316
'@typescript-eslint/dot-notation': [level, { allowIndexSignaturePropertyAccess: true }],
305317
},

0 commit comments

Comments
 (0)