simonsmith / stylelint-selector-bem-pattern

Stylelint plugin that incorporates postcss-bem-linter
MIT License
244 stars 13 forks source link

Update postcss-bem-linter to v^4.0.0 #62

Closed andieelmes closed 1 year ago

andieelmes commented 1 year ago

There is a fix in a new version

simonsmith commented 1 year ago

The API to postcss-bem-linter has changed with the postcss 8 update.

I tried the following change:

var bemLinterResult = new Result();
- bemLinter(options)(root, bemLinterResult)
+ bemLinter(options).Once(root, {result: bemLinterResult});
var bemLinterWarnings = bemLinterResult.warnings();

Error is:

TypeError: opts.node.rangeBy is not a function
    at new Warning (/Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss/lib/warning.js:9:29)
    at Result.warn (/Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss/lib/result.js:26:19)
    at /Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss-bem-linter/lib/validate-selectors.js:57:21
    at Array.forEach (<anonymous>)
    at module.exports (/Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss-bem-linter/lib/validate-selectors.js:40:13)
    at checkRule (/Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss-bem-linter/index.js:86:9)
    at /Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss-bem-linter/index.js:53:11
    at Array.forEach (<anonymous>)
    at /Users/simonsmith/Sites/stylelint-selector-bem-pattern/node_modules/postcss-bem-linter/index.js:50:16

I'm not familiar with the changes in postcss 8.

@bjentsch Is there anything obvious here that you could help with? 😄

bjentsch commented 1 year ago

@bjentsch Is there anything obvious here that you could help with? smile

I'll have a look and come back to you ASAP 😘

simonsmith commented 1 year ago

Nice work on this @andieelmes! Thanks

I think you can also remove Node 12 from the CI as it looks like Stylelint dropped support for it

https://github.com/stylelint/stylelint/issues/6311

simonsmith commented 1 year ago

Released - https://www.npmjs.com/package/stylelint-selector-bem-pattern/v/3.0.0

Thanks for the help

andieelmes commented 1 year ago

Thank you!

bjentsch commented 1 year ago

Damn, you guys are fast. Thanks for your work!