Skip to content

Commit b5c0dc5

Browse files
authoredDec 21, 2023
chore: skip formatting inline scripts in pug files (#619)
related: https://github.com/valpackett/eslint-plugin-pug and #617
1 parent 183f45c commit b5c0dc5

File tree

7 files changed

+120
-12
lines changed

7 files changed

+120
-12
lines changed
 

‎.changeset/giant-sheep-doubt.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-prettier': patch
3+
---
4+
5+
chore: skip formatting inline scripts in pug files

‎.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"arrowParens": "avoid",
33
"singleQuote": true,
4-
"plugins": ["prettier-plugin-pkg"]
4+
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"]
55
}

‎package.json

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
6464
"@eslint/js": "^8.55.0",
6565
"@graphql-eslint/eslint-plugin": "^3.20.0",
66+
"@prettier/plugin-pug": "^3.0.0",
6667
"@types/eslint": "^8.44.7",
6768
"@types/prettier-linter-helpers": "^1.0.1",
6869
"commitlint": "^18.4.3",
@@ -74,6 +75,7 @@
7475
"eslint-plugin-mdx": "^2.2.0",
7576
"eslint-plugin-n": "^16.3.1",
7677
"eslint-plugin-prettier": "link:.",
78+
"eslint-plugin-pug": "^1.2.5",
7779
"eslint-plugin-svelte": "^2.32.2",
7880
"eslint-plugin-svelte3": "^4.0.0",
7981
"graphql": "^16.7.1",

‎pnpm-lock.yaml

+99-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/fixtures/pug.pug

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
script.
2+
a();;;;;;

‎test/prettier.js

+10
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ const eslint = new ESLint({
5959
files: '**/eslint-plugin-svelte/*.svelte',
6060
extends: ['plugin:svelte/recommended'],
6161
},
62+
{
63+
files: '*.pug',
64+
plugins: ['pug'],
65+
},
6266
],
6367
},
6468
useEslintrc: false,
@@ -306,6 +310,12 @@ runFixture(
306310
true,
307311
);
308312

313+
/**
314+
* The `script` code style actually does not match `prettier`'s,
315+
* but we are skipping scripts in pug files
316+
*/
317+
runFixture('*.pug', [[]]);
318+
309319
// ------------------------------------------------------------------------------
310320
// Helpers
311321
// ------------------------------------------------------------------------------

‎worker.js

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ runAsWorker(
145145
'mdx',
146146
'angular',
147147
'svelte',
148+
'pug',
148149
];
149150
if (parserBlocklist.includes(/** @type {string} */ (inferredParser))) {
150151
return;

0 commit comments

Comments
 (0)
Please sign in to comment.