tools: update eslint-plugin-jsdoc

Run a subset of `tools/dep_updaters/update-eslint.sh` to update
`eslint-plugin-jsdoc` to get rid of a spurious ENOENT error when
running the linter.

PR-URL: https://github.com/nodejs/node/pull/48393
Fixes: https://github.com/nodejs/node/issues/48374
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Richard Lau authored and Ruy Adorno committed 2023-08-31 10:58:28 -04:00
1 parent 555982c59e
commit 590a072657
13 files changed
+330 -22

No files matched your search

@@ -0,0 +1,43 @@
[
"assert",
"async_hooks",
"buffer",
"child_process",
"cluster",
"console",
"constants",
"crypto",
"dgram",
"diagnostics_channel",
"dns",
"domain",
"events",
"fs",
"http",
"http2",
"https",
"inspector",
"module",
"net",
"os",
"path",
"perf_hooks",
"process",
"punycode",
"querystring",
"readline",
"repl",
"stream",
"string_decoder",
"timers",
"tls",
"trace_events",
"tty",
"url",
"util",
"v8",
"vm",
"wasi",
"worker_threads",
"zlib"
]
+11
View File
@@ -0,0 +1,11 @@
'use strict';
const {builtinModules} = require('module');
const ignoreList = [
'sys'
];
// eslint-disable-next-line node/no-deprecated-api
module.exports = (builtinModules || (process.binding ? Object.keys(process.binding('natives')) : []) || [])
.filter(x => !/^_|^(internal|v8|node-inspect)\/|\//.test(x) && !ignoreList.includes(x))
.sort();
+9
View File
@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+44
View File
@@ -0,0 +1,44 @@
{
"name": "builtin-modules",
"version": "3.3.0",
"description": "List of the Node.js builtin modules",
"license": "MIT",
"repository": "sindresorhus/builtin-modules",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd",
"make": "node make.js"
},
"files": [
"index.js",
"index.d.ts",
"static.js",
"static.d.ts",
"builtin-modules.json"
],
"keywords": [
"builtin",
"built-in",
"builtins",
"node",
"modules",
"core",
"bundled",
"list",
"array",
"names"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
+44
View File
@@ -0,0 +1,44 @@
# builtin-modules
> List of the Node.js builtin modules
The list is just a [JSON file](builtin-modules.json) and can be used anywhere.
## Install
```
$ npm install builtin-modules
```
## Usage
```js
const builtinModules = require('builtin-modules');
console.log(builtinModules);
//=> ['assert', 'buffer', ...]
```
## API
Returns an array of builtin modules fetched from the running Node.js version.
### Static list
This module also comes bundled with a static array of builtin modules generated from the latest Node.js version. You can get it with `require('builtin-modules/static');`
## Related
- [is-builtin-module](https://github.com/sindresorhus/is-builtin-module) - Check if a string matches the name of a Node.js builtin module
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-builtin-modules?utm_source=npm-builtin-modules&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
+2
View File
@@ -0,0 +1,2 @@
'use strict';
module.exports = require('./builtin-modules');
@@ -103,7 +103,13 @@ export default iterateJsdoc(({
|Settings||
|Options||
<!-- assertions ${camelCasedRuleName} -->
## Failing examples
<!-- assertions-failing ${camelCasedRuleName} -->
## Passing examples
<!-- assertions-passing ${camelCasedRuleName} -->
`;
const ruleReadmePath = `./.README/rules/${ruleName}.md`;
if (!(0, _fs.existsSync)(ruleReadmePath)) {
@@ -7,27 +7,32 @@ exports.default = void 0;
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
var _jsdoccomment = require("@es-joy/jsdoccomment");
var _fs = require("fs");
var _isBuiltinModule = _interopRequireDefault(require("is-builtin-module"));
var _path = require("path");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @type {Set<string>}
* @type {Set<string>|null}
*/
let deps;
try {
const pkg = JSON.parse(
// @ts-expect-error It's ok
(0, _fs.readFileSync)((0, _path.join)(process.cwd(), './package.json')));
deps = new Set([...(pkg.dependencies ? Object.keys(pkg.dependencies) :
// istanbul ignore next
[]), ...(pkg.devDependencies ? Object.keys(pkg.devDependencies) :
// istanbul ignore next
[])]);
} catch (error) {
/* eslint-disable no-console -- Inform user */
// istanbul ignore next
console.log(error);
/* eslint-enable no-console -- Inform user */
}
const setDeps = function () {
try {
const pkg = JSON.parse(
// @ts-expect-error It's ok
(0, _fs.readFileSync)((0, _path.join)(process.cwd(), './package.json')));
deps = new Set([...(pkg.dependencies ? Object.keys(pkg.dependencies) :
// istanbul ignore next
[]), ...(pkg.devDependencies ? Object.keys(pkg.devDependencies) :
// istanbul ignore next
[])]);
} catch (error) {
// istanbul ignore next -- our package.json exists
deps = null;
/* eslint-disable no-console -- Inform user */
// istanbul ignore next -- our package.json exists
console.log(error);
/* eslint-enable no-console -- Inform user */
}
};
const moduleCheck = new Map();
var _default = (0, _iterateJsdoc.default)(({
@@ -36,7 +41,12 @@ var _default = (0, _iterateJsdoc.default)(({
utils
}) => {
// istanbul ignore if
if (!deps) {
if (deps === undefined) {
setDeps();
}
// istanbul ignore if -- our package.json exists
if (deps === null) {
return;
}
const {
@@ -49,10 +59,23 @@ var _default = (0, _iterateJsdoc.default)(({
} catch {
continue;
}
// eslint-disable-next-line no-loop-func -- Safe
(0, _jsdoccomment.traverse)(typeAst, nde => {
// istanbul ignore if -- TS guard
if (deps === null) {
return;
}
if (nde.type === 'JsdocTypeImport') {
let mod = nde.element.value.replace(/^(@[^/]+\/[^/]+|[^/]+).*$/u, '$1');
if (!moduleCheck.has(mod)) {
if (/^[./]/u.test(mod)) {
return;
}
if ((0, _isBuiltinModule.default)(mod)) {
// mod = '@types/node';
// moduleCheck.set(mod, !deps.has(mod));
return;
} else if (!moduleCheck.has(mod)) {
let pkg;
try {
pkg = JSON.parse(
@@ -61,7 +84,7 @@ var _default = (0, _iterateJsdoc.default)(({
} catch {
// Ignore
}
if (!pkg || !pkg.types) {
if (!pkg || !pkg.types && !pkg.typings) {
mod = `@types/${mod}`;
}
moduleCheck.set(mod, !deps.has(mod));
+3 -2
View File
@@ -11,6 +11,7 @@
"debug": "^4.3.4",
"escape-string-regexp": "^4.0.0",
"esquery": "^1.5.0",
"is-builtin-module": "^3.2.1",
"semver": "^7.5.1",
"spdx-expression-parse": "^3.0.1"
},
@@ -37,7 +38,7 @@
"@types/estree": "^1.0.1",
"@types/lodash.defaultsdeep": "^4.6.7",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.3",
"@types/node": "^20.2.5",
"@types/semver": "^7.5.0",
"@types/spdx-expression-parse": "^3.0.2",
"@typescript-eslint/parser": "^5.59.6",
@@ -135,5 +136,5 @@
"test-cov": "cross-env TIMING=1 nyc --reporter text npm run test-no-cov",
"test-index": "npm run test-no-cov -- test/rules/index.js"
},
"version": "46.2.1"
"version": "46.2.6"
}
+22
View File
@@ -0,0 +1,22 @@
'use strict';
const builtinModules = require('builtin-modules');
const moduleSet = new Set(builtinModules);
const NODE_PROTOCOL = 'node:';
module.exports = moduleName => {
if (typeof moduleName !== 'string') {
throw new TypeError('Expected a string');
}
if (moduleName.startsWith(NODE_PROTOCOL)) {
moduleName = moduleName.slice(NODE_PROTOCOL.length);
}
const slashIndex = moduleName.indexOf('/');
if (slashIndex !== -1 && slashIndex !== moduleName.length - 1) {
moduleName = moduleName.slice(0, slashIndex);
}
return moduleSet.has(moduleName);
};
+9
View File
@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+47
View File
@@ -0,0 +1,47 @@
{
"name": "is-builtin-module",
"version": "3.2.1",
"description": "Check if a string matches the name of a Node.js builtin module",
"license": "MIT",
"repository": "sindresorhus/is-builtin-module",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"builtin",
"built-in",
"builtins",
"node",
"modules",
"core",
"bundled",
"list",
"array",
"names",
"is",
"detect",
"check",
"match"
],
"dependencies": {
"builtin-modules": "^3.3.0"
},
"devDependencies": {
"ava": "^0.25.0",
"tsd": "^0.7.2",
"xo": "^0.23.0"
}
}
+47
View File
@@ -0,0 +1,47 @@
# is-builtin-module
> Check if a string matches the name of a Node.js builtin module
## Install
```
$ npm install is-builtin-module
```
## Usage
```js
const isBuiltinModule = require('is-builtin-module');
isBuiltinModule('fs');
//=> true
isBuiltinModule('fs/promises');
//=> true
isBuiltinModule('node:fs/promises');
//=> true
isBuiltinModule('unicorn');
//=> false
```
## Related
- [builtin-modules](https://github.com/sindresorhus/builtin-modules) - List of the Node.js builtin modules
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-is-builtin-module?utm_source=npm-is-builtin-module&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>