How to Use: editorconfig

This is editorconfig: https://editorconfig.org

Prerequisites Link to heading

Unfortunately the CLI tool comes as a npm package instead of a statically linked binary. Dissapointing, I know…

Install the following packages:

  • git
  • nodejs
  • npm
# Manjaro / Arch
sudo pacman -S git nodejs npm

# Alpine
apk add --update git nodejs npm

See also:

Install Link to heading

The CLI tool:

npm install -g eclint

Check your text editor’s plugins for editorconfig integration. Spacemacs has it already built in.

Usage Link to heading

Add an .editorconfig file to your project root:

root = true

[*]
charset                  = utf-8
end_of_line              = lf
indent_style             = space
insert_final_newline     = true
tab_width                = 2
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[{tmp/**/*,cache/**/*}]
charset                  = unset
end_of_line              = unset
indent_style             = unset
insert_final_newline     = unset
tab_width                = unset
trim_trailing_whitespace = unset

Now you can lint your repository:

eclint check $(git ls-files)

Some errors can be fixed automatically:

eclint fix $(git ls-files)

Use my docker image so you don’t have to build your own:

docker run --rm -it -v "$PWD":/work -w /work sdwolfz/eclint eclint check