markuplint / markuplint

An HTML linter for all markup developers.
https://markuplint.dev
MIT License
548 stars 48 forks source link

Syntax errors when compiling Pug in Vite #1872

Closed life-screw closed 2 weeks ago

life-screw commented 2 weeks ago

I get the following error in Vite version 5.2.0: The following error was encountered when compiling Pug.

Unsupported syntax: The "Extends" node
Unsupported syntax: The "Include" node
Unsupported syntax: The "RawInclude" node

Versions used:

"markuplint": "^4.9.1",
"@markuplint/pug-parser": "^4.6.4"

Downgrading to version 4.0.0 produced the same error.

What could be the cause of this issue? Is the latest version 5.2.0 of Vite not supported?

Here is the package.json configuration:

{
  "name": "recruit-site-coding",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "html:lint": "markuplint \"src/**/{*.pug,*.html}\"",
    "style:lint": "stylelint \"src/**/*.scss\"",
    "es:lint": "eslint \"src/**/*.js\"",
    "lint": "npm run html:lint && npm run style:lint -- --fix && npm run es:lint -- --fix",
    "dev": "npm run lint && vite",
    "preview": "npm run lint && vite preview"
  },
  "devDependencies": {
    "@macropygia/vite-plugin-pug-static": "^0.0.20",
    "autoprefixer": "^10.4.19",
    "css-declaration-sorter": "^7.2.0",
    "eslint": "^9.5.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "markuplint": "^4.9.1",
    "@markuplint/pug-parser": "^4.6.4",
    "postcss-sort-media-queries": "^5.2.0",
    "sass": "^1.77.5",
    "stylelint": "^16.6.1",
    "stylelint-config-recess-order": "^5.0.1",
    "stylelint-config-recommended-scss": "^14.0.0",
    "stylelint-config-standard": "^36.0.0",
    "stylelint-order": "^6.0.4",
    "stylelint-prettier": "^5.0.0",
    "stylelint-scss": "^6.3.1",
    "vite": "^5.2.0"
  }
}

Please check the above configuration.

YusukeHirao commented 2 weeks ago

Hi @life-screw.

The Vite environment is entirely separate from Markuplint, so it would be great if we could consider them independently.

Regarding the Pug error, I have some ideas about what might be causing it, but I'm unsure. If you could share the Pug source code, it would really help me understand the issue better.

Thanks a lot!

life-screw commented 2 weeks ago

Hi @YusukeHirao

After reviewing the Vite configuration, I was able to compile the Pug! Thanks for your quick reply!