Skip to content

Support pre-release versions in expiring-todo-comments rule #435

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

Merged

Conversation

lubien
Copy link
Contributor

@lubien lubien commented Nov 12, 2019

Fixes #432

Refactor tryToCoerceVersion

Don't coerce valid semver tags on expiring-todo-comments.

I'm not sure where to test this. Should I export (exports.tryToCoerceVersion) the function and test along with the rule itself (test/expiring-todo-comments.js)? @sindresorhus any idea?

Don't coerce valid semver tags on expiring-todo-comments
@lubien lubien changed the title Allow pre-release TODO comments (Fix #432) Allow pre-release TODO comments Nov 12, 2019
@sindresorhus
Copy link
Owner

Can you update the docs to explicitly show that prerelease versions are supported?

@sindresorhus
Copy link
Owner

I would use a fixture instead. Integration tests are usually better. Like the one in the issue:

// package.json
{ "version": "1.0.0-beta.1" }

// my-file.js
// TODO [>=1.0.0] Something must be removed

@lubien
Copy link
Contributor Author

lubien commented Nov 13, 2019

Sure I can do it later today.

Just be clear I'd have to create a fixture repo and put on test/integration/test.js like the others right?

@sindresorhus
Copy link
Owner

I was thinking: Publish an empty package with a prerelease version, add it as a dev dependency here, and just add another test here:

{
code: '// TODO [read-pkg-up@>=5.1.1]: when `read-pkg-up` version is >= 5.1.1',
errors: [versionMatchesError('read-pkg-up >= 5.1.1', 'when `read-pkg-up` version is >= 5.1.1')]
},

Support pre-releases and build properly as of https://semver.org/
* Added a fixture package
* Added some test cases to verify pre-relase spec comparison
@@ -50,6 +50,7 @@
"semver": "^6.3.0"
},
"devDependencies": {
"@lubien/fixture-beta-package": "^1.0.0-beta.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to mock one during test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally I haven't heard anything of sort. Tho for me this is pretty much all I need since I could handle all known cases so far.

lubien and others added 4 commits November 14, 2019 12:49

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@sindresorhus sindresorhus changed the title Allow pre-release TODO comments Support pre-release versions in expiring-todo-comments rule Nov 15, 2019
@sindresorhus sindresorhus merged commit a03132e into sindresorhus:master Nov 15, 2019
@lubien lubien deleted the compare-pre-release-todo-conditions branch November 15, 2019 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow pre-release todo comments
3 participants