When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-less", and use the "customSyntax" option
See original GitHub issueWhat steps are needed to reproduce the bug?
package.json:
{
"name": "123",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"postcss": "^8.4.14",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"stylelint": "^14.9.1",
"stylelint-config-recess-order": "^3.0.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard": "^26.0.0"
}
}
color.less:
@primary: #03b9f3;
@base-text-color: #E7F9FF;
What Stylelint configuration is needed to reproduce the bug?
module.exports = {
root: true,
extends: [
'stylelint-config-standard',
'stylelint-config-recess-order',
'stylelint-config-recommended-vue',
],
overrides: [
{
files: '**/*.less',
customSyntax: 'postcss-less',
},
{
files: '**/*.vue',
customSyntax: 'postcss-html',
},
],
rules: {
indentation: 2,
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['mixin', 'extend', 'content', 'include'],
},
],
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['deep'],
},
],
'function-no-unknown': [true, {
ignoreFunctions: ['if'],
}],
},
};
How did you run Stylelint?
Use vscode plug-in or run scripts to format
Which version of Stylelint are you using?
14.19.1
What did you expect to happen?
There are no warnings and the code is formatted normally
What actually happened?
Whenever I tried to save and format, he warned me
Does the bug relate to non-standard syntax?
Less
Proposal to fix the bug
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
stylelint for less - 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/**/*.les ...
Read more >Migrating to 14.0.0 - Stylelint
If you use Stylelint to lint anything other than CSS files, you will need to ... the appropriate PostCSS syntax yourself and use...
Read more >Unknown Word on SCSS mixin function using Stylelint
When linting something other than CSS, you should install an appropriate syntax, e.g."postcss-scss", and use the "customSyntax" option.
Read more >Stylelint - Nova Extensions - Panic Inc.
Even if you don't explicitly install or configure custom syntax modules, you're almost certainly using them whenever linting non-CSS files. Additionally, while ...
Read more >stylelint | Yarn - Package Manager
A mighty, modern linter that helps you avoid errors and enforce conventions in your ... has over 170 built-in rules for modern CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The should be related to
vscode-stylelint
does not supportpnpm
well, you can try to usepublic-hoist-pattern[]=*stylelint*
in you project level.npmrc
and runpnpm install
to install, then reload vscode.@ybiquitous Thank you very much for your suggestions. I prefer the customization of stylelint’s personalized rules, which is much freer than Prettier
Should I close this issue?