Fix custom syntax module path not properly resolving
See original GitHub issueClearly describe the bug
As per https://github.com/stylelint-scss/stylelint-config-standard-scss/issues/2, custom syntax module path is not properly resolved.
Stylelint tries to resolve custom syntax location (stylelint/stylelint@main
/lib/getPostcssResult.js#L95) but uses Node require
algorithm, so it search from that file upwards.
If you have dependancy tree where postcss-scss
is not in one of the root directories, but is nested inside this config’s node_modules
(it happens if you have different versions of same package), path resolution fails.
Which rule, if any, is the bug related to?
None, it’s related to core functionality
What code is needed to reproduce the bug?
Even empty SCSS file would do.
What Stylelint configuration is needed to reproduce the bug?
{
"extends": "stylelint-config-standard-scss"
}
But postcss-scss
shouldn’t be installed inside root node_modules
.
Which version of Stylelint are you using?
14.0.0
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
stylelint "**/*.scss"
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
Yes, it’s related to SCSS custom syntax.
What did you expect to happen?
Should return at least error/warning related to style code or exit code 0
if everything is OK.
What actually happened (e.g. what warnings or errors did you get)?
Cannot resolve custom syntax module "postcss-scss". Check that module "postcss-scss" is available and spelled correctly.
at getCustomSyntax (node_modules/stylelint/lib/getPostcssResult.js:97:10)
at getPostcssResult (node_modules/stylelint/lib/getPostcssResult.js:41:5)
at lintSource (node_modules/stylelint/lib/lintSource.js:76:20)
at Function.standalone [as lint] (node_modules/stylelint/lib/standalone.js:132:26)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:22 (11 by maintainers)
Top GitHub Comments
Welp seems like I’m not just a user anymore lol
It’s incompatible versions of
postcss
, notpostcss-scss
. You’ll need to useyarn why postcss
to find them.