ESLint/Code Style feature request

I'd like to more easily set JavaScript code style from a local or remote ESLint config. Under "Preferences > Editor > Code Style >  JavaScript > Set From..." would be an option to navigate to any .eslintrc file. 

I do realize that I can open an .eslintrc in the editor and click the prompt to set style from it, but this is of limited use because it doesn't support "extends."

In my case I extend the AirBnb .eslintrc with a few of my own rules added. My workaround has been to hard-code the entire eslint-config-airbnb-base config, including all the configs it imports, into one giant .eslintrc that I keep on hand. I open it in the project just for the purpose of getting the prompt to use it for code style, then remove it from the project.

Ideally, I'd like to set code style in default preferences from a global file or remote url. But I'd be happy just to be able to do it locally per project.

Thanks!

3

I think we'd better provide support for `extends` - please vote for https://youtrack.jetbrains.com/issue/WEB-27580. When importing extended config directly, you will lose your own rules

2

To clarify, if a project-local .eslintrc extends another and additionally has its own rules, it would ideally be accessible from "Code Style >  JavaScript > Set From..." as a default project preference relative to the project root. IE set from "~[project root]/some-subfolder/.eslintrc

thanks again

0

Agreed. This is what I was searching for in the forum today.

 

To be clear: I am new to WebStorm. We are using ESLint and have .eslintrc in our project which extends the AirBnB configuration. I notice that WebStorm is 'fighting' me, for example by making tabs 4 spaces when our eslint specifies 2 spaces. So I find my way to the JavaScript Code Style options and discover that there are hundreds of options that must be set individually if I want the IDE's style to match my ESLint style.

I would like to tell WebStorm 'Use my ESLint config and set your style to match'.

0

`extends` support is mostly there; for airBnB configuration support, please vote for https://youtrack.jetbrains.com/issue/WEB-27522

0
Avatar
Permanently deleted user

To apply a code style you can also right-click on the .eslintrc.json or package.json file and at the bottom there will be a button saying 'Apply ESLint Code Style Rules'.

1

请先登录再写评论。