Skip to content

Commit 36e4228

Browse files
committed
Require Node.js 12 and ESLint 8
1 parent b778de0 commit 36e4228

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed

Diff for: .github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 16
1314
- 14
1415
- 12
15-
- 10
1616
steps:
1717
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
18+
- uses: actions/setup-node@v2
1919
with:
2020
node-version: ${{ matrix.node-version }}
2121
- run: npm install

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"url": "https://sindresorhus.com"
1212
},
1313
"engines": {
14-
"node": ">=10"
14+
"node": ">=12"
1515
},
1616
"scripts": {
1717
"test": "ava"
@@ -52,10 +52,10 @@
5252
},
5353
"devDependencies": {
5454
"ava": "^2.4.0",
55-
"eslint": "^7.20.0",
55+
"eslint": "^8.6.0",
5656
"is-plain-obj": "^3.0.0"
5757
},
5858
"peerDependencies": {
59-
"eslint": ">=7.32.0"
59+
"eslint": ">=8.6.0"
6060
}
6161
}

Diff for: readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This is for advanced users. [You probably want to use XO directly.](https://gith
88

99
## Install
1010

11-
```
12-
$ npm install --save-dev eslint-config-xo-space
11+
```sh
12+
npm install --save-dev eslint-config-xo-space
1313
```
1414

1515
## Usage

Diff for: test/test.js

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
import test from 'ava';
22
import isPlainObj from 'is-plain-obj';
3-
import eslint from 'eslint';
4-
import path from 'path';
3+
import {ESLint} from 'eslint';
54

6-
const fixture = `'use strict';\nconst x = true;\n\nif (x) {\n console.log();\n}\n`;
5+
const hasRule = (errors, ruleId) => errors.some(error => error.ruleId === ruleId);
76

8-
function runEslint(str, conf) {
9-
const linter = new eslint.CLIEngine({
7+
const fixture = `"use strict";\nconst x = true;\n\nif (x) {\n console.log();\n}\n`;
8+
9+
async function runEslint(string, config) {
10+
const eslint = new ESLint({
1011
useEslintrc: false,
11-
configFile: path.join(__dirname, conf)
12+
overrideConfig: config,
1213
});
1314

14-
return linter.executeOnText(str).results[0].messages;
15+
const [firstResult] = await eslint.lintText(string);
16+
17+
return firstResult.messages;
1518
}
1619

17-
test('main', t => {
18-
const conf = require('../');
19-
t.true(isPlainObj(conf));
20-
t.true(isPlainObj(conf.rules));
21-
t.is(runEslint(fixture, '../index.js').length, 0);
20+
test('main', async t => {
21+
const config = require('../index.js');
22+
23+
t.true(isPlainObj(config));
24+
t.true(isPlainObj(config.rules));
25+
26+
const errors = await runEslint(fixture, config);
27+
t.true(hasRule(errors, 'quotes'), JSON.stringify(errors));
2228
});
2329

24-
test('browser', t => {
25-
const conf = require('../browser');
26-
t.true(isPlainObj(conf));
27-
t.true(isPlainObj(conf.rules));
28-
t.is(runEslint(fixture, '../browser.js').length, 0);
30+
test('browser', async t => {
31+
const config = require('../browser.js');
32+
33+
t.true(isPlainObj(config));
34+
t.true(isPlainObj(config.rules));
35+
36+
const errors = await runEslint(fixture, config);
37+
t.true(hasRule(errors, 'quotes'), JSON.stringify(errors));
2938
});

0 commit comments

Comments
 (0)