Editorconfig-Checker

What is this about?

An editorconfig is a defintion how your files should be formatted. Compared to other linting tools this tool is language agnostic and works for every language and every major editor out there has a plugin to read the editorconfig. However, there are no good linting tools out there, so I decided to write my own and this is the result. If you want to know more about editorconfig have a look here: https://editorconfig.org

For whom is this useful?

This is especially useful if you have more than one filetype in your codebase. Often there are linting tools for every language, but nothing that compares every file with a certain defintion. You may also have files which don't have a linting tool like configuration files, plain text files with no associated programming language, bash scripts, xml, or something else. In order to maintain a certain formatting and enforce this via linting this is for you.

How to use this?

  1. Plain
  2. JavaScript
  3. PHP
  4. Python
  5. docker
  6. Arch Linux
  7. Configuration
  8. Support

Plain

releases

Head over to the release page, grab the binary which fits your operating system and architecture, extract it and simply run the binary found in the bin directory.

JavaScript

npm | github npm install --save-dev editorconfig-checker

This provides two binaries called ec and editorconfig-checker which you can call via ./node_modules/.bin/ec, ./node_modules/.bin/editorconfig-checker or inside your package.json via ec or editorconfig-checker.

PHP

packagist | github composer require --dev editorconfig-checker

This provides two binaries called ec and editorconfig-checker which you can call via ./vendor/bin/ec, ./vendor/bin/editorconfig-checker or inside your composer.json via ec or editorconfig-checker.

Python

pypi | github pip install editorconfig-checker

Docker

dockerhub docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker

Arch Linux

package pacman -S editorconfig-checker

Or build it yourself

git clone https://aur.archlinux.org/editorconfig-checker-git.git && \ 
cd editorconfig-checker-git && \
makepkg -si

Configuration

There are a bunch of command line flags you can use, but there is also a configuration file which you can use in your current working directory called .ecrc. If you want to use a different config you can pass the -config <path>-flag to the binary. You can generate a configuration with the init -flag. A sample configuration file can look like this:

{
  "Verbose": false,
  "Debug": false,
  "IgnoreDefaults": false,
  "SpacesAftertabs": false,
  "NoColor": false,
  "Exclude": [],
  "AllowedContentTypes": [],
  "PassedFiles": [],
  "Disable": {
    "EndOfLine": false,
    "Indentation": false,
    "InsertFinalNewline": false,
    "TrimTrailingWhitespace": false
  }
}

Support

Github Issues

In order to get help with problems, feature requests or anything else you can use Github issues. Please try to use the correct repository, the main repository where most development is done is this one: editorconfig-cheker/editorconfig-checker. If you have issues for a specific language client, which are in fact only wrappers of the main binary, you can of course open an issue there - and don't worry, if you use the wrong repository it is not a big problem. :)

IRC

Believe it or not, I'm still an active user of IRC. If you want you can reach me there on freenode in #editorconfig-checker. If you don't have an IRC-client set up you can use this web-client freenode webchat.