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 false negatives on second run for cache and severity
option
#6384
Conversation
🦋 Changeset detectedLatest commit: a85f2e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@kimulaco Thanks for creating the PR. I am looking into this bug. So, the bug seems related to not plugins but severity. See the code below. If Lines 219 to 222 in 751acda
Then, Lines 79 to 81 in 751acda
The following is a production: ⬇️ $ cat a.css
a { colo: red; }
$ cat package.json
{
"dependencies": {
"stylelint": "14.13.0"
},
"stylelint": {
"rules": {
"property-no-unknown": [true, { "severity": "warning" }]
}
}
}
$ rm -f .stylelintcache
$ npx stylelint *.css --cache -f json | jq -c '.[0].warnings'
[{"line":1,"column":5,"endLine":1,"endColumn":9,"rule":"property-no-unknown","severity":"warning","text":"Unexpected unknown property \"colo\" (property-no-unknown)"}]
$ npx stylelint *.css --cache -f json | jq -c '.[0].warnings'
[] We can see the second run emits no warnings. On the other hand, the second run emits warnings after changing the severity from $ npx stylelint *.css --cache -f json | jq -c '.[0].warnings'
[{"line":1,"column":5,"endLine":1,"endColumn":9,"rule":"property-no-unknown","severity":"error","text":"Unexpected unknown property \"colo\" (property-no-unknown)"}]
$ npx stylelint *.css --cache -f json | jq -c '.[0].warnings'
[{"line":1,"column":5,"endLine":1,"endColumn":9,"rule":"property-no-unknown","severity":"error","text":"Unexpected unknown property \"colo\" (property-no-unknown)"}] |
@ybiquitous Thanks. I thought I needed to cache the result. But I could understand that it was caused by a condition to remove the cache. |
@kimulaco I hope you don't mind. I appreciate your contribution to this project. 😊 |
severity
option
@ybiquitous I fixed. It contains a new approach, so I would like your opinion. First, I reverted all codes that cache the Then, I added stylelint/docs/user-guide/usage/node-api.md Lines 53 to 55 in 59d6a3f
|
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.
@kimulaco Thank you, LGTM! 👍🏼
In addition, could you please add a changelog entry? The entry line should be like this (from the PR title): ⬇️
Fixed: false negatives on second run for cache and `severity` option
@ybiquitous Thanks for the review! I added a changelog. a85f2e1 |
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.
Thanks, LGTM 👍🏼
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.
LGTM, thank you!
Closes #4715
No, it's self-explanatory.