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

Add TODO@version stylelint rule (local) #946

Merged
merged 3 commits into from
Oct 23, 2019
Merged

Conversation

shawnbot
Copy link
Contributor

@shawnbot shawnbot commented Oct 14, 2019

This adds a new local stylelint rule that looks for comments in the following form:

// TODO@<version>: <message>

...and compares the <version> with either the current version in package.json or the PRIMER_VERSION environment variable (useful for testing!) and, if the comment version is >= the current version (in semver), fails the test.

Rationale

This offers a more ad-hoc and enforceable way of queueing up tasks for a forthcoming release. I've included #945 in this PR as a test case, which you can validate with:

PRIMER_VERSION=14.0.0 npm run stylelint

...which outputs:

src/navigation/underline-nav.scss
✖ Unresolved TODO comment: "remove &.selected" (expected to be resolved in "14.0.0") (primer-css/TODO)

The idea is that if we merge this into #925, it should fail until we remove the &.selected from the selector and the // TODO@14.0.0: remove &.selected comment.

@simurai what do you think? Is this a good idea, or am I over-thinking things?

@vercel
Copy link

vercel bot commented Oct 14, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/primer/primer-css/h5exnmi6b
🌍 Preview: https://primer-css-git-test-todos.primer.now.sh

@shawnbot shawnbot requested a review from simurai October 14, 2019 23:51
@shawnbot shawnbot changed the base branch from master to release-14.0.0 October 14, 2019 23:52
Copy link
Contributor

@simurai simurai left a comment

Choose a reason for hiding this comment

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

Is this a good idea, or am I over-thinking things?

I think it's great for fixing things in patches/minors and then not forget about cleaning up later.

Although not sure about removing .selected for UnderlineNav just yet, see https://github.com/primer/css/pull/945/files#r334718266.

@shawnbot
Copy link
Contributor Author

After taking a fresh look at this, I think having a separate script with different error output is unnecessary here, since the lint step in our Actions setup will output the same error. In fact, if it's working right, we'd never get to this standalone test because lint will short-circuit the whole run. So I'm going to delete script/test-todos.js and revert df9c926 before merging this.

@shawnbot shawnbot changed the base branch from release-14.0.0 to release-13.2.0 October 22, 2019 18:53
@shawnbot shawnbot mentioned this pull request Oct 22, 2019
15 tasks
@shawnbot shawnbot changed the title Add TODO@version comment tests Add TODO@version stylelint rule (local) Oct 22, 2019
@vercel vercel bot temporarily deployed to staging October 23, 2019 16:26 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants