diff --git a/.changeset/clever-heads-march.md b/.changeset/clever-heads-march.md new file mode 100644 index 00000000..bee78e32 --- /dev/null +++ b/.changeset/clever-heads-march.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-prettier": patch +--- + +fix eslint-plugin-astro + +

Hello {name}!

diff --git a/test/fixtures/eslint-plugin-astro/DefineVars.astro b/test/fixtures/eslint-plugin-astro/DefineVars.astro new file mode 100644 index 00000000..6580b351 --- /dev/null +++ b/test/fixtures/eslint-plugin-astro/DefineVars.astro @@ -0,0 +1,11 @@ +--- +const color = 'red'; +--- + + + +

Hello!

diff --git a/test/fixtures/eslint-plugin-astro/Inline.astro b/test/fixtures/eslint-plugin-astro/Inline.astro new file mode 100644 index 00000000..ac4918c3 --- /dev/null +++ b/test/fixtures/eslint-plugin-astro/Inline.astro @@ -0,0 +1,9 @@ +--- +const name = 'world'; +--- + + + +

Hello {name}!

diff --git a/test/fixtures/eslint-plugin-astro/Raw.astro b/test/fixtures/eslint-plugin-astro/Raw.astro new file mode 100644 index 00000000..1fb838fc --- /dev/null +++ b/test/fixtures/eslint-plugin-astro/Raw.astro @@ -0,0 +1,11 @@ +--- +const name = 'world'; +--- + + + +

Hello {name}!

diff --git a/test/prettier.mjs b/test/prettier.mjs index 1b994d3f..cf61f987 100644 --- a/test/prettier.mjs +++ b/test/prettier.mjs @@ -21,6 +21,7 @@ import recommendedConfig from '../recommended.js'; import htmlEslintParser from '@html-eslint/parser'; import * as eslintPluginMdx from 'eslint-plugin-mdx'; import eslintPluginSvelte from 'eslint-plugin-svelte'; +import eslintPluginAstro from 'eslint-plugin-astro'; import eslintPluginPug from 'eslint-plugin-pug'; import vueEslintParser from 'vue-eslint-parser'; import * as eslintPluginGraphql from '@graphql-eslint/eslint-plugin'; @@ -342,6 +343,8 @@ runFixture( svelteUnsupported, ); +runFixture('eslint-plugin-astro/*.astro', [[], [], [], []]); + runFixture('*.pug', [ [ { @@ -554,6 +557,30 @@ async function runFixture(pattern, asserts, skip) { ...config, files: ['**/eslint-plugin-svelte/*.svelte'], })), + ...eslintPluginAstro.configs['flat/base'].map(config => ({ + ...config, + ...(config.files + ? { + files: config.files.map(f => + f.includes('.astro') + ? f.replace('**/', '**/eslint-plugin-astro/') + : f, + ), + } + : {}), + })), + { + files: [ + '**/eslint-plugin-astro/*.astro/*.ts', + '**/eslint-plugin-astro/*.astro/*.js', + ], + languageOptions: { + parser: (await import('@typescript-eslint/parser')).default, + }, + rules: { + 'prettier/prettier': 'error', + }, + }, { files: ['**/*.pug'], plugins: { diff --git a/worker.mjs b/worker.mjs index 1451209f..905c4b87 100644 --- a/worker.mjs +++ b/worker.mjs @@ -168,6 +168,12 @@ runAsWorker( 'oxc', 'oxc-ts', 'hermes', + + // eslint-plugin-astro extracts