Vue-cli: Add specific .editorconfig file for each specific style linting

Created on 28 Feb 2018  路  14Comments  路  Source: vuejs/vue-cli

What problem does this feature solve?

This feature will configure autocomplete to a specific style in any IDE that support .editorconfig file. For example when choosing linter to use AirBnB or StandardJS style, it will generate editorconfig with that specific style.

Just info : content in editorconfig file is universal and can be applied to any IDE.

What does the proposed API look like?

Prompt

Create editorconfig? Y/n

Or just create it without prompting.

contribution welcome feature request

Most helpful comment

I vote for create without prompting, so that peoples do not have to worry about too much options.

All 14 comments

Could I start working on this feature?

Sure! 馃檪

Just to be clear about the proposal.

During the prompt both on the create command and on the invoke with cli-plugin-eslint, it should ask if the user wants to create an editorconfig file if the Airbnb or the Standard option was chosen?

And the config files should be the ones contained in the repositories:

Or is it best to create the editorconfig file without prompting?

I'm thrilled to work on this feature, both because I'm enjoying Vue so much and because it will be my first real open source contribution.

I vote for create without prompting, so that peoples do not have to worry about too much options.

What should happen during invoke if the user already has an editorconfig file?

I would love to keep consistency with the choosen linters.
For instance, if I choose eslint preset AirBnB, I keep AirBnB for the .editorconfig.
And since @vue/cli supports prettier preset for eslint we should try to implement it as well.

Regarding the prompt, @psg2 I would use the linter if there is one and ask for a preset if not.

What do you think ?

Also might be prudent to think about what happens when TypeScript is enabled. You can use either ESLint or TSLint on TypeScript projects. There are AirBnb presets for both TSLint and ESLint too. Do we require some kind of abstraction above ESLint and TSLint with a negotiator behind the scenes?

@elevatebart I'm sorry, but I didn't understand what you meant by "And since supports prettier preset for eslint we should try to implement it as well.".

Could you explain one more time?

@daekano I think there's no adjustment considering Typescript. Because the editorconfig from Airbnb and standard would remain the same. And the other linting options doesn't have default editorconfig files.
But as for the cli, maybe there should be options for TSLint + Airbnb, TSLint + Standard, etc... Instead of just default TSLint and various ESLint options when Typescript is chosen.

@psg2 the Prettier preset for eslint is a little different from AirBnB and Standard, for instance using prettier uses double quotes instead of single quotes.
If you choose one of the 2 presets that you quote, it will conflict with prettier.

Have a look at this repo and I hope you will understand better.
https://github.com/prettier/eslint-config-prettier

If not, please pm me on twitter @bartledoux.
I am interrested in helping you with this task.

@elevatebart I understand that. But eslint-config-prettier doesn't provide an editorconfig file. So if the users choose eslint + prettier as the linter option, it should not generate an editorconfig file and would stay as it is today.
Or should we declare an editorconfig file for that option?

Indeed, my bad, the whole purpose of prettier is specifically to avoid the need of a config file.

I hope this can be helpfull

  • For integrating .editorconfig with tslint,
    using tsfmt maybe can help. The trick is set --no-vscode and --no-tsfmt

  • For combining TSLint with another ESLint config (AirBnB or Standard),
    there is an issue that just opened #1021

I'm sorry that after so long I haven't made any progress on this issue.
I didn't manage my time properly and got caught up on work.
Can I still work on this or is anyone else interested?

Feel free to go ahead :)

Was this page helpful?
0 / 5 - 0 ratings