Skip to content

Commit 66d2a19

Browse files
authored
test: usage of ESLint class (#190)
1 parent a41a81b commit 66d2a19

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed
File renamed without changes.

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/*! eslint-config-standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
2-
module.exports = require('./eslintrc.json')
2+
module.exports = require('./.eslintrc.json')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"url": "git://github.com/standard/eslint-config-standard.git"
5858
},
5959
"scripts": {
60-
"lint": "eslint . --config=eslintrc.json",
60+
"lint": "eslint .",
6161
"test": "npm run lint && tape test/*.js"
6262
},
6363
"funding": [

test/validate-config.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
const eslint = require('eslint')
1+
const { ESLint } = require('eslint')
22
const test = require('tape')
33

4-
test('load config in eslint to validate all rule syntax is correct', function (t) {
5-
const CLIEngine = eslint.CLIEngine
6-
7-
const cli = new CLIEngine({
8-
useEslintrc: false,
9-
configFile: 'eslintrc.json'
10-
})
11-
4+
test('load config in eslint to validate all rule syntax is correct', async function (t) {
5+
const eslint = new ESLint()
126
const code = 'const foo = 1\nconst bar = function () {}\nbar(foo)\n'
13-
14-
t.equal(cli.executeOnText(code).errorCount, 0)
7+
const [lintResult] = await eslint.lintText(code)
8+
t.equal(lintResult.errorCount, 0)
159
t.end()
1610
})

0 commit comments

Comments
 (0)