Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Move to shared config #49

Merged
merged 10 commits into from Aug 17, 2017
Merged

Move to shared config #49

merged 10 commits into from Aug 17, 2017

Conversation

ismay
Copy link
Member

@ismay ismay commented Jun 21, 2017

Closes #45
Closes #9

This'll be a breaking change. It can break builds because we're now prohibiting the use of vendor-prefixed properties and values, and a failure to include the config as a dependency could potentially break builds as well (unfixable rules won't be ignored anymore).

  • Add as peerDependency in package.json
  • Remove ignored rules, don't modify stylelint result (too much :)
  • Update readme

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.333% when pulling c493139 on move-to-shared-config into 3c43e97 on master.

@mxstbr
Copy link
Member

mxstbr commented Aug 17, 2017

Wait, what's missing here? Is this done? We should release this with 1.0!

@mxstbr mxstbr added this to the v1.0 milestone Aug 17, 2017
@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

@mxstbr Definitely. I was waiting for the more significant refactors, but yeah this should definitely be a part of v1 as it'll be a breaking change. I'll update the pr to allow for feedback. But it should be quite simple.

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Rebased it on master. The package-lock update is actually unrelated to this pr, but something that always happens for me with greenkeeper lockfile updates. For some reason a regular npm install changes the lockfile, even though no new dependencies were installed. Happens only for me when greenkeeper's updated the lockfile, weird.

Anyway. I've added stylelint-config-styled-components-processor as a peerDependency. One thing I've been thinking about is where the config should be tested. Way I see it, is that we could just add some simple tests to the stylelint-config-styled-components-processor repo, just to verify that it's ignoring and enforcing the correct rules.

Other than that the todo's above are all I think should be changed. Let me know if there's anything that I've overlooked!

@emilgoldsmith
Copy link
Member

For some reason a regular npm install changes the lockfile, even though no new dependencies were installed. Happens only for me when greenkeeper's updated the lockfile, weird.

It could be because the greenkeeper-lockfile repo uses a different version of npm than you / the CI uses a different version than you, not something I've double checked but I know some of the newer versions of NPM do these optimizations to the lockfile, so could be that.
But yeah weird for sure.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9f85932 on move-to-shared-config into fbf7805 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9f85932 on move-to-shared-config into fbf7805 on master.

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Updated typescript to the version that typescript-eslint-parser currently supports (2.4.0). I could take it out since it isn't specifically related to this pr, but I was getting a bunch of warnings during testing. Still feels weird to bundle typescript as a dependency btw, when it seems more appropriate as a peerDependency. Maybe good to discuss that in another issue, don't know how you feel about that?

But back to the matters at hand: index.js has been updated to no longer ignore any stylelint rules. @emilgoldsmith notice anything I might have missed? Basically I think this is it, and we just need to update the readme and release stylelint-config-styled-components-processor on npm.

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Great thing is that now we're also not relying too much on the internal structure of the stylelintResult anymore. Only thing we're doing is replace brace with backtick, which should be quite safe :).

@emilgoldsmith
Copy link
Member

Yeah this is a really cool idea @ismay! I'll just take a bit of time to look at this and the repo you created to understand exactly what it is we're doing so I can give better feedback but I'll get back to you ASAP!

Also, I was just thinking, since we probably don't want to for example release this one before 1.0 (unless we just publish a 0.4.0 of course) we could make a 1.0 branch now that we merge this and other breaking stuff like my PR into until we're ready to publish and then merge it into master?

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Yeah this is a really cool idea @ismay! I'll just take a bit of time to look at this and the repo you created to understand exactly what it is we're doing so I can give better feedback but I'll get back to you ASAP!

Cool thanks!

Also, I was just thinking, since we probably don't want to for example release this one before 1.0 (unless we just publish a 0.4.0 of course) we could make a 1.0 branch now that we merge this and other breaking stuff like my PR into until we're ready to publish and then merge it into master?

Yeah sounds like a good idea 👍

@emilgoldsmith
Copy link
Member

Updated typescript to the version that typescript-eslint-parser currently supports (2.4.0). I could take it out since it isn't specifically related to this pr, but I was getting a bunch of warnings during testing.

Yeah I was getting that as well, it was so annoying, thanks for updating it! I don't think it should be a problem doing it in this PR though it could of course be seen as cleaner doing it in a different one.

Still feels weird to bundle typescript as a dependency btw, when it seems more appropriate as a peerDependency. Maybe good to discuss that in another issue, don't know how you feel about that?

Yeah why is it it's a dependency by the way? It shouldn't need to be a peerDependency either should it? As in, if you don't use Typescript you shouldn't need it, couldn't we just make it a devDependency since the only reason we have it here is for testing, right? Or am I missing something?

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Yeah why is it it's a dependency by the way? It shouldn't need to be a peerDependency either should it? As in, if you don't use Typescript you shouldn't need it, couldn't we just make it a devDependency since the only reason we have it here is for testing, right? Or am I missing something?

I think we did that because typescript-eslint-parser throws if typescript can't be found (or complained anyway). Which is annoying for people who don't use our processor for typescript as they have no need for typescript in their project. So we're basically stuck with this situation unless it can somehow be fixed on typescript-eslint-parser's end (by not doing the check until it's actually instantiated or something, don't know what they're doing exactly).

@emilgoldsmith
Copy link
Member

I think we did that because typescript-eslint-parser throws if typescript can't be found (or complained anyway).

Hmm that's a pain <.<. When I'm done reviewing this which should be in a sec I'll just look at our code regarding Typescript as I have never looked at that, mostly out of curiosity, would be awesome if we could remove that dependency somehow for sure though it doesn't sound like it.

Copy link
Member

@emilgoldsmith emilgoldsmith left a comment

Choose a reason for hiding this comment

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

This review is purely things I just noticed now that has nothing to do with your PR :P. I'd love responses to this, and if they incur changes they should definitely not be handled in this PR, but in others and we can open an issue or something. But yeah I'll do a real review now ^^.

src/index.js Outdated
@@ -1,16 +1,6 @@
const path = require('path')
const parse = require('./parsers/index')
// TODO Fix ampersand in selectors
Copy link
Member

Choose a reason for hiding this comment

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

What is it we mean here? Is this still a TODO?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I was also curious about that. @mxstbr Can we remove this? Was this related to the stylelint rules we wanted to enforce?

Copy link
Member

Choose a reason for hiding this comment

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

No idea anymore haha, let's get rid of it!

src/index.js Outdated
if (ignoredRules.includes(warning.rule)) return prevWarnings
const correctedWarning = Object.assign(warning, {
const warnings = stylelintResult.warnings.map(warning =>
Object.assign(warning, {
// Replace "brace" with "backtick" in warnings, e.g.
// "Unexpected empty line before closing backtick" (instead of "brace")
Copy link
Member

Choose a reason for hiding this comment

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

This wouldn't be correct if it you had a declaration block inside of your backticks, right? Maybe we should do some check and only do that replace if it's on line 0 or the last line of the block?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah there's definitely a lot more stuff we could/should do with the warnings in the future! Could get a bit smarter 😊

Copy link
Member

Choose a reason for hiding this comment

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

Okay I'll open a quick issue to keep it on our radar, but it's definitely not high prio :)

Copy link
Member

@emilgoldsmith emilgoldsmith left a comment

Choose a reason for hiding this comment

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

I know this isn't something new you introduced in the PR but something that was already there, but it's a small change and unless you have a good reason for keeping it I'd prefer changing it?

Otherwise this looks great, and also the other repo, I really like this idea, so much cleaner, and gives the user some more freedom and flexibility. Really nice initiative :D

src/index.js Outdated
if (ignoredRules.includes(warning.rule)) return prevWarnings
const correctedWarning = Object.assign(warning, {
const warnings = stylelintResult.warnings.map(warning =>
Object.assign(warning, {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm for good form I might not mutate warning and do Object.assign({}, warning, {. Also see my comment on line 32 below.

src/index.js Outdated

return Object.assign(stylelintResult, { warnings: newWarnings })
return Object.assign(stylelintResult, { warnings })
Copy link
Member

Choose a reason for hiding this comment

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

As we currently mutate warning in the .map above this is actually unnecessary right? I think with current mutations this is actually the same as just returning stylelintResult. I understand that's not as clear though, so maybe I'd recommend just not mutating and following my suggestion above and then also not mutating here? As in again add a first argument {}.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, fixed it as per your suggestions

@emilgoldsmith emilgoldsmith changed the base branch from master to 1.0 August 17, 2017 11:15
@emilgoldsmith
Copy link
Member

I just created a 1.0 branch and change the base, I'll go change the base of my PR now as well :)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 24d6a1f on move-to-shared-config into fbf7805 on 1.0.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 24d6a1f on move-to-shared-config into fbf7805 on 1.0.

Copy link
Member

@emilgoldsmith emilgoldsmith left a comment

Choose a reason for hiding this comment

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

Looks great, so now we just need to update the README, right?

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

I've created #99 btw, as a reminder of the typescript dependency discussion.

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

Looks great, so now we just need to update the README, right?

Yep, and I'll doublecheck whether the shareable config has been published on npm.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling e152b93 on move-to-shared-config into fbf7805 on 1.0.

@emilgoldsmith
Copy link
Member

@ismay I just reverted the Typescript version here as I thought now we have the #101 PR we can just as well handle it there, yeah?

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

@emilgoldsmith Ready to be merged, if you agree on the readme updates.

@ismay
Copy link
Member Author

ismay commented Aug 17, 2017

@ismay I just reverted the Typescript version here as I thought now we have the #101 PR we can just as well handle it there, yeah?

Yeah sounds good 👍

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 2d655a9 on move-to-shared-config into fbf7805 on 1.0.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 2d655a9 on move-to-shared-config into fbf7805 on 1.0.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 2d655a9 on move-to-shared-config into fbf7805 on 1.0.

@emilgoldsmith
Copy link
Member

Looks good to me! I'm a big fan of this PR, let's merge it in :D

@emilgoldsmith emilgoldsmith merged commit d7d0122 into 1.0 Aug 17, 2017
@emilgoldsmith emilgoldsmith deleted the move-to-shared-config branch August 17, 2017 12:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants