-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import test from "ava"; | ||
import test from "node:test"; | ||
import assert from "node:assert"; | ||
|
||
import { ESLint } from "eslint"; | ||
|
||
import config from "../index.js"; | ||
|
||
const isObject = (value) => value && typeof value === "object" && value.constructor === Object; | ||
|
||
test("load config in eslint to validate all rule syntax is correct", async (t) => { | ||
test("load config in eslint to validate all rule syntax is correct", async () => { | ||
const linter = new ESLint(); | ||
const code = ` | ||
const foo = 1; | ||
const bar = () => {}; | ||
bar(foo); | ||
`.replaceAll("\t", ""); | ||
const [{ errorCount }] = await linter.lintText(code); | ||
t.is(errorCount, 0); | ||
assert.equal(errorCount, 0); | ||
}); | ||
|
||
test("test basic properties of config", (t) => { | ||
test("test basic properties of config", () => { | ||
const { env, plugins, rules } = config; | ||
|
||
t.true(isObject(env)); | ||
t.true(Array.isArray(plugins)); | ||
t.true(isObject(rules)); | ||
assert.ok(isObject(env)); | ||
assert.ok(Array.isArray(plugins)); | ||
assert.ok(isObject(rules)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import test from "ava"; | ||
import test from "node:test"; | ||
import assert from "node:assert"; | ||
|
||
import { ESLint } from "eslint"; | ||
|
||
import config from "../typescript.js"; | ||
|
||
const isObject = (value) => value && typeof value === "object" && value.constructor === Object; | ||
|
||
test("load config in eslint to validate all rule syntax is correct", async (t) => { | ||
test("load config in eslint to validate all rule syntax is correct", async () => { | ||
const linter = new ESLint({ overrideConfigFile: "typescript.js" }); | ||
const code = ` | ||
const foo = 1; | ||
const bar = () => {}; | ||
bar(foo); | ||
`.replaceAll("\t", ""); | ||
const [{ errorCount }] = await linter.lintText(code); | ||
t.is(errorCount, 1); | ||
assert.equal(errorCount, 1); | ||
}); | ||
|
||
test("test basic properties of config", (t) => { | ||
test("test basic properties of config", () => { | ||
const { plugins, rules } = config; | ||
|
||
t.true(Array.isArray(plugins)); | ||
t.true(isObject(rules)); | ||
assert.ok(Array.isArray(plugins)); | ||
assert.ok(isObject(rules)); | ||
}); |