@jcoreio/eslint-plugin-implicit-dependencies
Advanced tools
Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "@jcoreio/eslint-plugin-implicit-dependencies", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "eslint plugin to detect implicit dependencies", | ||
@@ -21,3 +21,5 @@ "repository": { | ||
"@babel/runtime": "^7.18.6", | ||
"pkg-up": "^3.1.0" | ||
"@types/validate-npm-package-name": "^4.0.2", | ||
"pkg-up": "^3.1.0", | ||
"validate-npm-package-name": "^5.0.0" | ||
}, | ||
@@ -24,0 +26,0 @@ "main": "./index.js", |
@@ -48,1 +48,11 @@ # @jcoreio/eslint-plugin-implicit-dependencies | ||
``` | ||
You can ignore specific modules by adding an `ignore` option: | ||
```yaml | ||
rules: | ||
- @jcoreio/implicit-dependencies/no-implicit: | ||
- error | ||
- ignore: | ||
- vscode | ||
``` |
@@ -12,2 +12,3 @@ "use strict"; | ||
var _module = require("module"); | ||
var _validateNpmPackageName = _interopRequireDefault(require("validate-npm-package-name")); | ||
var builtin = new Set(_module.builtinModules); | ||
@@ -27,2 +28,8 @@ var _default = exports["default"] = { | ||
type: 'boolean' | ||
}, | ||
ignore: { | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
} | ||
} | ||
@@ -45,3 +52,5 @@ }, | ||
// ignore dynamic arguments | ||
if (!name || typeof name !== 'string' || name === pkg.name || name[0] === '.' || name[0] === '/' || name.startsWith('node:')) { | ||
if (!name || typeof name !== 'string' || name === pkg.name || name[0] === '.' || name[0] === '/' || name[0] === '!' || | ||
// ignore webpack magic | ||
name.startsWith('node:')) { | ||
return; | ||
@@ -56,2 +65,6 @@ } | ||
} | ||
// if not a valid npm package name then skip | ||
if (!(0, _validateNpmPackageName["default"])(moduleName).validForNewPackages) { | ||
return; | ||
} | ||
// if module is a node core module then skip | ||
@@ -64,4 +77,6 @@ if (builtin.has(moduleName)) { | ||
var opts = context.options[0] || {}; | ||
if (pkg.dependencies && pkg.dependencies[moduleName]) { | ||
if (opts.ignore && opts.ignore.includes(moduleName)) { | ||
return; | ||
} else if (pkg.dependencies && pkg.dependencies[moduleName]) { | ||
return; | ||
} else if ((_pkg$optionalDependen = pkg.optionalDependencies) !== null && _pkg$optionalDependen !== void 0 && _pkg$optionalDependen[moduleName] && opts.optional) { | ||
@@ -68,0 +83,0 @@ return; |
7371
125
58
4
+ Added@types/validate-npm-package-name@4.0.2(transitive)
+ Addedvalidate-npm-package-name@5.0.1(transitive)