Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylelint for less - The "syntax" option is no longer available #5663

Closed
PlayApple opened this issue Oct 28, 2021 · 6 comments
Closed

stylelint for less - The "syntax" option is no longer available #5663

PlayApple opened this issue Oct 28, 2021 · 6 comments

Comments

@PlayApple
Copy link

stylelint --fix "src/**/*.less" --syntax less
Error: The "syntax" option is no longer available. You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option

"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",

How to use customSyntax to fixed it? Thanks

@gwsbhqt
Copy link

gwsbhqt commented Oct 28, 2021

I have the same problem.

@jeddy3
Copy link
Member

jeddy3 commented Oct 28, 2021

See the migration guide.

You should install postcss-less:

npm install --save-dev postcss-less

And then either use the --custom-syntax flag:

"lint:style": "stylelint --fix \"src/**/*.less\" --custom-syntax postcss-less"

or use the customSyntax configuration object property:

{
  "customSyntax": "postcss-less",
  "rules": {
    ..
  }
}

You can also raise an issue in the 3rd party stylelint-config-recommended-less shared config to see if they'll be willing to bundle the postcss-less syntax in the config.

@jeddy3 jeddy3 closed this as completed Oct 28, 2021
@PlayApple
Copy link
Author

Thank you for your help. I encountered new problems after performing the operation.

TypeError: this.getPosition is not a function

"lint:style": "stylelint --fix "src/**/*.less" --custom-syntax postcss-less"

TypeError: this.getPosition is not a function
at LessParser.inlineComment (/web/node_modules/postcss-less/lib/LessParser.js:71:28)
at LessParser.isInlineComment (/web/node_modules/postcss-less/lib/nodes/inline-comment.js:37:12)
at LessParser.other (/web/node_modules/postcss-less/lib/LessParser.js:156:36)
at LessParser.parse (/web/node_modules/postcss/lib/parser.js:75:16)
at parse (/web/node_modules/postcss-less/lib/index.js:11:12)
at new LazyResult (/web/node_modules/stylelint/node_modules/postcss/lib/lazy-result.js:133:16)
at getPostcssResult (/web/node_modules/stylelint/lib/getPostcssResult.js:77:30)
at async lintSource (/web/node_modules/stylelint/lib/lintSource.js:76:4)
at async /web/node_modules/stylelint/lib/standalone.js:218:27
at async Promise.all (index 0)

@ybiquitous
Copy link
Member

ybiquitous commented Oct 28, 2021

@PlayApple Can you reproduce the error on the demo? (please share the demo URL)

@ybiquitous
Copy link
Member

Ref: #5666

@meatnordrink
Copy link

For anyone that encounters this later, the solution is

npm i --save-dev postcss@8

stylelint-scss/stylelint-config-standard-scss#5 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants