Skip to content

Commit

Permalink
chore: add failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jan 15, 2025
1 parent 90ef2f9 commit ccd2ece
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 2 additions & 6 deletions eslint-plugin-prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const eslintPluginPrettier = {
const source = sourceCode.text;

return {
Program(node) {
Program() {
if (!prettierFormat) {
// Prettier is expensive to load, so only load it if needed.
prettierFormat = /** @type {PrettierFormat} */ (
Expand Down Expand Up @@ -227,13 +227,9 @@ const eslintPluginPrettier = {
}
if (error.loc) {
message = message.replace(/ \(\d+:\d+\)$/, '');

context.report({ message, loc: error.loc });

return;
}

context.report({ message, node });
context.report({ message, loc: error.loc });

return;
}
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/invalid-prettierrc/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'node:path'

module.exports = {}
1 change: 1 addition & 0 deletions test/fixtures/invalid-prettierrc/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
2 changes: 2 additions & 0 deletions test/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ runFixture('eslint-plugin-svelte3/*.svelte', [[], []], svelteUnsupported);
*/
runFixture('*.pug', [[]]);

runFixture('invalid-prettierrc/*', []);

// ------------------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------------------
Expand Down

0 comments on commit ccd2ece

Please sign in to comment.