Skip to content
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 positives for variables in selector-type-case #3395

Closed
wants to merge 3 commits into from

Conversation

YozhikM
Copy link
Contributor

@YozhikM YozhikM commented Jun 13, 2018

Which issue, if any, is this issue related to?

Closes #3391

Is there anything in the PR that needs further explanation?

No.

@YozhikM YozhikM requested a review from jeddy3 June 13, 2018 22:07
Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YozhikM
Copy link
Contributor Author

YozhikM commented Jun 14, 2018

I don't know why tests not passed

Now using node v6.14.3 (npm v3.10.10)
iMac--USER:stylelint yozhikm$ yarn test system-tests/fix/fix.test.js
yarn run v1.7.0
$ npm-run-all --serial lint flow
$ npm-run-all --parallel lint:*
$ eslint . --cache
$ remark . --quiet --frail
$ flow
No errors!
$ jest --coverage system-tests/fix/fix.test.js
 PASS  system-tests/fix/fix.test.js
  fix
    ✓ expected stylelint results (162ms)
    ✓ expected fixes to PostCSS Result (34ms)
    ✓ overwrites the original file (38ms)
    ✓ doesn't write to ignored file (8ms)
    ✓ outputs fixed code when input is code string (23ms)

@jeddy3
Copy link
Member

jeddy3 commented Jun 14, 2018

I don't know why tests not passed

I've restarted it.

@hudochenkov
Copy link
Member

@YozhikM thank you for adding a test. Can you add a test for every new condition you've added to that utility, please? Currently, it covers only one case.

normalizedValue = normalizedValue.slice(1);
}

// SCSS variable
Copy link
Member

@jeddy3 jeddy3 Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to look into this issue more closely.

I think we need to:

  • establish how we test against a non-standard custom syntax i.e. postcss-jsx in this instance
  • confirm exactly what syntax is causing the original bug

The first one could involve a change to testRule so that the syntax property accepts a parser function as well as a string. We'd then include postcss-jsx as a dev dependency.

The latter one needs an investigation into what non-standard syntax can be used in a selector. For example, I'm pretty sure that within Scss and Less you can only use variables within interpolation, which makes those conditionals in the isStandard* util redundant.

Additionally, it might be worth waiting until #3284 is merged before revisiting this issue as version 4 of the selector parser is less likley to categorize these things as tag selectors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which cases is the percent sign used before the selector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeddy3 I agree with your opinion. Shall we put it off for the present?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which cases is the percent sign used before the selector?

I believe the Scss placeholder.

Shall we put it off for the present?

I think so.

@hudochenkov
Copy link
Member

Assigned label “blocked”, as we agreed to wait for #3284 to be merged first.

@hudochenkov hudochenkov added the pr: blocked is blocked by another issue or pr label Jun 17, 2018
@jeddy3 jeddy3 changed the title Improve TypeSelector check Fix false positives for variables in selector-type-case Jun 18, 2018
@brandonkal
Copy link

The other issue has been merged so it appears this can now be unblocked.

@alexander-akait
Copy link
Member

Yes, this PR can be continue

@hudochenkov
Copy link
Member

Blocked by #3988

@hudochenkov hudochenkov removed the pr: blocked is blocked by another issue or pr label Dec 28, 2019
@hudochenkov
Copy link
Member

@YozhikM looks like PR we though is blocking this PR is not going to be merged soon. Could you resolve merge conflicts, so we can review again, please?

@Mouvedia
Copy link
Member

Mouvedia commented Mar 3, 2021

looks like PR we though is blocking this PR is not going to be merged soon.

#3988 was superseded by #4595, which was merged.

@jeddy3
Copy link
Member

jeddy3 commented May 19, 2021

Resolved by addition of ignoreTypes secondary option.

@jeddy3 jeddy3 closed this May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix false positives for variables in selector-type-case
6 participants