-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(putout) make defaultOpts use .putout.json #4
Conversation
Thank you, that's interesting idea :). The only problem is Could you please tell me why do you need this? Maybe we can make things work in another other way. For example, you trying to read current directory only, but cli-version search current directory and up till it finds What we can do, is move out const putout = require('putout');
const {readOptions} = putout;
putout(source, readOptions()); This will help to:
What do you think about it? |
This shouldn't conflict with the cli since all we're doing here is setting the default object of options. The cli works great, i'd just expect that the default options in the API be the .putout.json in the root of the project. If not there then it should at least be documented here. ( had some trouble the first time I was using the api (: ) I just pushed some more changes that should add browser support. |
Look, this breaks tests, duplicate logic, and makes harder to support the core engine :). What I can suggest you is such API, if you need this: const putout = require('putout');
const {readOptions} = putout;
putout(source, readOptions()); When This improves quality of a code base, adds ability to test Your solution is a pure duplication of getOptions implemented in cli which is not handle all the cases. |
ah, I see. Looks like I was just misunderstanding you before. Sorry about that! 😅 |
Could you please tell me how do you use It can be something like: const putout = require('putout');
const {getDefaultOptions} = putout;
putout(source, getDefaultOptions()); So you wan't need |
I use putout to remove code that isn't relevant to a build. I take out a function using regex, then loop putout until all the unused variables are removed. I don't necessarily need everything else, just the The only reason for this PR was when I was trying to implement with the API, I was confused why the results were always blank. It seems to be documented now so all is well. Sidenote: it would make sense to have .putout always in the root of the project. |
putout(source, require('../.putout.json')) works great, but could be better.