charlierudolph / dependency-lint Goto Github PK
View Code? Open in Web Editor NEWLints NPM dependencies and devDependencies
License: MIT License
Lints NPM dependencies and devDependencies
License: MIT License
Dependency Lint appears to run some bash scripts that don't work on windows, is this reasonably easy to resolve?
C:\WORK\2017Q1\wdc-node-sdk\node_modules\.bin\dependency-lint:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\WORK\2017Q1\wdc-node-sdk\test\dependency-lint.js:4:3)
at Module._compile (module.js:541:32)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v6.3.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint: `npm run compat-check && eslint . && node test/dependency-lint.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script 'npm run compat-check && eslint . && node test/dependency-lint.js
See watson-developer-cloud/node-sdk#394 (comment) for context
I'm getting errors on Node 4. Possibly because older NPM version? This should be documented and regularly tested against via Travis CI.
Adding Travis:
.travis.yml
(working example) to the code baseIf you have npm is in your local node_modules
and you have an npm run
in one of your scripts, then npm is believed to be a dependency or devDependency.
npm
is a top level module without which nothing would work anyway. Just ignore npm
.
That way can specify actual regular expressions instead of only strings.
Add ability to generate configs for all three types.
Hi,
I'm using it on windows, installed globally.
D:\MyProject>npm install -g dependency-lint
C:\Users\<pcUser>\AppData\Roaming\npm\dependency-lint -> C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\bin\dependency-lint.js
+ [email protected]
added 45 packages from 35 contributors in 4.64s
D:\MyProject>dependency-lint --generate-config
Configuration file generated at "dependency-lint.yml"
D:\MyProject>dependency-lint
SyntaxError: index.js: 'return' outside of function (5:3)
at Object.raise (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:6322:17)
at Object.parseReturnStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10124:12)
at Object.parseStatementContent (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9811:21)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9763:17)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:2019:26)
at Object.parseBlockOrModuleBlockBody (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10340:25)
at Object.parseBlockBody (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10327:10)
at Object.parseBlock (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10311:10)
at Object.parseStatementContent (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9839:21)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9763:17)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:2019:26)
at Object.parseIfStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10117:28)
at Object.parseStatementContent (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9808:21)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:9763:17)
at Object.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:2019:26)
at Object.parseBlockOrModuleBlockBody (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\@babel\parser\lib\index.js:10340:25)
D:\MyProject>cd webapp
D:\MyProject\webapp>dependency-lint
SyntaxError: myfolder/myfile.js: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
at _class.pp$4.raise (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn\dist\acorn.js:2844:13)
at _class.pp$1.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn\dist\acorn.js:859:16)
at _class.parseStatement (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn-dynamic-import\lib\index.js:63:118)
at _class.pp$1.parseTopLevel (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn\dist\acorn.js:749:23)
at _class.parse (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn\dist\acorn.js:552:15)
at Function.parse (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn\dist\acorn.js:575:35)
at Object.parse (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\acorn-node\index.js:26:28)
at parse (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:22:18)
at Function.exports.find (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:47:15)
at module.exports (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:26:20)
at RequiredModuleFinder.findInFile (C:\Users\<pcUser>\AppData\Roaming\npm\node_modules\dependency-lint\dist\linter\used_module_finder\required_module_finder.js:94:53)
The proj works perfectly.
1st run is an electron proj
2nd a react proj
I don't understaand if i can set this plugin ignoring those errors and how.
Thanks
Some modules are only used on the CI server, for example coveralls. It would be nice if this is automatically recognized. Maybe this can be generalized into dependency-lint being able to recognize any binaries in YML files?
I would like to have a possible output only when there are errors, i can do PR for this if accepted
I am using https://github.com/kevgo/cucumber-snippets-livescript to provide Cucumber snippets in Livescript. Those show up as false positive unused modules. I think a simple match for:
--snippet-syntax node_modules/XXX"
should add XXX to the list of automatically ignored modules.
Some random ideas after reviewing this in one of my projects. Instead of adding so much explanation and type information into the documentation, maybe its better to provide a well documented example file in the documentation and link to that from here? This also makes upgrading this file easier, in case future versions of dependency-lint use more or different options.
# see https://github.com/charlierudolph/dependency-lint-example for an example
# modules that don't have to be used
allowUnused: []
# files only used in development
devFiles:
- '{features,spec}/**/*'
- '**/*_spec.coffee'
- gulpfile.coffee
- mycha.coffee
# scripts only used in development
devScripts:
- build
- lint
- publish
- test
# files to be linted
files: '**/*.coffee'
# don't lint these files
ignoreFilePatterns:
- 'dist/**/*'
- 'node_modules/**/*'
# ignore webpack loaders when evaluating requires
# example:
# require('foo!bar!baz')
# is equivalent to:
# require('baz')
stripLoaders: false
transpilers:
- extension: .coffee
module: coffee-script
I can only see these warnings when I actually use dependency-lint, so it telling me that I am not using it is a moot point.
If I am building my project in a compile-to-js language, I'm probably going to want that package as a devDependency for my build script, but I'm most likely not going to be requiring it anywhere in my project.
I think dependency lint should automatically include any modules listed under transpilers in the allowUnused
section.
Thoughts?
Our project uses modules that we host in private Bitbucket repos. These dependencies appear in our package.json
as
dependencies: {
"api-entity": "git+ssh://[email protected]:username/repo-name.git#1.0.2"
}
When running dependency-lint for this project, the following error is thrown:
Error: The following modules listed in your `package.json` have issues:
api-entity (installed: 1.0.2, listed: git+ssh://[email protected]:username/repo-name.git#1.0.2)
All modules need to be installed with the correct semantic version
to properly check for the usage of a module's executables.
When reporting that a module is missing, should be dependency or should be devDependency, include what file(s)/script(s) it is used in.
In order to reduce the number of modules that end up ignoreErrors - unused, I think it would be interesting to try allowing plugins.
A plugin could be something that exports a function that returns a promise which resolves to the an array of the modules it determines are used. The function will be passed in the file path to the project and can search through whatever files it would like
An examples: webpack - read the config file, look through the loaders list and determine the name of the modules that webpack is requiring
Most of these would hopefully be very small functions. @kevgo @alexdavid thoughts?
currently finding module executables by looking in the package.json files of whatever is a direct child of the node_modules folder. With npm 3 this will no longer be valid as the node_modules folder will be flat. Instead looking in the node_modules/.bin
folder and follow the symlinks.
Gnu Make is the most common task runner, used on a lot of projects, including many NodeJS projects.
Dependency-Lint should support it.
The syntax of a Makefile is pretty similar to bash files.
An example Makefile is at https://github.com/Originate/text-runner/blob/master/Makefile
All the data in the config file can be expressed in YML.
Dependency lint should fail if I have the same dependency listed under dependencies and devDependencies.
I have several things listed in my ignoreErrors.unused
:
ignoreErrors:
missing: []
shouldBeDependency: []
shouldBeDevDependency: []
unused:
# babel plugins
- babel-plugin-add-module-exports
- babel-plugin-transform-object-assign
- babel-preset-es2015
- babel-preset-react
- babel-preset-stage-0
# browserify plugins
- babelify
- browserify-global-shim
- minifyify
- uglifyify
# eslint plugins
- eslint-config-airbnb
- eslint-plugin-import
- eslint-plugin-jsx-a11y
- eslint-plugin-react
# css dependencies
- watson-ui-component
When I run dependency-lint
these are ignored as expected. However, when I run dependency-lint --auto-correct
they are again reported as ignored, but are actually "fixed" (deleted from package.json). This, of course, actually breaks things.
Alternative package managers like ied or pnpm create hidden folders in node_modules
, comparable to Git's file-based object storage in .git
. These folders should be ignored by dependency-lint, since they are referenced via symlinks as needed (see issue #29).
In real life, this causes a false positive error:
devDependencies:
✖ .cas (missing)
used in files:
bin/spec
bin/tests
Dependency-lint finds binaries in node_modules/.cas
, which it also finds being used, and assumes .cas
is an unused NPM module. The solution is to ignore folders in node_modules
whose name begins with a period.
Hi, I am trying to use this module. I installed it via npm install dependency-lint --save-dev but when I use in my terminal I get -bash: dependency: command not found
I use npm
for install and update dependencies and trying install through npm produce error:
npm ERR! cb() never called!
Add --autocorrect
option which
Needs the ability to recognize import statements
I am use context
option for webpack
, it is allow use require('shared/js/polyfills')
, but i if run dependency-lint
i get error:
devDependencies:
✖ shared (missing)
used in files:
src/containers/app/app.js
Perhaps it is worth adding an option to avoid such situations and right interpretation require
paths.
I can see an argument for the current behavior, but I think that dependency-lint --auto-correct should work similar to eslint . --fix in that fixed errors do not count against the total errors, and if all errors were successfully fixed, then it should return 0 (no error).
Rather then ending with "✖ 1 error", it could say
✓ 1 correction
✓ 0 errors
For the moment, I'm currently putting dependency-lint --auto-correct || dependency-lint in my npm script.
BTW, this is a great tool either way, and I'm definitely going to be using it in more projects.
This was output when trying to lint React.js project built with webpack (thus using a lot of import
even for resources like scss
files).
C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:1747
throw err;
^
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (2:0)
at Parser.pp.raise (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:1745:13)
at Parser.pp.parseStatement (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:2450:34)
at Parser.pp.parseTopLevel (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:2379:21)
at Object.parse (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:101:12)
at parse (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:10:18)
at Function.exports.find (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:45:15)
at module.exports (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\detective\index.js:24:20)
at RequiredModuleFinder.findInContent (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\src\linter\used_module_finder\required_module_finder.coffee:53:19)
at C:\****\AppData\Roaming\npm\node_modules\dependency-lint\src\linter\used_module_finder\required_module_finder.coffee:32:21
at fn (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:717:34)
at C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:1170:16
at C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:172:37
at C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:677:43
at C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:173:37
at Object._onImmediate (C:\****\AppData\Roaming\npm\node_modules\dependency-lint\node_modules\async\lib\async.js:1163:34)
at processImmediate [as _immediateCallback] (timers.js:345:15)
My project has "rc" as a dependency, which exports an "rc" binary. Dependency-lint finds "rc" in many of my scripts, wrongfully assuming "rc" is used. The regex dependency-lint uses to find occurrences of binaries should wrap the binary name in word boundaries (\b
) to make this search more robust.
Say that I have a package.json
like the following:
{
"dependencies": {
"lodash": "^4.3.0"
}
}
But in my node_modules
directory, I have version 3.10.1
of lodash
installed.
When I require('lodash')
in a program, Node does not warn me that version of the package fails to satisfy my semver
requirements. This can cause confusing errors, e.g. when one works on a Node.js project and switches to a branch which requires an updated version of a library, but forgets to run npm install
.
Therefore, I think it'd be valuable if this package would check for failures to satisfy semver requirements.
Sometimes module executables are just used in executable shell scripts. Look for executable files with a shebang that is either sh or bash. Will need to add a configuration option for devExecutables as well
I am using a tool that provides both a CLI as well as a JS API for running Node code bases. It is called Exoservice. Here is how it is used:
exo-js
on the command line in the current directory to boot up the appexoservice
module and create a new Exoservice
instance to run the code base. This has the advantage that it is much faster since no new subshell and Node process has to be forked, and I have more control over the instance this way.Repo to reproduce the issue: https://github.com/Originate/exosphere-tweets-service
All NPM modules that expose CLIs (Mocha, NPM, Cucumber, etc) do - or should - behave this way.
In this situation, dependency-lint thinks that exoservice
should be a devDependency, because it is only required in dev code (my tests). It doesn't know that I am also using it on the command line in production.
The most ideal scenario would be to teach dependency-lint to also parse shell scripts in the code base, so that it knows what is really going on.
The second best solution would be a config option that allows me to overrule/ignore any dependency-lint warning if I have to. Having a little AI that tries to help me by reasoning about my code is nice, but there are a whole range of situations that are more complex than it can understand, so dependency-lint (or any other tool) should never have the last word in something. That should always be the human user.
Hi,
I added a - *-sass
line under unused:
in my config file, and suddenly it couldn't load at all. This might be a bug in the dependencies, but I figured I'd report it here first.
The codebase I'm working on uses eyeglass to enabling loading sass modules via npm. Most of these are named things like modularscale-sass or breakpoint-sass, etc. I tried just adding a wildcard rule, but it fails like so:
Error
at generateError (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:162:10)
at throwError (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:168:9)
at readAlias (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1248:5)
at composeNode (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1340:20)
at readBlockMapping (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1008:16)
at composeNode (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1331:12)
at readBlockSequence (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:927:5)
at composeNode (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1330:12)
at readBlockMapping (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1061:11)
at composeNode (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1331:12)
at readBlockMapping (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1061:11)
at composeNode (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1331:12)
at readDocument (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1493:3)
at loadDocuments (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1549:5)
at load (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1566:19)
at Object.safeLoad (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/js-yaml/lib/js-yaml/loader.js:1584:10)
I also tried adding it in quotes: - '*-sass'
and that got me a different error:
SyntaxError: Invalid regular expression: /*-sass/: Nothing to repeat
at String.match (native)
at /Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/dependency_linter.js:83:21
at arraySome (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/lodash/lodash.js:747:11)
at Function.some (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/lodash/lodash.js:9914:14)
at DependencyLinter.isErrorIgnored (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/dependency_linter.js:82:16)
at /Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/dependency_linter.js:69:39
at Array.forEach (native)
at DependencyLinter.lint (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/dependency_linter.js:67:17)
at DependencyLinter.lint (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/dependency_linter.js:3:59)
at Linter.<anonymous> (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/dist/linter/index.js:41:36)
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/bluebird/js/release/promise.js:572:26)
at Promise._settlePromise0 (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/nfriedly/.nvm/versions/node/v7.1.0/lib/node_modules/dependency-lint/node_modules/bluebird/js/release/promise.js:691:18)
I've encountered a problem. After installing dependency-lint into my project I can run it just fine from
./node_modules/.bin/dependency-lint
...but if I put it inside an npm script is will run but error out at the very end.
EXAMPLE package.json:
{ "name": "DLINT'", "description": "dependency-lint NOT WORKING from 'npm run dependency-lint", "scripts": { "dependency-lint": "dependency-lint" }, "dependencies": { "webpack": "^2.3.2" }, "devDependencies": { "dependency-lint": "^5.0.1" } }
NPM RUN SCRIPT:
$ npm run dependency-lint
RESULTS IN OUTPUT (WITH ERROR):
`
[email protected] pretest /Users/user/workspace/dlint
dependency-lint
dependencies:
✖ webpack (unused)
✖ 1 error
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] pretest: dependency-lint
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] pretest script 'dependency-lint'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the DLINT package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! dependency-lint
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs DLINT
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls DLINT
npm ERR! There is likely additional logging output above.
`
Refs. cucumber/cucumber-js#1681
tsd 0.16 moved their types to a dedicated npm package @tsd/typescript
(cf. tsdjs/tsd@5376484).
In cucumber-js
, after upgrading tsd
, dependency-lint
reported the following:
$ dependency-lint
devDependencies:
✖ @tsd/typescript (missing)
used in scripts:
build-local
I had to add @tsd/typescript
to the ignore list to prevent the error (cucumber/cucumber-js@f34c2a1)
Transpilers users shouldn't have to educate dependency-lint about which extensions CoffeeScript uses and how to load it's compiler. https://github.com/js-cli/js-interpret provides this information for all common transpilers, and https://github.com/js-cli/js-rechoir allows to register transpilers so that CoffeeScript files can be required directly.
There are newer package managers for Node out there that use symlinks, for example https://github.com/alexanderGugel/ied or https://github.com/rstacruz/pnpm. Dependency-lint is producing false errors for them. I think this is because it doesn't follow the symlink structure that they create in node_modules
.
Hi,
Hi,
We have tested the dependency-lint package with a sample todo react app. Can you guys tell me why this error is happening.
D:\todomvc>.\node_modules.bin\dependency-lint
D:\todomvc\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:1747
throw err;
^
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
at Parser.pp.raise (D:\todomvc\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:1745:13)
at Parser.pp.parseStatement (D:\todomvc\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:2450:34)
at Parser.pp.parseTopLevel (D:\todomvc\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:2379:21)
at Object.parse (D:\todomvc\node_modules\dependency-lint\node_modules\detective\node_modules\acorn\dist\acorn.js:101:12)
at parse (D:\todomvc\node_modules\dependency-lint\node_modules\detective\index.js:10:18)
at Function.exports.find (D:\todomvc\node_modules\dependency-lint\node_modules\detective\index.js:45:15)
at module.exports (D:\todomvc\node_modules\dependency-lint\node_modules\detective\index.js:24:20)
at RequiredModuleFinder.findInContent (D:\todomvc\node_modules\dependency-lint\src\linter\used_module_finder\required_module_finder.coffee:53:19)
at D:\todomvc\node_modules\dependency-lint\src\linter\used_module_finder\required_module_finder.coffee:32:21
at fn (D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:717:34)
at D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:1170:16
at D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:172:37
at D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:677:43
at D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:173:37
at Immediate._onImmediate (D:\todomvc\node_modules\dependency-lint\node_modules\async\lib\async.js:1163:34)
at processImmediate as _immediateCallback
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.