-
Notifications
You must be signed in to change notification settings - Fork 195
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
chore: update stylelint config settings #2406
Conversation
2c18ffb
to
2b40bcb
Compare
File metricsSummaryTotal size: 3.92 MB* 🎉 No changes detected in any packages * Size determined by adding together the size of the main file for all packages in the library.* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
🚀 Deployed on https://pr-2406--spectrum-css.netlify.app |
f44bc84
to
6bdda03
Compare
7cce861
to
3d6678c
Compare
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.
I was able to verify that the commands in the validation instructions are working, with --verbose
needed to see the warnings in the output. I tested out the plugins by modifying CSS and running linter on Accordion:
Plugins testing
no-unknown-custom-properties - working
--spectrum-accordion-test-2: var(--spectrum-test-undefined);
stylelint-no-unused-custom-properties - not working?
--spectrum-test: red;
--spectrum-accordion-test: 10px;
I'm not seeing a warning for either of these added test properties.
stylelint-no-missing-parenthesis stylelint-no-missing-var - working
--spectrum-accordion-item-width: --spectrum-accordion-minimum-width;
(also tested w/ line break)
stylelint-no-missing-var stylelint-no-missing-parenthesis - is this still needed?
I already get a regular syntax error from the lint command when testing out the missing bracket examples: "Unclosed bracket CssSyntaxError". Is this now covered by the linter by default? I wasn't able to create an example where I could see a warning from this plugin because of the syntax error being raised first.
- `yarn lint`: Provides helpful updates and warnings for a component's package.json file. This helps keep all components in alignment. | ||
- Use `yarn lint --fix` to automatically fix any issues that are found. | ||
- To run on a single component, use `yarn linter accordion` (where `accordion` is the name of the component or components you want to lint). |
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.
Could we add something about using the --verbose
flag to show warnings? Currently the commands will only show errors. It might also be worth noting that --fix
will try to fix both warnings and errors.
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.
If possible, I'd like to add this as a backlog story as well so we can focus on the build rework and return to this for documentation.
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.
I'll add the other reason I want to hold off documenting this is because it's more complex than just adding a verbose flag. You can use that or set the NX_VERBOSE_LOGGING=true
variable in your .env or your ~/.env local file. I've also evaluated in build tooling updates forcing the verbose output which would not require a flag.
/^--spectrum-(global|alias|component)-/, | ||
/^--spectrum-animation-/, |
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.
I'm curious if we could drop these two ignore settings. I tested removing them and found at least one usage of a "spectrum-global" variable that should not be used within a migrated component. It looks like global/alias/component are there to avoid warnings in non-migrated components that use those old tokens (I think the components being deprecated and the in-review Icon are the last remaining?).
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.
When we remove the last @spectrum-css/vars package, I think that's the time to remove these entries rather than in advance. While I like the idea that we'd catch them in migrated components, it's a nice-to-have vs. throwing a false error on un-migrated assets.
const rootIdx = parts.indexOf("components"); | ||
const componentRoot = parts.slice(0, rootIdx + 2).join(path.sep); | ||
|
||
function fetchResolutions(depName) { |
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.
Could you add a JSDoc style comment to this function, as well as some additional comments in this file for some of the larger blocks of code (e.g. line 73, 86, 107, etc)?
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.
I can but can we make that a post-merge to-do since it's not affecting functionality? Only ask because this is a step toward simplifying the build migration and the build migration is my main focus. I can add a backlog story to ensure this gets returned to.
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.
(Part of my hesitation to do it now is that I didn't write the plugin, it was written by Rajdeep for the build rework so to add a solid JS-doc, I'd need to read through the whole thing again and re-acquaint myself with it's inner workings)
3d6678c
to
1e413fa
Compare
This isn't verifying missing brackets, but rather, missing var functions. Did you test adding a |
Sorry, that comment was actually meant for the "stylelint-no-missing-parenthesis". I've edited the original comment. |
32538b3
to
c7fe3a7
Compare
@jawinn Should be ready for a re-review |
- feat: remove theme files without content
c7fe3a7
to
c1d8f20
Compare
@jawinn Ah yes good call-out. This latest update includes removing |
Looking good! I am seeing One last thing I saw when running Do we also want to disable the |
Genuinely no idea what's that referring to. If you look at the config, it's using null. I don't see any signs of false being used. Update moved a few validation items around and that seems to make it a bit less angry. Was throwing a false error. Should be good now though! |
82e704b
to
68b8b20
Compare
@jawinn Oh and I pushed up a removal of stylelint from the lint-staged task list and just replaced it with a vanilla prettier. |
68b8b20
to
4b9af79
Compare
Description
This PR updates the stylelint settings and adds a listing task to the build.
New stylelint plugins:
Removes stylelint-suit-naming-pattern in favor of the existing selector-bem-pattern plugin:
How and where has this been tested?
yarn lint
: runs and reports linting errors to the consoleyarn linter accordion
: runs linter against accordion and reports errors to the consoleyarn linter accordion --fix
: runs linter and fixes what it can in the pre-compiled assets in the accordion package. Note do not commit these updated assets at this time (at least not as part of this PR).yarn test:plugins
: this new command runs the existing test suite for the stylelint plugins and reports their success (or failure).Tested by @jawinn -- note:
--verbose
is needed to see warnings. I also saw that the automatic--fix
can create duplicate declarations, though I'm assuming this is expected to not be perfect and won't be run without human intervention of the output before commit.To-do list