Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Version switch where we load RuleTester from
Browse files Browse the repository at this point in the history
  • Loading branch information
stianjensen committed Sep 13, 2023
1 parent f23f426 commit 74d76dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ jobs:
include:
- name: 'Test with Eslint v7'
cmd: |
npm i eslint@^7
npm i eslint@^7 \
typescript-eslint-utils-5@npm:@typescript-eslint/utils@^5.57.0
cat package-lock.json | grep -A 1 \
-e "\"node_modules/eslint\": {" \
-e "\"node_modules/typescript-eslint-utils-5\": {" \
test: npm run test
build: npm run build
- name: 'Test with Typescript v4'
Expand Down
2 changes: 1 addition & 1 deletion tests/rules/deprecation.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TSESLint } from '@typescript-eslint/utils';
import { RuleTester } from '@typescript-eslint/rule-tester';
import { RuleTester } from '../utils/get-rule-tester';
import rule, { MessageIds, Options } from '../../src/rules/deprecation';
import * as path from 'path';

Expand Down
9 changes: 9 additions & 0 deletions tests/utils/get-rule-tester.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let RuleTester: any;
try {
({ RuleTester } = require('@typescript-eslint/rule-tester'));
} catch {
const { ESLintUtils } = require('typescript-eslint-utils-5');
RuleTester = ESLintUtils.RuleTester;
}

export { RuleTester };

0 comments on commit 74d76dd

Please sign in to comment.