Skip to content

Commit

Permalink
Require Node.js 10 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell authored Jun 13, 2020
1 parent c0c332c commit 2b21776
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ module.exports = (results, data) => {

try {
ruleUrl = data.rulesMeta[x.ruleId].docs.url;
} catch (_) {
} catch {
try {
ruleUrl = getRuleDocs(x.ruleId).url;
} catch (_) {}
} catch {}
}

const line = [
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -28,17 +28,17 @@
],
"dependencies": {
"ansi-escapes": "^4.2.1",
"chalk": "^3.0.0",
"chalk": "^4.1.0",
"eslint-rule-docs": "^1.1.5",
"log-symbols": "^3.0.0",
"plur": "^3.0.1",
"log-symbols": "^4.0.0",
"plur": "^4.0.0",
"string-width": "^4.2.0",
"supports-hyperlinks": "^2.0.0"
},
"devDependencies": {
"ava": "^1.4.1",
"ava": "^2.4.0",
"strip-ansi": "^6.0.0",
"xo": "^0.25.3"
"xo": "^0.32.0"
},
"ava": {
"serial": true
Expand Down
13 changes: 6 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint "ava/no-import-test-files": "off" */
import test from 'ava';
import stripAnsi from 'strip-ansi';
import ansiEscapes from 'ansi-escapes';
Expand All @@ -10,10 +11,8 @@ import messages from './fixtures/messages.json';
import data from './fixtures/data.json';
import eslintFormatterPretty from '..';

const severityFilter = desiredSeverity => ({severity}) => severity === desiredSeverity;

const fakeMessages = (desiredSeverity, desiredCount) => {
const ofDesiredSeverity = messages.filter(severityFilter(desiredSeverity));
const ofDesiredSeverity = messages.filter(({severity}) => severity === desiredSeverity);

if (ofDesiredSeverity.length < desiredCount) {
throw new Error(
Expand Down Expand Up @@ -44,7 +43,7 @@ test('output', t => {
const output = eslintFormatterPretty(defaultFixture);
console.log(output);
t.regex(stripAnsi(output), /index\.js:18:2\n/);
t.regex(stripAnsi(output), /[ ]{3}1:1[ ]{2}AVA should be imported as test.[ ]{6}ava\/use-test/);
t.regex(stripAnsi(output), / {3}1:1 {2}AVA should be imported as test. {6}ava\/use-test/);
});

test('file heading links to the first error line', t => {
Expand All @@ -66,15 +65,15 @@ test('no line numbers', t => {
const output = eslintFormatterPretty(noLineNumbers);
console.log(output);
t.regex(stripAnsi(output), /index\.js\n/);
t.regex(stripAnsi(output), /[ ]{2}AVA should be imported as test.[ ]{6}ava\/use-test/);
t.regex(stripAnsi(output), / {2}AVA should be imported as test. {6}ava\/use-test/);
});

test('show line numbers', t => {
disableHyperlinks();
const output = eslintFormatterPretty(lineNumbers);
console.log(output);
t.regex(stripAnsi(output), /[ ]{3}0:0[ ]{2}Unexpected todo comment.[ ]{13}no-warning-comments/);
t.regex(stripAnsi(output), /[ ]{3}1:1[ ]{2}AVA should be imported as test.[ ]{6}ava\/use-test/);
t.regex(stripAnsi(output), / {3}0:0 {2}Unexpected todo comment. {13}no-warning-comments/);
t.regex(stripAnsi(output), / {3}1:1 {2}AVA should be imported as test. {6}ava\/use-test/);
});

test('link rules to documentation when terminal supports links', t => {
Expand Down

0 comments on commit 2b21776

Please sign in to comment.