Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Nov 7, 2024
1 parent 505e7e0 commit 0c5f248
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions tests/lib/test-lib/tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import type * as eslint from "eslint";
import { getRuleTester } from "eslint-compat-utils/rule-tester";
import * as jsonParser from "jsonc-eslint-parser";
import jsonPlugin from "@eslint/json";
import semver from "semver";
import { getESLint } from "eslint-compat-utils/eslint";
const RuleTester = getRuleTester();
const ESLint = getESLint();

export type ValidTestCase = eslint.RuleTester.ValidTestCase & {
ignoreMomoa?: boolean;
Expand All @@ -25,19 +28,20 @@ class JSONRuleTester {
this._testerOptions = options;
const { ignoreMomoa, ...rest } = options || {};
this.testerForBase = new RuleTester(rest);
this.testerForMomoa = ignoreMomoa
? null
: new RuleTester({
...rest,
plugins: {
json: jsonPlugin as any,
},
language: "json/json5",
languageOptions: {
...rest?.languageOptions,
parser: undefined,
},
});
this.testerForMomoa =
!ignoreMomoa && semver.satisfies(ESLint.version, ">=9.6.0")
? new RuleTester({
...rest,
plugins: {
json: jsonPlugin as any,
},
language: "json/json5",
languageOptions: {
...rest?.languageOptions,
parser: undefined,
},
})
: null;
}

public run(
Expand Down

0 comments on commit 0c5f248

Please sign in to comment.