-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
docs(repo): update spectral in javascript examples #2181
Conversation
@heitortsergent you could get https://app.circleci.com/pipelines/github/stoplightio/spectral/8590/workflows/3b058b3a-1fbf-4403-b316-6227242bf319/jobs/30750 step to pass? |
docs/guides/3-javascript.md
Outdated
const { Spectral } = require("@stoplight/spectral-cli"); | ||
const { Resolver } = require("@stoplight/json-ref-resolver"); | ||
```js title="example-5.mjs" lineNumbers | ||
import { join } from "path"; |
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.
this probably won't work, because we use require
to load the module.
Suggest to leave CJS here for now until we support ESM for custom resolvers
docs/guides/3-javascript.md
Outdated
## Linting a YAML String | ||
### CommonJS and ESM | ||
|
||
The examples on this page are written in ESM. If you're using CommonJS, you have to import an additional module: |
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.
This is only for custom functions. I don't think we cover custom functions on this page, thus I think we can remove it
@P0lip thanks for the comments! I used Stoplight to make those changes. The CircleCI lint error there was related to the PR title, so I updated that. Now I'm getting a different error about the commit message...
Not sure how to fix it... Should I rebase the commits and change the message so they follow the format |
I'm sorry, I just read the contributing guidelines 🤦 . Still wanna be sure this is the best way to fix the lint issues, should I rebase and fix the commit messages, and force push here? |
I can do that for you |
e95bf3e
to
c1d4b74
Compare
@P0lip thanks for doing the rebase! I was having some issues with |
…spec Co-authored-by: Phil Sturgeon <67381+philsturgeon@users.noreply.github.com>
502bff4
to
e57abd1
Compare
@P0lip are there any other changes you would like me to make before we can get this merged? |
Looks good! |
Fixes #2178, #2148.
Checklist
Does this PR introduce a breaking change?
Additional context
I tried to make this document a little bit more beginner-friendly as I tried to run some of these examples myself while learning Spectral:
require
statements toimport
bundleAndLoadRuleset
methodNot sure if I tried to do too many changes here, would really appreciate some feedback!