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

Update stylelint to v13.0.0 #428

Merged
merged 2 commits into from
Jan 27, 2020
Merged

Update stylelint to v13.0.0 #428

merged 2 commits into from
Jan 27, 2020

Conversation

XhmikosR
Copy link
Member

@XhmikosR XhmikosR commented Jan 12, 2020

Requires #427 merged and tests to be fixed

Closes #433

},
"peerDependencies": {
"stylelint": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
"stylelint": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

BTW this is getting too long. We should probably drop some versions from here.

@XhmikosR
Copy link
Member Author

@hudochenkov: maybe you could have a quick look? It seems all of the percent-placeholder-pattern tests fail with v13.0.0. After some quick debugging it seems the cause it's stylelint/stylelint#4483

@hudochenkov
Copy link
Contributor

Your discovery is correct. This plugin uses internals of stylelint, which are not a public API.

https://github.com/kristerkari/stylelint-scss/blob/26097c6fd72aab40d76a90f176097ccd57a6c347/src/rules/percent-placeholder-pattern/index.js#L44-L52

https://github.com/kristerkari/stylelint-scss/blob/26097c6fd72aab40d76a90f176097ccd57a6c347/src/utils/isStandardSelector.js

https://github.com/kristerkari/stylelint-scss/blob/26097c6fd72aab40d76a90f176097ccd57a6c347/src/utils/isStandardRule.js

I would suggest copy required utils from stylelint (isStandardSelector, isStandardRule) prior change we made in stylelint/stylelint#4483.

stylelint concerns about standard CSS only, that's why we have these utils. stylelint-scss expand concern by allowing Sass syntax. That's why utils should be different for both projects.

@XhmikosR
Copy link
Member Author

Thanks for the reply :) TBH I think stylelint-scss should not duplicate everything, hence why I made #430, because I see a lot seemingly identical code.

That being said, for the time being, I will try first your suggestion so that we can update to the latest version and leave the other refactoring changes for later :)

@hudochenkov
Copy link
Contributor

TBH I think stylelint-scss should not duplicate everything, hence why I made #430, because I see a lot seemingly identical code.

This comes with a price, that something could break even with patch release of stylelint :)

I think you need to change isStandardRule only for now.

@XhmikosR
Copy link
Member Author

I was under the impression that utils were part of the public API too. Is there a list of things that are officially part of the public API?

@hudochenkov
Copy link
Contributor

@XhmikosR
Copy link
Member Author

XhmikosR commented Jan 12, 2020

The thing is that stylelint.utils is pretty vague IMHO. I'd need to print the object to see this. Would be nice if the docs covered this somehow.

Or does it mean that only the mentioned utils methods are exposed?

@hudochenkov
Copy link
Contributor

I think only exposed methods are available.

@XhmikosR
Copy link
Member Author

Hmm, then I guess we need the opposite of #430 so that we are safe. Have you guys thought about exposing the other utils too? Currently there's like 500 lines of code and 15 files that are duplicated, and if we add more files this will keep increasing.

@hudochenkov
Copy link
Contributor

There were never discussion about this. You can start one in stylelint repo :)

@github-actions
Copy link

Coverage Status

Coverage decreased (-0.2%) to 92.06% when pulling 080922f on stylelint-13 into 26097c6 on master.

@XhmikosR XhmikosR force-pushed the stylelint-13 branch 2 times, most recently from 8f1bac9 to 8683ca7 Compare January 13, 2020 16:17
@XhmikosR
Copy link
Member Author

@kristerkari I think this is ready for review after #427 is merged. I added the upstream code and tests before the breaking change.

@kristerkari
Copy link
Collaborator

Thanks! I've been away from home for the weekend and at work today the whole day, but I'll try to get this reviewed asap.

@kristerkari
Copy link
Collaborator

btw. I merged #427

@ntwb ntwb mentioned this pull request Jan 14, 2020
@XhmikosR XhmikosR marked this pull request as ready for review January 14, 2020 06:03
@XhmikosR
Copy link
Member Author

Rebased. I'm not sure if the new upstream files I backported make all sense; I see code for Less etc.

@XhmikosR
Copy link
Member Author

I split this for easier review.

@XhmikosR
Copy link
Member Author

@kristerkari frinedly ping for this and the other open PRs

},
"peerDependencies": {
"stylelint": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm... I'm still not sure if it's a good idea to drop support for everything else than the newest version.

Copy link
Member Author

@XhmikosR XhmikosR Jan 23, 2020

Choose a reason for hiding this comment

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

Well, the thing is that

  1. what was the last time you tested stylelist-scss master with stylelint 8.0.0? Or any version other than the latest?
  2. if you are going to make sure every future version works with stylelint, why don't you just use >=?
  3. This should be a major release IMO and we should try to merge Remove babel. #429 too, which makes it a good time to remove this

Copy link
Member Author

Choose a reason for hiding this comment

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

I can revert it BTW, my initial patch didn't change this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what was the last time you tested stylelist-scss master with stylelint 8.0.0? Or any version other than the latest?

I don't think that you really understand my point of view here. I don't really care about stylelint version 8, and I don't know if it has even any users other than some outdated projects. I just don't think that it is a good idea to drop the support for 5 versions at the same time, as the chances that there are people using some those versions is really high.

I actually have one React Native project where I had to lock the stylelint version to v9.x because newer stylelint versions depend on some dependency that uses @types/node which messes up the Typescript typings for React Native in my project and causes Typescript to throw errors.

I've ran into similar issues with other npm packages, where I could not update to the latest version of a package because it required the newest version of a peer dependency, so the only solution is not to update.

The thing is that managing peer dependency versions is a complicated thing, and IMO the best way is to gradually drop supported versions from the end and release those in separate releases.

if you are going to make sure every future version works with stylelint, why don't you just use >=?

Because I don't know if the version that we have now works with a stylelint version that gets released two years from now. That's why the versions are whitelisted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hence why I reverted that change and I just added v13.0.0 in peerDependencies.

I still believe this should be cleaned up later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it definitely should be cleaned up, but I need to see if there is any data about downloads per stylelint version to get an idea if people are still using those old versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure where you can find such metrics TBH.

Anyway, I assume this PR should be good to go as is? I need to rebase a few of my other PRs after this gets merged.

@pustovalov
Copy link

WDYT about drop node 8 support?
stylelint/stylelint#4500

@XhmikosR
Copy link
Member Author

The thing is that it seems stylelint-scss works with Node.js 8.x and maybe old stylelint versions.

IMHO we should grab this opportunity and:

  1. drop Node.js < 10 support
  2. drop babel (see Remove babel. #429)
  3. reduce the supported stylelint versions in peerDependencies since we only test the latest

@XhmikosR
Copy link
Member Author

Friendly ping @kristerkari ^^

@kristerkari kristerkari merged commit 4ea73e7 into master Jan 27, 2020
@XhmikosR XhmikosR deleted the stylelint-13 branch January 27, 2020 13:26
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.

Stylelint v13 support
4 participants