ESLint custom formatter for CI


When developing Atom packages in ES/Babel I use ESLint for linting as it’s part of Atom CI. The output of ESLint however difference from CoffeeLint. ESLint supports different output formatters. However none that showed the same style as CoffeeLint. So I thought I write my own custom ESLint output formatter, which is supported through the --format command line option. The formatter works great when called from npm eslint -f "./scripts/formatter.js" ..

Now is my concern how can I use a custom formatter in Atom CI (preferably without altering the file)?


The standard solution would be to alter the file. The atom/ci repository contains example templates to help people get off the ground, not something that should be considered inviolate.


I thought the best solution would be to alter the file. :frowning: Hoped it could solved differently.

Would there be any interest from the Atom team in a ESLint formatter with the same output of CoffeeLint (just to keep them the same)? I could make it an NPM package…


What is the benefit of having the output be identical? Mostly readability?


Yes, exactly. I for example was used to CoffeeLint syntax before switching to ESLint recently.


Would you mind opening an Issue on atom/ci for an enhancement and link it here? I’ll see about getting someone to take a look.


Will do. Going to make it an NPM package first.


So I solved it a bit differently. First I created a separate NPM package for the custom formatter. To get the formatter to work I added an extra line to .travis.yml:

sed -i.bak 's/\.bin\/eslint /\.bin\/eslint --format \.\/node_modules\/coffeelint-reporter-style-for-eslint-formatter\/main\.js /g'

This will replace all calls to eslint with a call to eslint with custom formatter (OSX and Linux only). You can see an example of the results here.