Skip to content

Not working with PUG template #617

@enrico-hic

Description

@enrico-hic

What version of eslint are you using?
8.55.0

What version of prettier are you using?
3.1.0

What version of eslint-plugin-prettier are you using?
5.0.1

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

{
  "tabWidth": 2,
  "printWidth": 100,
  "singleQuote": true,
  "semi": false,
  "trailingComma": "all",
  "bracketSpacing": true,
  "bracketSameLine": false,
  "arrowParens": "always",
  "plugins": ["@prettier/plugin-pug"],
  "pugSortAttributes": "asc"
}

.eslintrc.json

{
  "env": {
    "browser": true,
    "commonjs": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:prettier/recommended"
  ],
  "plugins": [
    "pug"
  ],
  "parserOptions": {
    "ecmaVersion": "latest"
  }
}

What source code are you linting?
The plugin is working incorrectly in the files that use template pug (jade).
In the other files (like js) it is working correctly.

What did you expect to happen?
Report errors using the command eslint file.pug and highlight errors in the editor (VS Code).

What actually happened?
The errors are not highlighted in the editor but when I save the file is automatically formatted correctly using prettier.
The command eslint doesn't return any errors:

> eslint file.pug

npm timing command:run Completed in 202ms
npm verb exit 0
npm timing npm Completed in 223ms
npm info ok

But the command prettier report some errors:

> prettier file.pug --check

Checking formatting... : timing npm:load Completed in 18ms
[warn] file.pug
[warn] Code style issues found in the above file. Run Prettier to fix.
npm timing command:run Completed in 182ms
npm verb exit 1
npm timing npm Completed in 203ms
npm verb code 1

Steps to reproduce
You can find an example at this link: https://codesandbox.io/p/devbox/quizzical-joana-zlpzn8

Javascript working as expected:

  1. Run npm run prettier:js -> errors are found
  2. Run npm run lint:js -> errors from prettier are reported

Pug not working:

  1. Run npm run prettier:pug -> errors are found
  2. Run npm run lint:js -> no errors reported

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions