-
-
Notifications
You must be signed in to change notification settings - Fork 947
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
Remove unused condition #4497
Remove unused condition #4497
Conversation
Sorry for my bad explanation. Your code does not check
for this range command |
I guess we need tests for this first. Even failing. |
@vankop do you think we can figure out the problem in the coming week? I would like to release new stylelint soon. Don't want to release another major release in case disabled ranges fix is a breaking change. |
Actually I don't understand reason of throwing error here... Maybe skip command is better |
We have only one test, where this condition is stylelint/lib/__tests__/disableRanges.test.js Lines 604 to 610 in 2dfd779
|
ccaab2e
to
0cf39f6
Compare
So we need to add test case:
and update code to catch error in this case =) |
I've added test. This test isn't failing and without removing extra condition. In fact, we have no tests which would use run condition |
lib/__tests__/disableRanges.test.js
Outdated
return testDisableRanges( | ||
'a {} /* stylelint-disable-line block-no-empty */\n/* stylelint-enable */', | ||
).then((result) => { | ||
expect(result.stylelint.disabledRanges).toEqual({ |
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.
We must expect error here since there is nothing to enable, if I understand correctly condition with No rules have been disabled
error =)
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.
You're right :)
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.
Hah, I found a bug in ranges assignment, I will do fix
@@ -81,7 +81,7 @@ it('needlessDisables complex case', () => { | |||
ranges: [ | |||
{ start: 5, end: 5, unusedRule: 'color-named' }, | |||
{ start: 6, end: 6, unusedRule: 'block-no-empty' }, | |||
{ start: 8, unusedRule: 'block-no-empty' }, | |||
{ start: 8, end: 10, unusedRule: 'block-no-empty' }, |
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.
test expectation was wrong.. see https://github.com/stylelint/stylelint/blob/master/lib/__tests__/fixtures/disableOptions/disabled-ranges-2.css
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.
Great job, @vankop! Github won't let me approve, but I approve :)
|
Closes #4328.
I'm not sure I understood the problem correctly ¯\_(ツ)_/¯ But look like removing incorrect condition fixes types issue, and doesn't break any test.