Skip to content
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

autoFixOnSave not working when standard is installed globally #373

Open
ocroz opened this issue Feb 2, 2022 · 3 comments
Open

autoFixOnSave not working when standard is installed globally #373

ocroz opened this issue Feb 2, 2022 · 3 comments
Labels

Comments

@ocroz
Copy link

ocroz commented Feb 2, 2022

With: standard.vscode-standard@v2.0.1
On Windows 10 and remote Container in WSL2 with node@v16.13.1 and npm@8.1.2.

I can run standard --fix however I install standard locally or globally.

Now, if I configure "standard.autoFixOnSave": true in my settings.json, it works only if standard is installed locally using;
npm install --save-dev --no-optional standard.

autoFixOnSave should work if standard is installed globally too, using:
npm install --global --no-optional standard.

Then, no need to install standard to all my javascript projects.

I don't know this code, and I'm not confident enough to to submit a pull request to fix this bug. Can anyone help?

@theoludwig
Copy link
Contributor

Hello! 👋 @ocroz
Thanks for your report!

I don't have the time to investigate this bug.

Then, no need to install standard to all my javascript projects.

You really should, so others working on your project can have the same linting rules.
We might in a future major version (e.g v3.0.0) drop support for "standard.enable" and "standard.enableGlobally" options, but we can discuss that in another issue.
The thing is that you should in most case never use this extension using the globally installed version of standard, and to avoid bugs like this, we might just remove this feature to ease maintenance and keep straightforward usage following best practices.

@0xCA
Copy link

0xCA commented May 14, 2022

Hello! 👋 @ocroz Thanks for your report!

I don't have the time to investigate this bug.

Then, no need to install standard to all my javascript projects.

You really should, so others working on your project can have the same linting rules. We might in a future major version (e.g v3.0.0) drop support for "standard.enable" and "standard.enableGlobally" options, but we can discuss that in another issue. The thing is that you should in most case never use this extension using the globally installed version of standard, and to avoid bugs like this, we might just remove this feature to ease maintenance and keep straightforward usage following best practices.

Hello
That's really not a solution. Having to install standard for every little project is a major headache. Especially if I need to write just one file of js, user.js for example.
In my case it's frequently stuck at some half-written variable name or extra spaces, even after it's fully written and fully valid. It displays an error there and refuses to fix it on save until I hover my mouse on it. I need to do so like every 2 minutes, which is basically unusable at this point. (desribed at #78)

I installed it locally, same issues. It doesn't fix anything.

Windows 10, vscode, node, npm, standard, all latest stable.

@holopekochan
Copy link

holopekochan commented Jul 13, 2022

I tested my installation with npm install standard --global
It works for me. I installed it on both on my macOS and Windows.
node js version 16.16.0
npm version 8.11.0
Standard Engine version 17.0.0
StandardJS plugin version 2.1.0

Settings:

"standard.enable": true,
"standard.enableGlobally": true,
"standard.autoFixOnSave": true,
"standard.usePackageJson": false

Also, I agree that it should install with --save-dev instead of --global.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants