hertzbeat icon indicating copy to clipboard operation
hertzbeat copied to clipboard

[BUG] the syntax option is no longer available

Open delei opened this issue 4 months ago • 2 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior

When I executed the following command

yarn lint:style

an error message appeared.

yarn run v1.22.22
$ stylelint "src/**/*.less" --syntax less --fix
Error: The "syntax" option is no longer available. You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option
    at getPostcssResult (/Users/deleiguo/WorkSpace/gitrepo/deleiguo/hertzbeat/web-app/node_modules/stylelint/lib/getPostcssResult.js:39:25)
    at lintSource (/Users/deleiguo/WorkSpace/gitrepo/deleiguo/hertzbeat/web-app/node_modules/stylelint/lib/lintSource.js:99:10)
    at async /Users/deleiguo/WorkSpace/gitrepo/deleiguo/hertzbeat/web-app/node_modules/stylelint/lib/standalone.js:210:27
    at async Promise.all (index 0)
    at async standalone (/Users/deleiguo/WorkSpace/gitrepo/deleiguo/hertzbeat/web-app/node_modules/stylelint/lib/standalone.js:253:22)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected Behavior

Using stylelint correctly

Steps To Reproduce

  1. In this enviroment
  • node: v20.18.3
  • yarn: 1.22.22
  1. Enter directory web-app

  2. Execute the following command

yarn lint:style

Environment

HertzBeat version(s): latest version

Debug logs

No response

Anything else?

No response

delei avatar Aug 29 '25 12:08 delei

I tried to use the customSyntax option instead of syntax, but I'm uncertain whether this is an issue with my local environment or whether it might impact CI.

delei avatar Aug 29 '25 12:08 delei

Updates

  • Add a new dependency postcss-less, specifying version 3.1.4.
  • Modify lint:style script in package.json
"lint:style": "stylelint \"src/**/*.less\" --custom-syntax postcss-less --fix"

The above proposal resolves the error reported in the issue. According to the CI workflow frontend-build-test.yml, this will not impact CI.

Question

This is the result of running it in a local environment. Given the large number of newly detected errors, I am still considering whether this is the most suitable solution.

Image

We should continue to look into this issue, hoping to receive further professional advice from front-end developers. Please feel free to leave comments or feedback.

Context

  • https://stylelint.io/migration-guide/to-14
  • https://github.com/stylelint/stylelint/issues/5663
  • https://github.com/stylelint/stylelint/issues/5666

delei avatar Sep 08 '25 17:09 delei