mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
62cacbe5f5
This patch implements documentation linter, which leaves under `test/doclint` folder. The documentation linter works like this: 1. Parse javascript source code with esprima and construct a "documentation" out of source code 2. Generate HTML out of `api.md` and traverse the HTML with puppeteer. 3. Make sure javascript aligns nicely with HTML The documentation linter adds the following commands: - `yarn doc` - to test that documentation covers all the relevant apis - `yarn generate-toc` - to update the table-of-contents for the `api.md`
27 lines
519 B
JavaScript
27 lines
519 B
JavaScript
let Documentation = {};
|
|
|
|
Documentation.Class = class {
|
|
/**
|
|
* @param {string} name
|
|
* @param {!Array<!Documentation.Method>} methodsArray
|
|
*/
|
|
constructor(name, methodsArray) {
|
|
this.name = name;
|
|
this.methodsArray = methodsArray;
|
|
this.methods = new Map();
|
|
for (let method of methodsArray)
|
|
this.methods.set(method.name, method);
|
|
}
|
|
};
|
|
|
|
Documentation.Method = class {
|
|
/**
|
|
* @param {string} name
|
|
*/
|
|
constructor(name) {
|
|
this.name = name;
|
|
}
|
|
};
|
|
|
|
module.exports = Documentation;
|