-
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
Feature: automate file-name definititions #88
Comments
What if user wants to almost always |
@davidtheclark,
preset: "suit",
implicitComponents: "components/**/*.css"
implicitUtilities: "css/util/*.css" Means: Capture everything under "components" folder as define name. And, capture everything under "css/util" as "utilities".
preset: "suit",
implicitComponents: true,
explicitComponents: "css/**/*.css,vendor/**/*.css" Means: capture everything as define name. Except thing in "css" or "vendor" folders. |
Good idea. I like the simple option names and the glob idea. I'd suggest arrays of globs instead of globs with commas in them: Open to a PR implementing this! |
I like this. I think opt-in is a nice route as it's the least disruptive for existing users. So with components we'd use the filename as the definition, and with utilities if the glob matched then we'd assume it wanted to be linted? |
@simonsmith, |
This would be an awesome feature! |
I'd be happy to start looking at this. Components make sense but I'm still unsure on utilities:
Can you expand on that @robcolburn? I suppose we could:
Thoughts? |
@simonsmith Sounds good but I'm not sure if using the file name to check the selectors covers all cases. Let's say, I want to enforce a dash-separated naming-pattern ( Example (file name: .notificationBox { // Would be covered (and throw an exception)
&--errorMessage { // Should throw an exception
...
}
&__closeButton { // Should throw an exception
...
}
} The corrected example would be: .notification-box {
&--error-message {
...
}
&__close-button {
...
}
} I hope I'm not missing something! |
I think the goal here is just to use the filename for The part after is |
Thoughts on I was thinking a single |
I created a pull request for adding the first half of the functionality defined here: Add implicitComponents and implicitUtilities option #93. |
@seamusleahy Nice one! |
👍 Changed teams, and haven't touched CSS in a while. Awesome to see
someone take this on. Nice job!
|
This really perhaps really a feature-request for
stylelint-selector-bem-pattern
, but I'll leave it here since that module mostly wraps this one.I know explicit definitions are great, and they work for many people, but… I'm lazy. I would like to enforce our rules BEM rules.
Let's say for an example project we standardize on SUIT, and mandate it into our component file-structure. File-structure looks something like:
So, we setup our config
Now, we have something like 50 components to add a "define" block too to enforce our pattern and manually enforce new components include the
define
.This is okay, but if we just implicit the
define
from the filename.Now, when
components/DogCard/DogCard.css
is passed to the linter we imply/** @define DogCard */
If someone wants to add a utility lib, no problem, they'll get a warning can use
utilities
to opt-out./** @define utilities */
I'm sure some work will need to be done to
stylelint-selector-bem-pattern
as well, but it probably starts here.//cc @davidtheclark
The text was updated successfully, but these errors were encountered: