Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/eslint-formatter-pretty
Pretty ESLint formatter
https://github.com/sindresorhus/eslint-formatter-pretty
eslint eslint-formatter nodejs npm-package pretty reporter xo
Last synced: 5 days ago
JSON representation
Pretty ESLint formatter
- Host: GitHub
- URL: https://github.com/sindresorhus/eslint-formatter-pretty
- Owner: sindresorhus
- License: mit
- Created: 2016-04-18T18:02:24.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T14:21:54.000Z (6 months ago)
- Last Synced: 2024-10-29T15:46:34.015Z (3 months ago)
- Topics: eslint, eslint-formatter, nodejs, npm-package, pretty, reporter, xo
- Language: JavaScript
- Size: 153 KB
- Stars: 506
- Watchers: 7
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- awesome - sindresorhus/eslint-formatter-pretty - Pretty ESLint formatter (nodejs)
README
# eslint-formatter-pretty
> Pretty formatter for [ESLint](https://eslint.org)
![](screenshot.png)
## Highlights
- Pretty output.
- Sorts results by severity.
- Stylizes inline codeblocks in messages.
- Command-click a rule ID to open its docs.
- Command-click a header to reveal the first error in your editor. *(iTerm-only)*## Install
```sh
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](https://github.com/xojs/xo)
Nothing to do. It's the default formatter.
### ESLint CLI
```sh
eslint --format=pretty file.js
```### [grunt-eslint](https://github.com/sindresorhus/grunt-eslint)
```js
grunt.initConfig({
eslint: {
target: ['file.js'].
options: {
format: 'pretty'
}
}
});grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);
```### [gulp-eslint](https://github.com/adametry/gulp-eslint)
```js
import gulp from 'gulp';
import eslint from 'gulp-eslint';export const lint = (
gulp.src('file.js')
.pipe(eslint())
.pipe(eslint.format('pretty'))
);
```### [eslint-loader](https://github.com/MoOx/eslint-loader) *(webpack)*
```js
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, Command-click the filename header to open the file in your editor.
In [terminals with support for hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#supporting-apps), Command-click the rule ID to open its docs.