From caae65c57b309daac7c54bc5855bdf758d9c198e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 23 May 2019 13:58:54 -0700 Subject: [PATCH] [Tests] eslint 2 does not have `linter.version` --- tests/src/core/getExports.js | 4 ++-- tests/src/rules/export.js | 5 +++-- tests/src/rules/named.js | 5 +++-- tests/src/utils.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/src/core/getExports.js b/tests/src/core/getExports.js index 6e0942612..78b5319bb 100644 --- a/tests/src/core/getExports.js +++ b/tests/src/core/getExports.js @@ -1,6 +1,6 @@ import { expect } from 'chai' import semver from 'semver' -import { linter } from 'eslint' +import eslintPkg from 'eslint/package.json' import ExportMap from '../../../src/ExportMap' import * as fs from 'fs' @@ -335,7 +335,7 @@ describe('ExportMap', function () { ['array form', { 'typescript-eslint-parser': ['.ts', '.tsx'] }], ] - if (semver.satisfies(linter.version, '>5.0.0')) { + if (semver.satisfies(eslintPkg.version, '>5.0.0')) { configs.push(['array form', { '@typescript-eslint/parser': ['.ts', '.tsx'] }]) } diff --git a/tests/src/rules/export.js b/tests/src/rules/export.js index 3aad5241e..6431c542c 100644 --- a/tests/src/rules/export.js +++ b/tests/src/rules/export.js @@ -1,6 +1,7 @@ import { test, SYNTAX_CASES } from '../utils' -import { RuleTester, linter } from 'eslint' +import { RuleTester } from 'eslint' +import eslintPkg from 'eslint/package.json' import semver from 'semver' var ruleTester = new RuleTester() @@ -113,7 +114,7 @@ context('Typescript', function () { // Typescript const parsers = ['typescript-eslint-parser'] - if (semver.satisfies(linter.version, '>5.0.0')) { + if (semver.satisfies(eslintPkg.version, '>5.0.0')) { parsers.push('@typescript-eslint/parser') } diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index 8d8bd41c1..6592aa958 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -1,5 +1,6 @@ import { test, SYNTAX_CASES } from '../utils' -import { RuleTester, linter } from 'eslint' +import { RuleTester } from 'eslint' +import eslintPkg from 'eslint/package.json' import semver from 'semver' import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve' @@ -287,7 +288,7 @@ context('Typescript', function () { // Typescript const parsers = ['typescript-eslint-parser'] - if (semver.satisfies(linter.version, '>5.0.0')) { + if (semver.satisfies(eslintPkg.version, '>5.0.0')) { parsers.push('@typescript-eslint/parser') } diff --git a/tests/src/utils.js b/tests/src/utils.js index 4d4f42dc8..b416ec83d 100644 --- a/tests/src/utils.js +++ b/tests/src/utils.js @@ -1,5 +1,5 @@ import path from 'path' -import { linter } from 'eslint' +import eslintPkg from 'eslint/package.json' import semver from 'semver' // warms up the module cache. this import takes a while (>500ms) @@ -12,7 +12,7 @@ export function testFilePath(relativePath) { export const FILENAME = testFilePath('foo.js') export function testVersion(specifier, t) { - return semver.satisfies(linter.version, specifier) && test(t) + return semver.satisfies(eslintPkg.version, specifier) && test(t) } export function test(t) {