Skip to content

Commit

Permalink
[Tests] eslint 2 does not have linter.version
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 23, 2019
1 parent 557a3e2 commit caae65c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/src/core/getExports.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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'] }])
}

Expand Down
5 changes: 3 additions & 2 deletions tests/src/rules/export.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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')
}

Expand Down
5 changes: 3 additions & 2 deletions tests/src/rules/named.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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')
}

Expand Down
4 changes: 2 additions & 2 deletions tests/src/utils.js
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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) {
Expand Down

0 comments on commit caae65c

Please sign in to comment.