-
Notifications
You must be signed in to change notification settings - Fork 1
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
build(sdk): Add ESLint/prettier for the @mermaidchart/sdk
library
#13
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
packages/sdk/src/index.ts
Outdated
// don't care if this function rejects/resolves | ||
void this.resetAccessToken(); |
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.
@sidharthv96, this.resetAccessToken()
here returns a Promise
, but we're not await
-ing on it. This looks okay to me, but is this expected behaviour?
It looks like this.resetAccessToken()
in packages/office/src/lib/mermaidChartApi.ts
doesn't return a Promise, so maybe it's a bug:
public resetAccessToken() { |
plugins/packages/sdk/src/index.ts
Line 150 in 1ddbb2c
public async resetAccessToken(): Promise<void> { |
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.
Because it was not awaited, and if memory serves is being called from a non-async function, I removed the Promise expectation from the office version
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.
You can remove async from resetAccessToken. The implementation doesn't require it.
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.
Fixed by 203aabc
I was reluctant to make this change, since changing a function to/from async
is a breaking change, but 🤷, I think other than Mermaid-Chart/vscode-mermaid-chart#6, nobody is using the @mermaidchart/sdk
library. Plus, it will be easy for us to bump the version to ^0.2.0
.
Most of these were autofixed with `eslint --fix src/`
This matches TypeScript's default rules (e.g. what VS Code uses).
Change `MermaidChart#resetAccessToken()` so that it no longer returns a `Promise`.
203aabc
to
d536be5
Compare
📖 Description
This PR adds a
pnpm run lint
andpnpm run lint:fix
rule to thepackages/sdk
folder that runs ESLint and Prettier. I've also setup CI to run linting automatically, but only for thepackages/sdk
subfolder, since I don't want to cause merge conflicts with anything @jgreywolf is working on inpackages/office
.I've also fixed all of the ESLint and Prettier errors in the SDK (although most of them were from my recent PRs!).
There are no functionality changes to the code, it's all just formatting changes.
✍️ Type of Change