I got an error when trying to beautify when ESLint is not installed in the local project.
Atom Beautify: Beautify EditorHere is a link to the debug.md Gist:
I have:
*(Depending on the extension you use in the .eslintrc you will need to install them)
Is it possible to check if ESLint is installed globally or having an option to use the global installation?
Please follow the issue template provided. More specifically, adding a link to the required debug.md Gist which includes debugging information that answers our most commonly asked questions.
Thank you.
Hi, Thanks for your answer.
I have follow the issue template, But my issue is not related to a wrong Beautification but for a error about where to find the ESLint module.
I think my issue is quite easy to understand without having to give more details.
Your answer is a generic answer but you didn't ask anything about my initiali question. What have you not undertand in my issue?
My Issue is not related to any code but to the configuration of the project.
You can open a new project with only 1 JS file with one lline of code let test = 1; And run the beautify with the setting of ESLint fixer as beutifier option for Javscript. If you have ESLint installed globally, it will raise an error until we install ESLint in the local project where the JS file is located.
I have follow the issue template, But my issue is not related to a wrong Beautification but for a error about where to find the ESLint module.
The debugging information is a general practice I want to encourage new Issues to have. It includes version numbers, which language has been detected, which beautifier was selected (sometimes not what users expected), example input/output (unrelated to this issue specifically), and all of the verbose logs which often come in handy for debugging, and much more. Fortunately, I did not need it this time. However, providing it would prevent an unnecessary back and forth question/answering conversation if the issue was determined to be more complicated. It only takes 30 seconds to generate and provide the debug.md Gist link here, so why not do it and ensure my potential questions will be automatically answered. This is why I want to standardize and require this practice.
This is the applicable code: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/eslint.coffee#L19-L23
This beautifier was added by @taylon with commit https://github.com/Glavin001/atom-beautify/commit/e314fdf0992148e782b66a4d49dc0524fd349401
It does appear a local installation of ESLint would work, however it would not use global installation.
Pull Requests welcome. I found https://www.npmjs.com/package/requireg which could solve this problem.
Yes you are right is quite easy to create a debug.md. Sorry for that.
Here is the link debug.md
I have seen to code (eslint-coffe) and I have seen that he try only to get the local library. I think the requireg could help to do the trick. I have to try to implement that in my local if I can make it to work then do a Pull request.
Thanks for the help.
Dirty workaround: update .atom/packages/atom-beautify/src/beautifiers/eslint.coffee, ex.
importPath = Path.join('C:\Users\me\AppData\Local\atom\app-1.2.3\resources\app\apm\bin', 'node_modules', 'eslint')
I'm not familiar with atom's inner mechanisms thus no fix, but normally we should:
After digging for a bit there is much more to be fixed in the atom beautifier. Its options are currently messy - I cannot tell when I have "executables" collapsed or not - interface is not readable. I cannot find the language options easily - no simple search as it is ex. in chrome options. Workaround seems simple though.
Thanks for the help I will try this.
I had problems to make it work with the solution @Glavin001 show me. All the module he shows me looks good but I could not make it work, the Global Package was never correctly used.
also can we have an option same as php-cs-fixer for eslint config path ?
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
This is anything but stale.
This is currently a huge blocker as the only way to use eslint is to either install it to every project (mad) or hack the beautifier to look up modules from the correct path (also mad).
@adderek The Settings is indeed messy, I just submitted an issue to Atom to try and improve the UI of the settings panel for packages like this. Apart from that, the only configuration for eslint is the dropdown for which beautifier to use for javascript.
We can add configuration or add additional logic to define a hierarchy of sorts when using eslint.
Apologies if I misstate anything here, I've rarely used ESLint in the past, so please correct me. It sounds like the best course of action is to do the following:
Other suggestions are welcome.
There might still be an issue in some environments to know where to lookup for global node_modules if it can not be set via settings.
But probably out of scope for this issue anyways.
The requireg package that Glavin mentioned should handle the where part without a problem.
I hacked together something just to see if it works, and it does, but I need to clean it up. And that starts with figuring out how to bypass the error thrown in CLIEngine = require(importPath).CLIEngine when a local install is not present so it can then go to the global install., preferably without adding more dependencies to the package.
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
For all those interested in this issue, please subscribe to https://github.com/Glavin001/atom-beautify/pull/2009 and comment your feedback. Thank you.
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
This is anything but stale.
This is currently a huge blocker as the only way to use eslint is to either install it to every project (mad) or hack the beautifier to look up modules from the correct path (also mad).