node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


ECHint version License

Quick validation of files with EditorConfig.

Build Status Downloads Code Climate Coverage Status Dependency Status Dependencies


The easiest way to use ECHint to check your code is to install it globally as a Node command line program. To do so, simply run the following command in your terminal (flag -g installs echint globally on your system, omit it if you want to install in the current working directory):

npm install --only=production --save --global echint

After you've done that you should be able to use the echint CLI. The simplest use case would be checking all files in the current working directory:

$ echint
Error: some files did not pass EditorConfig validation:
  src/index.js:97 Expected a newline at the end of the file.
  src/path/data.json:2 Unexpected tabs found.

You can optionally pass one or more paths using the glob pattern:

$ echint *.js docs/**/*.md

How do I ignore files?

The path node_modules/** and hidden files/folders (beginning with .) are automatically excluded when looking for files to check.

Sometimes you need to ignore additional folders or specific minified files. To do that, add a echint.ignore property to package.json:

  "ignore": [

Can I use a sharable configuration?

Yes, you may prefer to check your code against a centralized .editorconfig. To do that, add a echint.extends property to package.json:

  "extends": "echint-config-some-config"

echint will use the main property or .editorconfig file from that package as the configuration. The echint-config- prefix will be added automatically if it is not already present.

use your ENV

echint uses dotenv to load the following environment config values:

name type description
ECHINT_CONFIG string path to .editorconfig file
ECHINT_IGNORE string pattern of files to ignore
ECHINT_PATTERN string pattern of file to process
ECHINT_READ_PACKAGE string read additional options from package.json ("true", "false")

you can create a local .env or .env.[NODE_ENV] file to modify echint's default behavior (where NODE_ENV is the name of your environment), or you can test this directly from the shell:

$ ECHINT_CONFIG=**/* echint *.js docs/**/*.md

include in your tests

  1. Add it to package.json
  "name": "my-cool-package",
  "devDependencies": {
    "echint": "^1.0.0"
  "scripts": {
    "test": "echint && node my-tests.js"
  1. Validate all files automatically when you run npm test
$ npm test
Error: some files did not pass EditorConfig validation:
  src/index.js:97 Expected a newline at the end of the file.
  src/path/data.json:2 Unexpected tabs found.
  1. Never deal with inconsistencies in a pull request again!


  Usage: echint [options] <file ...>
    -h, --help           output usage information
    -V, --version        output the version number
    -c, --config [path]  specify path for config file (defaults to ./.editorconfig)
    -i, --ignore [file]  files to ignore
    -p, --skip-package   whether to skip reading config info from package.json
    -q, --quiet          shhh
    -v, --verbose        detailed errors
# run with defaults 
$ echint
# run on a subset of files 
$ echint *.js *.md --verbose
# ignore some files 
$ echint * --ignore *.md  --verbose
# use custom config file path 
$ echint --config ~/.editorconfig  --verbose



validate everything in current directory

echint(files, [, options [, callback]]])

returns true | false


name type description required default
files mixed manually defined list of files to process no **/*
options mixed see options no
callback mixed see callback no undefined


name type description required default
config string path to .editorconfig file no **/*
ignore array array of files & patterns to ignore no ['coverage/**', 'node_modules/**', 'bower_components/**', '**[.jpg,.png,.gif,.ico]
pattern string pattern of file to process no **/*
readPackage boolean read additional options from package.json no true


pass a callback with the following signature:

function (errors, result) {
  /* typeof errors === 'object' */
  /* typeof result === 'boolean' */
    errors = {
      fileName: {
        lineNumber: [
          error details
import echint from 'echint'
const files = [
const options = {
  config: 'path/to/.editorconfig'
function done (errors, valid) {
  if (!valid) {
// with defaults 
// with file list 
// with options 
// with callback 
// all together! 
echint(files, done)
echint(files, options)
echint(files, options, done)
echint(options, done)

©️  ·  License: ISC  ·  Github: @ahmadnassri  ·  Twitter: @ahmadnassri