-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix css properties check in bem mod files #172
fix css properties check in bem mod files #172
Conversation
for (let i = 0; i < filename.length; i++) { | ||
const part = filename.slice(0, -i); | ||
if (componentNamePattern.test(part)) return part; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks really clunky, but I'm not sure how to determine the implicit component name without adding another regex for that in the config.
index.js
Outdated
@@ -80,6 +81,7 @@ module.exports = postcss.plugin( | |||
validateCustomProperties({ | |||
rule, | |||
componentName: range.defined, | |||
selectorPattern: patterns.componentSelectors, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config.selectorPattern
is unused inside of validateCustomProperties
, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, thanks
Looks like a good fix to me. I'm not familiar with having modifiers across multiple files but I'm a bit out of touch with BEM practices these days I've just merged an outstanding PostCSS 8 update as well, could you rebase on master and make sure this still passes as expected? Thanks a lot |
Sure, thanks We encountered a bug related to the fix in one of our projects, I'll try fixing that and then will rebase |
ae1d147
to
ba4bfa0
Compare
Just rebased, thanks Tests still pass |
@simonsmith, could you please have a look? |
It looks good to me, thanks for this! |
Thank you) |
When valid custom css property name is redefined in the modifier file, error about invalid property name is thrown.
For example, we have three files:
// component.css
// component_mod.css
Second file is currently not considered valid:
While the third file is okay:
// component_mod2.css
Test repo: https://github.com/andieelmes/test-postcss-bem-linter
Lint job: https://github.com/andieelmes/test-postcss-bem-linter/actions/runs/5314755305/jobs/9622321460