Home

Awesome

eslint-formatter-pretty

Pretty formatter for ESLint

Highlights

Install

npm install --save-dev eslint-formatter-pretty

Please note that to use version 6 of this package you will HAVE to use ESLint v9+. If you're using ESLint v8 or below, install with npm install --save-dev eslint-formatter-pretty@5 instead.

Usage

XO

Nothing to do. It's the default formatter.

ESLint CLI

eslint --format=pretty file.js

grunt-eslint

grunt.initConfig({
	eslint: {
		target: ['file.js'].
		options: {
			format: 'pretty'
		}
	}
});

grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);

gulp-eslint

import gulp from 'gulp';
import eslint from 'gulp-eslint';

export const lint = (
	gulp.src('file.js')
		.pipe(eslint())
		.pipe(eslint.format('pretty'))
);

eslint-loader (webpack)

import eslintFormatterPretty from 'eslint-formatter-pretty';

export default {
	entry: ['file.js'],
	module: {
		rules: [
			{
				test: /\.js$/,
				exclude: /node_modules/,
				loader: 'eslint-loader',
				options: {
					formatter: eslintFormatterPretty
				}
			}
		]
	}
};

Tips

In iTerm, <kbd>Command</kbd>-click the filename header to open the file in your editor.

In terminals with support for hyperlinks, <kbd>Command</kbd>-click the rule ID to open its docs.