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 12, 2023
1 parent f23f426 commit 8090a3e
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 5 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
187 changes: 186 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"dependencies": {
"@typescript-eslint/utils": "^6.0.0",
"tslib": "^2.3.1",
"tsutils": "^3.21.0"
"tsutils": "^3.21.0",
"typescript-eslint-utils-5": "npm:@typescript-eslint/utils@^5.62.0"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
Expand All @@ -44,8 +45,8 @@
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/rule-tester": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@typescript-eslint/rule-tester": "^6.0.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.0.0",
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 { TSESLint } = require('@typescript-eslint-utils-5');
RuleTester = TSESLint.RuleTester;
}

export { RuleTester };

0 comments on commit 8090a3e

Please sign in to comment.