-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
feat(ruleset-migrator): implement ruleset migrator #1698
Conversation
303a321
to
cf87716
Compare
d3894fa
to
97e5d22
Compare
2953884
to
4e94c40
Compare
import { migrateRuleset } from '@stoplight/spectral-ruleset-migrator'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/require-await | ||
const AsyncFunction = (async (): Promise<void> => void 0).constructor as FunctionConstructor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I even want to know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, long story short - in rare circumstances a "top-level" await might be inserted.
This won't be a problem soon-ish once we hop on ESM, but for the time being it's a plain CommonJS.
The above is needed for us to be able to do
AsyncFunction('module.exports = await /* the rest of the code goes here */)'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narrator: it turns out he really did not want to know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
🎉 This PR is included in version @stoplight/spectral-cli-v1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @stoplight/spectral-core-v1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @stoplight/spectral-ruleset-migrator-v1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @stoplight/spectral-runtime-v1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# @stoplight/spectral-cli-v1.0.0 (2021-07-08) ### Features * **cli:** demand some ruleset to be present ([#1699](#1699)) ([3baba29](3baba29)) * **cli:** implement --stdin-filepath flag ([#1712](#1712)) ([45b15a2](45b15a2)) * **core:** support overrides in rulesets ([#1684](#1684)) ([153d685](153d685)) * **core:** use double quotes in errors reported by Ajv ([#1718](#1718)) ([dd2a166](dd2a166)) * **ruleset-migrator:** implement ruleset migrator ([#1698](#1698)) ([efa5c50](efa5c50)) * **ruleset-migrator:** inline external rulesets & support exceptions ([#1711](#1711)) ([2a1d2d3](2a1d2d3))
Closes https://github.com/stoplightio/platform-internal/issues/6763
Checklist
Does this PR introduce a breaking change?
Yes
![HonestWork](https://user-images.githubusercontent.com/587740/124295681-1fe15280-db27-11eb-947c-1e58cc0c2cd7.jpg)
No
Additional context
Make sure to read f90d2c8
Tests account for ~50% of the whole diff
One can apply the following filter to filter out the majority of test artefacts.