Skip to content

Commit

Permalink
fix: Need plugin to convert & to | when generating doc through jsdoc
Browse files Browse the repository at this point in the history
jsdoc does not support & for intersection types and will never support
it so we need a plugin to convert & to |. More information at
https://github.com/chriseaton/jsdoc-plugin-intersection

Or we could completely forgo jsdoc and use typescript tooling to
generate our doc (this way, no incompatibility between jsdoc and
typescript)
  • Loading branch information
ptbrowne committed Mar 1, 2021
1 parent 0d1e099 commit 53faa64
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions jsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["jsdoc-plugin-intersection"]
}
1 change: 1 addition & 0 deletions packages/cozy-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"btoa": "1.2.1",
"cozy-logger": "1.6.0",
"cozy-ui": "^34.0.0",
"jsdoc-plugin-intersection": "^1.0.4",
"mockdate": "^2.0.2",
"react": "16.13.1",
"react-redux": "^7.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-client/src/models/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export class Qualification {
)
if (qualification) {
/**
* @type {string?} - The qualification label.
* @type {string?}
*/
this.label = qualification.label
/**
* @type {string?} - The document purpose.
* @type {string?}
*/
this.purpose = attributes.purpose || qualification.purpose
this.sourceCategory =
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-client/types/cli/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export type DestroyableServer = any;
* })
* ```
*/
export function createClientInteractive(clientOptions: object, serverOpts: any): Promise<any> | CozyClient;
export function createClientInteractive(clientOptions: object, serverOpts: any): CozyClient | Promise<any>;
import CozyClient from "../CozyClient";
4 changes: 2 additions & 2 deletions packages/cozy-client/types/models/document.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export class Qualification {
*/
constructor(label: string, attributes?: QualificationAttributes);
/**
* @type {string?} - The qualification label.
* @type {string?}
*/
label: string | null;
/**
* @type {string?} - The document purpose.
* @type {string?}
*/
purpose: string | null;
sourceCategory: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type ReduxStore = any;
export type Token = any;
export type ClientResponse = any;
export type Manifest = any;
export type QueryFetchStatus = "loading" | "loaded" | "pending" | "failed";
export type QueryFetchStatus = "loading" | "loaded" | "failed" | "pending";
export type QueryState = {
id: string;
definition: QueryDefinition;
Expand Down
5 changes: 4 additions & 1 deletion scripts/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const main = async () => {
}
const pkgName = pkg.split('/')[1]
const template = `{{>main}}`
const templateData = jsdoc2md.getTemplateDataSync({ files })
const templateData = jsdoc2md.getTemplateDataSync({
files,
configure: path.join(__dirname, '../', 'jsdoc.json')
})
const output = jsdoc2md.renderSync({
data: templateData,
template: template
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7797,6 +7797,11 @@ jsdoc-parse@^5.0.0:
sort-array "^4.1.1"
test-value "^3.0.0"

jsdoc-plugin-intersection@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/jsdoc-plugin-intersection/-/jsdoc-plugin-intersection-1.0.4.tgz#32ffe7f74df30ed1e86272c272856e0fd9aa9451"
integrity sha512-5OGv+aWpp0pYRMnhaUeqijesIi/xD2z8IIwIlK+JsQ0sXzMjiWT2YgNSvxcd476pRdh70Xmby/l7GD3NkWcKcQ==

jsdoc-to-markdown@6:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jsdoc-to-markdown/-/jsdoc-to-markdown-6.0.1.tgz#55640eea7a4f56fa9353316648bf0775531811ff"
Expand Down

0 comments on commit 53faa64

Please sign in to comment.