Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

isDisabledIfNotInPackageJson option title and description are contradictory #209

Closed
tsdorsey opened this issue Jun 29, 2017 · 8 comments
Closed
Labels

Comments

@tsdorsey
Copy link

tsdorsey commented Jun 29, 2017

The following option is contradicting itself. The way I read them...
Title: "If you find prettier modules in my dependencies then format with prettier on save"
Description: "If you find prettier modules in dependencies then DO NOT format with prettier on save"
screenshot 2017-06-28 23 06 38

@robwise robwise added the bug label Jun 29, 2017
@robwise
Copy link
Collaborator

robwise commented Jun 29, 2017

@tsdorsey The description text is wrong, it should be doing what the title says (if you have prettier in your deps, it formats, if you don't, it doesn't). This is the behavior you're getting, right?

@tsdorsey
Copy link
Author

Nope.

Node project.
"prettier": "^1.5.2" in my devDependencies
If I check that box no formatting happens (even though the status bar indicator is showing that format on save is on).

I'm using yarn.
Have done various gyrations of yarn remove prettier and yarn add prettier --dev with no luck.

Do I need to reload the project when the package file changes? Restart Atom?

@tsdorsey
Copy link
Author

tsdorsey commented Jun 29, 2017

Derp. My bad. 😞

I'm using React Starter Kit and you can see here that there are lots of package.json files in subfolders to reduce the number of index.js files in the project. The "is in deps" check is not recursive (which makes sense).

So to clarify. The text is wrong but the option does what it should.

@tsdorsey tsdorsey changed the title isDisabledIfNotInPackageJson logic seems to be inverted isDisabledIfNotInPackageJson option title and description are contradictory Jun 29, 2017
@tsdorsey
Copy link
Author

tsdorsey commented Jun 29, 2017

If I add a devDependencies with prettier to the subfolder package.json file and have the option on it works as expected.

I've updated the title and initial description to focus on the only real bug, the text mismatch.

@robwise
Copy link
Collaborator

robwise commented Jun 29, 2017

@tsdorsey I will fix the docs right now. J/C though, if we checked for the binary in node_modules/.bin instead of reading the package json, would that find it properly? There's a similar problem with CRA and #191

robwise added a commit that referenced this issue Jun 29, 2017
The description was backward. Now the description will correctly reflect the actual behavior.

Resolves #209
@tsdorsey
Copy link
Author

Yeah, it's installed and in the bin folder. Just read #191 and looking in node_modules/.bin would be an excellent solution.

@duro
Copy link

duro commented Aug 2, 2017

@robwise I'm actually finding this not working as expected on my end. I have prettier in my devDependencies, and no further nested package.json's (just one at the root) and when I have this option turned on it does not auto-format on save. But when I have it turned off, it does auto-format.

@robwise
Copy link
Collaborator

robwise commented Aug 2, 2017

@duro can you make an example repo from scratch that reproduces this? There might be some sort of edge case that I'm overlooking, as it stands right now I'm not able to reproduce.

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

3 participants