Skip to content

Commit

Permalink
test: usage of ESLint class (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig committed Sep 14, 2021
1 parent a41a81b commit 66d2a19
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.js
@@ -1,2 +1,2 @@
/*! eslint-config-standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
module.exports = require('./eslintrc.json')
module.exports = require('./.eslintrc.json')
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -57,7 +57,7 @@
"url": "git://github.com/standard/eslint-config-standard.git"
},
"scripts": {
"lint": "eslint . --config=eslintrc.json",
"lint": "eslint .",
"test": "npm run lint && tape test/*.js"
},
"funding": [
Expand Down
16 changes: 5 additions & 11 deletions test/validate-config.js
@@ -1,16 +1,10 @@
const eslint = require('eslint')
const { ESLint } = require('eslint')
const test = require('tape')

test('load config in eslint to validate all rule syntax is correct', function (t) {
const CLIEngine = eslint.CLIEngine

const cli = new CLIEngine({
useEslintrc: false,
configFile: 'eslintrc.json'
})

test('load config in eslint to validate all rule syntax is correct', async function (t) {
const eslint = new ESLint()
const code = 'const foo = 1\nconst bar = function () {}\nbar(foo)\n'

t.equal(cli.executeOnText(code).errorCount, 0)
const [lintResult] = await eslint.lintText(code)
t.equal(lintResult.errorCount, 0)
t.end()
})

0 comments on commit 66d2a19

Please sign in to comment.