Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
electron-docs-linter
Advanced tools
Parse and validate Electron's API documentation.
npm install electron-docs-linter --save
To lint the docs:
electron-docs-linter path/to/electron/docs
If errors are found, they are printed to STDERR and the process exits un-gracefully.
To lint the docs and save the generated JSON schema to a file:
electron-docs-linter docs/api --version=1.2.3 --outfile=api.json
The module exports a function that parses markdown docs in a given directory, then returns a JSON representation of all the APIs.
const lint = require('electron-docs-linter')
const docPath = './test/fixtures/electron/docs/api'
const targetVersion = '1.2.3' // the soon-to-be-released version of electron
lint(docPath, targetVersion).then(function (apis) {
// `apis` is an array of API objects. To find one:
var win = apis.find(api => api.name === 'BrowserWindow')
// The array also has a string key for each API name, so
// you can access APIs like this too:
win = apis.BrowserWindow
win.events.length
// => 25
win.events[0]
// {
// "name": "page-title-updated",
// "description": "Emitted when the document...",
// "returns": [
// {
// "name": "event",
// "type": "Event"
// }
// ]
// }
win.instanceMethods[20]
// {
// name: 'setSize',
// signature: '(width, height[, animate])'
// }
})
The linter starts with a list of all the API names as seed data.
Each API's structure is inferred by parsing its raw markdown documentation from the electron repo. The electron-docs module abstracts away the challenges of fetching file contents in bulk.
Electron's API documentation adheres to Electron Coding Style and the Electron Styleguide, so its content can be programmatically parsed. To make the content easy to parse, the raw markdown is converted to HTML using marky-markdown-lite, which returns a cheerio DOM object that can be queried and traversed using familiar CSS selectors.
The result is an array of API objects. The following metadata is included for each API, where appropriate:
A lot of people want an up-to-date TypeScript definition file for Electron.
_.pick
exported as a module._.sum
exported as a module.rm -rf
)MIT
FAQs
A JSON object describing Electron's APIs
The npm package electron-docs-linter receives a total of 9 weekly downloads. As such, electron-docs-linter popularity was classified as not popular.
We found that electron-docs-linter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.