Skip to content

Commit

Permalink
Add missing jsdoc
Browse files Browse the repository at this point in the history
This also enables some ESlint rules that no longer need to be disabled.
  • Loading branch information
remcohaszing committed Feb 16, 2024
1 parent 958c9e5 commit 3033f31
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ extends:
rules:
func-style: off
'@typescript-eslint/no-invalid-this': off
import/no-extraneous-dependencies: off
jsdoc/require-jsdoc: off
3 changes: 3 additions & 0 deletions src/unified-prettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const unifiedPrettier: Plugin<[Options?]> = function unifiedPrettier(options) {
Atomics.wait(signal, 0, 0)

const { message } = receiveMessageOnPort(localPort) as {
/**
* The response from the web worker.
*/
message: Response
}

Expand Down
33 changes: 32 additions & 1 deletion src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,47 @@ import { format, getFileInfo, type Options, resolveConfig } from 'prettier'
/**
* @internal
*/
export type Response = { error: unknown } | { result: string }
export type Response =
| {
/**
* The error thas has occurred.
*/
error: unknown
}
| {
/**
* The success result.
*/
result: string
}

/**
* @internal
*/
export interface Payload {
/**
* The content to format.
*/
content: string

/**
* The file path to use for looking up the Prettier configuration.
*/
filepath: string

/**
* Prettier options that were passed manually.
*/
options: Options | undefined

/**
* The port to use to communicate from a worker to the main thread.
*/
port: MessagePort

/**
* The signal to use to communicate from a worker to the main thread.
*/
signal: Int32Array
}

Expand Down

0 comments on commit 3033f31

Please sign in to comment.