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

Use eslint --init to generate configuration #423

Merged
merged 4 commits into from
May 22, 2018
Merged

Use eslint --init to generate configuration #423

merged 4 commits into from
May 22, 2018

Conversation

Hirse
Copy link
Member

@Hirse Hirse commented Mar 12, 2018

The extension currently has a command to Create '.eslintrc.json' file, but I would prefer to use .eslintrc.yml.
This PR adds functionality to generate a Yaml file with the same settings as the JSON.

closes #409

@dbaeumer
Copy link
Member

@Hirse thanks for providing this. However I am not a big fan of it to provide a VS Code command to create a YAML file. I would rather let the ESLint extension contribute a task to run eslint --init in the terminal which at the end will as you to pick the format you want to use. This is more flexible.

Would you be willing to look into this?

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Mar 12, 2018
@Hirse
Copy link
Member Author

Hirse commented Apr 30, 2018

@dbaeumer I agree that using eslint --init is cleaner.
Please see the last commit where I have replaced the config generation with running that command in the terminal.

@dbaeumer
Copy link
Member

dbaeumer commented May 7, 2018

@Hirse thanks.

Some comments:

  • to make this work in a multi folder setup the folder location must be passed as the cwd to the terminal. Otherwise the configuration might be created in the wrong location.
  • what happens if eslint is only installed locally should the command then be .\node_modules\.bin\eslint instead.

@Hirse
Copy link
Member Author

Hirse commented May 20, 2018

@dbaeumer Thanks for your comments and sorry for the delay.

I am passing the cwd to the terminal and reusing the existing logic to find the location of the ESLint location. I have extracted that functionality to a new file as it doesn't entirely belong to the tasks.

@Hirse Hirse changed the title Add Command to create a YAML configuration Use eslint --init to generate configuration May 21, 2018
@dbaeumer dbaeumer merged commit 51cae32 into microsoft:master May 22, 2018
@Hirse
Copy link
Member Author

Hirse commented May 22, 2018

Thanks for merging, but I just saw that the Readme needs to be updated:
https://github.com/Microsoft/vscode-eslint/blob/4303aa4075905ffc2c37dc4bee7e36d4526953ad/README.md#L7

I might be able to open a PR later today if you didn't get to it by then.

@dbaeumer
Copy link
Member

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Command to create a YAML configuration
2 participants