Closed sennyeya closed 1 year ago
Hey! That sounds good to me. I've been thinking about doing that too. However, there's one potential caveat to watch out for - that package should be isomorphic and work in any modern ES environment. Currently some of the formatters may rely on modules or globals specific to Node.js and that'd have to be addressed beforehand.
Happy to assist if needed. If you're up for that, you could indeed move the formatters into a separate package or maybe make it a part of packages/core. I could take care of the Node.js bit of the issue.
:tada: This issue has been resolved in version 6.7.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@P0lip Sorry for the late follow up on this, I'm trying to use this now and unable to import it in my yarn project. Any advice? Getting a module not found error on a simple import like import { pretty } from '@stoplight/spectral-formatters';
. Tried tweaking with the exports
of @stoplight/spectral-formatters
s package.json
locally, but no luck. My project is using the default classic
TypeScript moduleResolution
, which doesn't have support for exports
.
Hey @sennyeya! I'll take a look at it today. Could you share your tsconfig.json?
Thanks, https://github.com/backstage/backstage/blob/master/tsconfig.json Here's the main tsconfig.json, there's also the extends one which is https://github.com/backstage/backstage/blob/master/packages/cli/config/tsconfig.json.
@sennyeya old TS moduleResolution will be supported once #2482 is merged
@P0lip Great, thanks for the quick turnaround!
:tada: This issue has been resolved in version 1.18.1 :tada:
The release is available on npm package (@latest dist-tag)
Your semantic-release bot :package::rocket:
User story. As a developer who wants to use Spectral in JS/TS, I can do create custom formatting, so that I can format my text output from an internal command without subshelling out to
spectral-cli
.Is your feature request related to a problem? I'm looking to use the existing formatters in
sepctral-cli
in Javascript but cannot as they are not exported from thecli
package.Describe the solution you'd like Expose the formatters from their own package
@stoplight/spectral-formatters
. Alternatively, they could be exposed from the CLI, but would prefer their own package.Additional context I'm happy to submit a PR, this should be pretty straightforward.