Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

npm run test => error #211

Closed
aladdin-add opened this issue Apr 4, 2017 · 3 comments
Closed

npm run test => error #211

aladdin-add opened this issue Apr 4, 2017 · 3 comments
Labels

Comments

@aladdin-add
Copy link
Member

aladdin-add commented Apr 4, 2017

If there is a configuration file in the parent directory, like this

{
"extends": "eslint:recommended",
"parser": "babel-eslint"
}

npm run test output errors:

> node Makefile.js test

Validating Makefile.js
Cannot find module 'babel-eslint'
Error: Cannot find module 'babel-eslint'
    at Object.resolve (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/util/module-resolver.js:75:19)
    at Object.load (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/config/config-file.js:518:42)
    at loadConfig (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/config.js:64:33)
    at getLocalConfig (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/config.js:126:23)
    at Config.getConfig (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/config.js:227:22)
    at processText (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/cli-engine.js:223:27)
    at processFile (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/cli-engine.js:298:18)
    at executeOnFile (/Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/cli-engine.js:682:23)
    at /Users/zsd/repo/typescript-eslint-parser/node_modules/eslint/lib/cli-engine.js:719:13
    at Array.forEach (native)
Validating JavaScript files

Is this expected? thanks in advance for your kindly response. 😄

@soda0289
Copy link
Member

soda0289 commented Apr 4, 2017

I'm not sure if eslint is supposed to load a configuration file from a parent directory when it find one in the current directory. Will look into this tonight.

@platinumazure
Copy link
Member

@soda0289 @aladdin-add ESLint will continue to search parent directories for configurations until it finds one with "root": true in it. Best practice is to mark the configuration at the root of your project with "root": true.

@soda0289
Copy link
Member

soda0289 commented Apr 4, 2017

@platinumazure Thanks. Will be an easy fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants