Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: recommend disable the rule for files which have already handled by esling-plugin-prettier #249

Open
JounQin opened this issue Jul 8, 2022 · 0 comments

Comments

@JounQin
Copy link
Member

JounQin commented Jul 8, 2022

What version of stylelint, prettier and stylelint-prettier are you using?

stylelint: 14.9.1
prettier: 2.7.1
stylelint-prettier: 2.0.0

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

Conflict with prettier-plugin-svelte, because postcss-html extract CSS only for .svelte files, so stylelint-svelte only receives css parts but try to parse it as svelte.

What source code are you linting?

<script lang="ts">
let count = 1

// the `$:` means 're-run whenever these values change'
$: doubled = count * 2
$: quadrupled = doubled * 2

function handleClick() {
  count += 1
}
</script>

<button class="test" on:click={handleClick}>Count: {count}</button>

<p>{count} * 2 = {doubled}</p>
<p>{doubled} * 2 = {quadrupled}</p>

<style>
.test {
  border: transparent;
}
</style>

What did you expect to happen?

No error

What actually happened?

ParseError: Expected }
  1 | .test {
> 2 |   border: transparent;
    |        ^
  3 | }
    at error (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17805:20)
    at Parser$1.error (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17881:10)
    at Parser$1.eat (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17895:19)
    at mustache (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17566:17)
    at new Parser$1 (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17840:22)
    at Object.parse$3 [as parse] (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/compiler.js:17972:21)
    at Object.parse (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier-plugin-svelte@2.7.0_o3ioganyptcsrh6x4hnxvjkpqi/node_modules/prettier-plugin-svelte/plugin.js:1934:83)
    at Object.parse (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/index.js:7334:23)
    at coreFormat (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/index.js:8645:18)
    at formatWithCursor2 (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/index.js:8837:18)
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/index.js:37229:12
    at Object.format (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/index.js:37243:12)
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint-prettier@2.0.0_ajb4dyjcjxvkvtnz4mzu4n3pcq/node_modules/stylelint-prettier/stylelint-prettier.js:107:35
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint@14.9.1/node_modules/stylelint/lib/lintPostcssResult.js:113:8
    at Array.map (<anonymous>)
    at lintPostcssResult (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint@14.9.1/node_modules/stylelint/lib/lintPostcssResult.js:104:18)
    at lintSource (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint@14.9.1/node_modules/stylelint/lib/lintSource.js:91:8)
    at async /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint@14.9.1/node_modules/stylelint/lib/standalone.js:228:27
    at async Promise.all (index 0)
    at async standalone (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/stylelint@14.9.1/node_modules/stylelint/lib/standalone.js:267:22)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant