Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/giant-sheep-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-prettier': patch
---

chore: skip formatting inline scripts in pug files
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"plugins": ["prettier-plugin-pkg"]
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
"@eslint/js": "^8.55.0",
"@graphql-eslint/eslint-plugin": "^3.20.0",
"@prettier/plugin-pug": "^3.0.0",
"@types/eslint": "^8.44.7",
"@types/prettier-linter-helpers": "^1.0.1",
"commitlint": "^18.4.3",
Expand All @@ -74,6 +75,7 @@
"eslint-plugin-mdx": "^2.2.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-prettier": "link:.",
"eslint-plugin-pug": "^1.2.5",
"eslint-plugin-svelte": "^2.32.2",
"eslint-plugin-svelte3": "^4.0.0",
"graphql": "^16.7.1",
Expand Down
110 changes: 99 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/fixtures/pug.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
script.
a();;;;;;
10 changes: 10 additions & 0 deletions test/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const eslint = new ESLint({
files: '**/eslint-plugin-svelte/*.svelte',
extends: ['plugin:svelte/recommended'],
},
{
files: '*.pug',
plugins: ['pug'],
},
],
},
useEslintrc: false,
Expand Down Expand Up @@ -306,6 +310,12 @@ runFixture(
true,
);

/**
* The `script` code style actually does not match `prettier`'s,
* but we are skipping scripts in pug files
*/
runFixture('*.pug', [[]]);

// ------------------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ runAsWorker(
'mdx',
'angular',
'svelte',
'pug',
];
if (parserBlocklist.includes(/** @type {string} */ (inferredParser))) {
return;
Expand Down