How to get editorconfig file from eslintrc file?

3k views Asked by At

I'm trying to have a standard code style for my project, and I have found http://editorconfig.org/, that is a standard for that. I like it very much, and Intellij supports it (we use Intellij).

I have a .eslintrc file (extend from airbnb style).

So, how to get .editorconfig file from that .eslintrc file ?

3

There are 3 answers

0
cartant On

If you are looking for a .editorconfig that configures the style enforced by the eslint-config-airbnb rules, you could use the .editorconfig file from that module's repo:

https://github.com/airbnb/javascript/blob/master/.editorconfig

0
Ruderer On

The easiest way to create a large and complete editorconfig is with IntelliJ. You can change the settings as you want in the config and then extract the editorconfig

enter image description here

0
jacobq On

I found eslint-to-editorconfig for this purpose, but I have had trouble getting it to work extending rules from the airbnb base rules. Perhaps you will have better luck:

$ ./node_modules/.bin/eslint-to-editorconfig  
/path/to/app/node_modules/eslint-to-editorconfig/node_modules/eslint/lib/config/config-file.js:402
            throw e;
            ^

Error: /path/to/app/node_modules/eslint-config-airbnb-base/rules/es6.js:
    Configuration for rule "arrow-parens" is invalid:
    Value "as-needed,[object Object]" has more items than allowed.

Referenced from: airbnb-base
Referenced from: /path/to/app/.eslintrc