Closed pawelgrzybek closed 8 years ago
I think this is a known issue that will be fixed in 2.0.1
. @IanVS can you confirm this is a duplicate?
Need a little bit more info. @pawelgrzybek, what answer did you give to the first question it asked?
Hi @pawelgrzybek, thanks for the issue. It looks like there's not enough information for us to know how to help you. If you're reporting a bug, please be sure to include:
eslint -v
)Requesting a new rule? Please see Proposing a New Rule for instructions.
If it's something else, please just provide as much additional information as possible. Thanks!
Same problem here with version v2.0.0: It just stops after the last question, with no errors (even with --debug flag). I tried both answering questions & using popular guide, with output in the 3 formats.
@mdhooge, what you are experiencing when answering questions is https://github.com/eslint/eslint/issues/5220, which has been fixed and will go out in a patch release after the weekend. I suspect it is also what @pawelgrzybek is reporting.
If you're seeing this when choosing second option (choosing a popular guide), then that is a new issue. I'll try to look into it later, but I'm in the middle of a tiling project right now.
I upgraded to commits #980e139 & #098ecad (at least, I do think I did according to the gitHead value of the package.json created by npm…). With the same empty result when using the standard popular style with JSON output.
That's ok for me if you look into it later, it isn't a blocking bug :)
Hay @IanVS These are my answers:
? How would you like to configure ESLint? Answer questions about your style ? Are you using ECMAScript 6 features? Yes ? Are you using ES6 modules? Yes ? Where will your code run? Node, Browser ? Do you use CommonJS? Yes ? Do you use JSX? Yes ? Do you use React Yes ? What style of indentation do you use? Spaces ? What quotes do you use for strings? Single ? What line endings do you use? Unix ? Do you require semicolons? Yes ? What format do you want your config file to be in? JavaScript
The version that I run is v2.0.0 globally installed. OS X 10.11.3. It just doesn't save a config file at all. I tried different formats (jspn and yaml) with same result.
@pawelgrzybek Thanks for the details. This is a duplicate of #5220 and has already been fixed. The fix will be released with the next patch version. Closing as fixed.
@ilyavolodin I have eslint from the latest commit f3ee22d60c52d8d9437812f971ef3aa441910d1c, I get a .eslintrc file generated when I do the answer questions init, but when I do the use popular style I get nothing.
@msolovyov Thanks! Reopening the issue. Looks like popular style is still causing problems.
TypeError: Cannot convert undefined or null to object
at Function.keys (native)
at check (~/eslint/eslint/lib/util/npm-util.js:77:35)
at Object.checkDevDeps (~/eslint/eslint/lib/util/npm-util.js:114:12)
at installModules (~/eslint/eslint/lib/config/config-initializer.js:85:29)
at getConfigForStyleGuide (~/eslint/eslint/lib/config/config-initializer.js:273:5)
at null.completed (~/eslint/eslint/lib/config/config-initializer.js:335:22)
at PromptUI.onCompletion (~/eslint/eslint/node_modules/inquirer/lib/ui/prompt.js:57:10)
at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (~/eslint/eslint/node_modules/rx-lite/rx.lite.js:1550:12)
at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (~/eslint/eslint/node_modules/rx-lite/rx.lite.js:1489:14)
at Subject.Rx.Subject.addProperties.onCompleted (~/eslint/eslint/node_modules/rx-lite/rx.lite.js:5871:19)
@msolovyov does the package.json
in your directory already have a devDependencies
section, or do you not have any devDependencies
yet?
I've found at least one bug: If package.json
exists, but it does not specify both devDependencies
and dependencies
, then the check()
method in npm-util
will fail. Hopefully it's the same issue @msolovyov is seeing.
Working on a fix.
I don't have a package json in my project directory. On Feb 14, 2016 10:41 AM, "Brandon Mills" notifications@github.com wrote:
I've found at least one bug: If package.json exists, but it does not specify both devDependencies and dependencies, then the check() method in npm-util will fail. Hopefully it's the same issue @msolovyov https://github.com/msolovyov is seeing.
Working on a fix.
— Reply to this email directly or view it on GitHub https://github.com/eslint/eslint/issues/5243#issuecomment-183948041.
:+1: Got it. I'm able to reproduce that. I'm submitting a PR to fix the issue I found earlier, then I'll see if I can track down what's causing that.
npm-util line 73 is throwing an error (intentionally) saying it can't find the package.json file. Inquirer is suppressing it, and init fails silently. @IanVS what's the intended behavior if no package.json is found?
@btmills I think it should create one, since we can't install shareable configs without it.
Hm, setting up a package.json
seems a little out of scope for this. I would suggest exiting with a message that sharable configs require an npm project to be initialized. I can work on this, @btmills, if you would like.
Sure, go ahead and take that one.
Nearly done...
I decided the best thing to do is to wrap everything in try/catches and report any/all errors. --init
is too eager at swallowing Errors, otherwise, and we'll continue to scratch our heads.