Skip to content

Commit

Permalink
Add JSDoc to linting via eslint-plugin-jsdoc, address newly-reported …
Browse files Browse the repository at this point in the history
…issues.
  • Loading branch information
DavidAnson committed Jan 31, 2024
1 parent 49240a0 commit b625d1c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"es6": true
},
"plugins": [
"jsdoc",
"n",
"unicorn"
],
"extends": [
"eslint:all",
"plugin:jsdoc/recommended",
"plugin:n/recommended",
"plugin:unicorn/all"
],
Expand Down
6 changes: 3 additions & 3 deletions append-to-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const sliceSize = 1000;

/**
* Efficiently appends the source array to the destination array.
* @param {Object[]} destination Destination Array.
* @param {Object[]} source Source Array.
* @returns void
* @param {object[]} destination Destination Array.
* @param {object[]} source Source Array.
* @returns {void}
*/
const appendToArray = (destination, source) => {
// NOTE: destination.push(...source) throws "RangeError: Maximum call stack
Expand Down
6 changes: 3 additions & 3 deletions merge-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

/**
* Merges two options objects by combining config and replacing properties.
* @param {Object} first First options object.
* @param {Object} second Second options object.
* @returns {Object} Merged options object.
* @param {object} first First options object.
* @param {object} second Second options object.
* @returns {object} Merged options object.
*/
const mergeOptions = (first, second) => {
const merged = {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"cpy-cli": "5.0.0",
"del": "7.1.0",
"eslint": "8.56.0",
"eslint-plugin-jsdoc": "48.0.4",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-unicorn": "50.0.1",
"execa": "8.0.1",
Expand Down
1 change: 0 additions & 1 deletion parsers/jsonc-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { parse, printParseErrorCode } = require("jsonc-parser");

/**
* Parses a JSONC string, returning the corresponding object.
*
* @param {string} text String to parse as JSONC.
* @returns {object} Corresponding object.
*/
Expand Down
1 change: 0 additions & 1 deletion parsers/yaml-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const yaml = require("yaml");

/**
* Parses a YAML string, returning the corresponding object.
*
* @param {string} text String to parse as YAML.
* @returns {object} Corresponding object.
*/
Expand Down
8 changes: 4 additions & 4 deletions resolve-and-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/**
* Wrapper for calling Node's require.resolve/require with an additional path.
* @param {Object} req Node's require implementation (or equivalent).
* @param {String} id Package identifier to require.
* @param {String[]} dirs Directories to include when resolving paths.
* @returns {Object} Exported module content.
* @param {object} req Node's require implementation (or equivalent).
* @param {string} id Package identifier to require.
* @param {string[]} dirs Directories to include when resolving paths.
* @returns {object} Exported module content.
*/
const resolveAndRequire = (req, id, dirs) => {
const resolvePaths = req.resolve.paths ? req.resolve.paths("") : [];
Expand Down

0 comments on commit b625d1c

Please sign in to comment.