Skip to content

Commit 3f5cd27

Browse files
committed
Require Node.js 6
1 parent 7606f98 commit 3f5cd27

File tree

5 files changed

+32
-29
lines changed

5 files changed

+32
-29
lines changed

.gitattributes

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '10'
34
- '8'
45
- '6'
5-
- '4'

index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = results => {
2020
results
2121
.sort((a, b) => a.errorCount - b.errorCount)
2222
.forEach(result => {
23-
const messages = result.messages;
23+
const {messages, filePath} = result;
2424

2525
if (messages.length === 0) {
2626
return;
@@ -33,8 +33,6 @@ module.exports = results => {
3333
lines.push({type: 'separator'});
3434
}
3535

36-
const filePath = result.filePath;
37-
3836
lines.push({
3937
type: 'header',
4038
filePath,
@@ -50,14 +48,16 @@ module.exports = results => {
5048
}
5149

5250
return a.line < b.line ? -1 : 1;
53-
} else if ((a.fatal || a.severity === 2) && (!b.fatal || b.severity !== 2)) {
51+
}
52+
53+
if ((a.fatal || a.severity === 2) && (!b.fatal || b.severity !== 2)) {
5454
return 1;
5555
}
5656

5757
return -1;
5858
})
5959
.forEach(x => {
60-
let message = x.message;
60+
let {message} = x;
6161

6262
// Stylize inline code blocks
6363
message = message.replace(/\B`(.*?)`\B|\B'(.*?)'\B/g, (m, p1, p2) => chalk.bold(p1 || p2));
@@ -90,13 +90,13 @@ module.exports = results => {
9090
let output = '\n';
9191

9292
if (process.stdout.isTTY && !process.env.CI) {
93-
// Make relative paths Cmd+click'able in iTerm
93+
// Make relative paths Command-clickable in iTerm
9494
output += ansiEscapes.iTerm.setCwd();
9595
}
9696

9797
output += lines.map(x => {
9898
if (x.type === 'header') {
99-
// Add the line number so it's Cmd+click'able in some terminals
99+
// Add the line number so it's Command-click'able in some terminals
100100
// Use dim & gray for terminals like iTerm that doesn't support `hidden`
101101
const position = showLineNumbers ? chalk.hidden.dim.gray(`:${x.firstLineCol}`) : '';
102102

@@ -110,7 +110,7 @@ module.exports = results => {
110110
' '.repeat(maxLineWidth - x.lineWidth) + chalk.dim(x.line + chalk.gray(':') + x.column),
111111
' '.repeat(maxColumnWidth - x.columnWidth) + x.message,
112112
' '.repeat(maxMessageWidth - x.messageWidth) +
113-
(supportsHyperlink(process.stdout) ? ansiEscapes.link(chalk.dim(x.ruleId), getRuleUrl(x.ruleId).url) : chalk.gray.dim(x.ruleId))
113+
(supportsHyperlink(process.stdout) ? ansiEscapes.link(chalk.dim(x.ruleId), getRuleUrl(x.ruleId).url) : chalk.dim(x.ruleId))
114114
];
115115

116116
if (!showLineNumbers) {

package.json

+5-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "sindresorhus.com"
1111
},
1212
"engines": {
13-
"node": ">=4"
13+
"node": ">=6"
1414
},
1515
"scripts": {
1616
"test": "xo && ava"
@@ -31,27 +31,16 @@
3131
"chalk": "^2.1.0",
3232
"eslint-rule-docs": "^1.1.5",
3333
"log-symbols": "^2.0.0",
34-
"plur": "^2.1.2",
34+
"plur": "^3.0.1",
3535
"string-width": "^2.0.0",
3636
"supports-hyperlinks": "^1.0.1"
3737
},
3838
"devDependencies": {
39-
"ava": "*",
40-
"strip-ansi": "^4.0.0",
41-
"xo": "*"
39+
"ava": "^0.25.0",
40+
"strip-ansi": "^5.0.0",
41+
"xo": "^0.23.0"
4242
},
4343
"ava": {
4444
"serial": true
45-
},
46-
"xo": {
47-
"overrides": [
48-
{
49-
"files": "index.js",
50-
"rules": {
51-
"prefer-destructuring": 0,
52-
"no-else-return": 1
53-
}
54-
}
55-
]
5645
}
5746
}

readme.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
![](screenshot.png)
66

77

8+
## Highlights
9+
10+
- Pretty output.
11+
- Sorts results by severity.
12+
- Stylizes inline codeblocks in messages.
13+
- Command-click a rule ID to open its docs.
14+
- Command-click a header to reveal the first error in your editor. *(iTerm-only)*
15+
16+
817
## Install
918

1019
```
@@ -14,6 +23,10 @@ $ npm install --save-dev eslint-formatter-pretty
1423

1524
## Usage
1625

26+
### [XO](https://github.com/xojs/xo)
27+
28+
Nothing to do. It's the default formatter.
29+
1730
### ESLint CLI
1831

1932
```
@@ -70,9 +83,11 @@ module.exports = {
7083
```
7184

7285

73-
## Tip
86+
## Tips
87+
88+
In iTerm, <kbd>Command</kbd>-click the filename header to open the file in your editor.
7489

75-
In iTerm, <kbd>Cmd</kbd>+click the filename header to open the file in your editor.
90+
In [terminals with support for hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#supporting-apps), <kbd>Command</kbd>-click the rule ID to open its docs.
7691

7792

7893
## License

0 commit comments

Comments
 (0)