Skip to content

Commit

Permalink
Use typescript-eslint 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vilchik-elena committed Oct 28, 2019
1 parent 4bac9a9 commit 0499c2f
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 136 deletions.
5 changes: 2 additions & 3 deletions eslint-bridge/package.json
Expand Up @@ -40,9 +40,8 @@
"typescript": "3.5.3"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/experimental-utils": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
"@typescript-eslint/eslint-plugin": "2.5.0",
"@typescript-eslint/parser": "2.5.0",
"babel-eslint": "10.0.1",
"body-parser": "1.18.3",
"eslint": "5.16.0",
Expand Down
4 changes: 2 additions & 2 deletions eslint-bridge/src/parser.ts
Expand Up @@ -27,7 +27,7 @@ import * as VueJS from "vue-eslint-parser";
// still we might consider extending this range
// if everything which we need is working on older/newer versions
const TYPESCRIPT_MINIMUM_VERSION = "3.2.1";
const TYPESCRIPT_MAXIMUM_VERSION = "3.6.0";
const TYPESCRIPT_MAXIMUM_VERSION = "3.7.0";

export const PARSER_CONFIG_MODULE: Linter.ParserOptions = {
tokens: true,
Expand Down Expand Up @@ -59,7 +59,7 @@ export type Parse = (
export function loggerFn(msg: string) {
if (
msg.includes(
`WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.`,
`You are currently running a version of TypeScript which is not officially supported by`,
)
) {
const currentVersionMatch = msg.match(/YOUR TYPESCRIPT VERSION: (.+)\n/);
Expand Down
9 changes: 5 additions & 4 deletions eslint-bridge/tests/parser.test.ts
Expand Up @@ -14,6 +14,7 @@ import * as espree from "espree";
import { SourceCode } from "eslint";
import { ParsingError } from "../src/analyzer";
import visit from "../src/utils/visitor";
import * as path from "path";

describe("parseJavaScriptSourceFile", () => {
beforeEach(() => {
Expand Down Expand Up @@ -132,14 +133,14 @@ describe("parseTypeScriptSourceFile", () => {
});

it("should return ParsingError with undefined line when file is not part of typescript project", () => {
const file = __dirname + "/fixtures/ts-project/excluded.ts";
const file = path.join(path.basename(__dirname), "/fixtures/ts-project/excluded.ts");
const parsingError = parseTypeScriptSourceFile(`if (b == 0) {}`, file, [
__dirname + "/fixtures/ts-project/tsconfig.json",
]) as ParsingError;
expect(parsingError).toBeDefined();
expect(parsingError.line).toBeUndefined();
expect(parsingError.message).toEqual(
`If \"parserOptions.project\" has been set for @typescript-eslint/parser, ${file} must be included in at least one of the projects provided.`,
`\"parserOptions.project\" has been set for @typescript-eslint/parser.\nThe file does not match your project config: ${file}.\nThe file must be included in at least one of the projects provided.`,
);
});

Expand All @@ -166,11 +167,11 @@ describe("parseTypeScriptSourceFile", () => {

loggerFn(
`WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.
YOUR TYPESCRIPT VERSION: 3.6.0
YOUR TYPESCRIPT VERSION: 3.7.0
`,
);
expect(console.log).toHaveBeenCalledWith(
"WARN You are using version of TypeScript 3.6.0 which is not officially supported; supported versions >=3.2.1 <3.6.0",
"WARN You are using version of TypeScript 3.7.0 which is not officially supported; supported versions >=3.2.1 <3.7.0",
);

jest.resetAllMocks();
Expand Down
90 changes: 59 additions & 31 deletions eslint-bridge/yarn.lock
Expand Up @@ -467,43 +467,46 @@
dependencies:
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.0.0.tgz#609a5d7b00ce21a6f94d7ef282eba9da57ca1e42"
integrity sha512-Mo45nxTTELODdl7CgpZKJISvLb+Fu64OOO2ZFc2x8sYSnUpFrBUW3H+H/ZGYmEkfnL6VkdtOSxgdt+Av79j0sA==
"@typescript-eslint/eslint-plugin@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.5.0.tgz#101d96743ce3365b3223df73d641078c9b775903"
integrity sha512-ddrJZxp5ns1Lh5ofZQYk3P8RyvKfyz/VcRR4ZiJLHO/ljnQAO8YvTfj268+WJOOadn99mvDiqJA65+HAKoeSPA==
dependencies:
"@typescript-eslint/experimental-utils" "2.0.0"
eslint-utils "^1.4.0"
"@typescript-eslint/experimental-utils" "2.5.0"
eslint-utils "^1.4.2"
functional-red-black-tree "^1.0.1"
regexpp "^2.0.1"
tsutils "^3.14.0"
tsutils "^3.17.1"

"@typescript-eslint/experimental-utils@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.0.0.tgz#f3d298bb411357f35c4184e24280b256b6321949"
integrity sha512-XGJG6GNBXIEx/mN4eTRypN/EUmsd0VhVGQ1AG+WTgdvjHl0G8vHhVBHrd/5oI6RRYBRnedNymSYWW1HAdivtmg==
"@typescript-eslint/experimental-utils@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.5.0.tgz#383a97ded9a7940e5053449f6d73995e782b8fb1"
integrity sha512-UgcQGE0GKJVChyRuN1CWqDW8Pnu7+mVst0aWrhiyuUD1J9c+h8woBdT4XddCvhcXDodTDVIfE3DzGHVjp7tUeQ==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/typescript-estree" "2.0.0"
eslint-scope "^4.0.0"
"@typescript-eslint/typescript-estree" "2.5.0"
eslint-scope "^5.0.0"

"@typescript-eslint/parser@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.0.0.tgz#4273bb19d03489daf8372cdaccbc8042e098178f"
integrity sha512-ibyMBMr0383ZKserIsp67+WnNVoM402HKkxqXGlxEZsXtnGGurbnY90pBO3e0nBUM7chEEOcxUhgw9aPq7fEBA==
"@typescript-eslint/parser@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.5.0.tgz#858030ddd808fbbe88e03f42e5971efaccb8218a"
integrity sha512-9UBMiAwIDWSl79UyogaBdj3hidzv6exjKUx60OuZuFnJf56tq/UMpdPcX09YmGqE8f4AnAueYtBxV8IcAT3jdQ==
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "2.0.0"
"@typescript-eslint/typescript-estree" "2.0.0"
eslint-visitor-keys "^1.0.0"
"@typescript-eslint/experimental-utils" "2.5.0"
"@typescript-eslint/typescript-estree" "2.5.0"
eslint-visitor-keys "^1.1.0"

"@typescript-eslint/typescript-estree@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.0.0.tgz#c9f6c0efd1b11475540d6a55dc973cc5b9a67e77"
integrity sha512-NXbmzA3vWrSgavymlzMWNecgNOuiMMp62MO3kI7awZRLRcsA1QrYWo6q08m++uuAGVbXH/prZi2y1AWuhSu63w==
"@typescript-eslint/typescript-estree@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.5.0.tgz#40ada624d6217ef092a3a79ed30d947ad4f212ce"
integrity sha512-AXURyF8NcA3IsnbjNX1v9qbwa0dDoY9YPcKYR2utvMHoUcu3636zrz0gRWtVAyxbPCkhyKuGg6WZIyi2Fc79CA==
dependencies:
debug "^4.1.1"
glob "^7.1.4"
is-glob "^4.0.1"
lodash.unescape "4.0.1"
semver "^6.2.0"
semver "^6.3.0"

abab@^2.0.0:
version "2.0.2"
Expand Down Expand Up @@ -1324,14 +1327,22 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint-utils@^1.3.1, eslint-utils@^1.4.0:
eslint-scope@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint-utils@^1.3.1, eslint-utils@^1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab"
integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==
dependencies:
eslint-visitor-keys "^1.0.0"

eslint-visitor-keys@^1.0.0:
eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==
Expand Down Expand Up @@ -1756,7 +1767,7 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

glob@^7.1.1, glob@^7.1.2, glob@^7.1.3:
glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
Expand Down Expand Up @@ -2092,6 +2103,11 @@ is-extendable@^1.0.1:
dependencies:
is-plain-object "^2.0.4"

is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=

is-fullwidth-code-point@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
Expand All @@ -2109,6 +2125,13 @@ is-generator-fn@^2.0.0:
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==

is-glob@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
dependencies:
is-extglob "^2.1.1"

is-number@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
Expand Down Expand Up @@ -3731,7 +3754,7 @@ sax@^1.2.4:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

semver@^6.0.0, semver@^6.2.0:
semver@^6.0.0, semver@^6.2.0, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
Expand Down Expand Up @@ -4217,12 +4240,17 @@ ts-jest@24.1.0:
semver "^5.5"
yargs-parser "10.x"

tslib@^1.8.1, tslib@^1.9.0:
tslib@^1.8.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==

tsutils@^3.14.0:
tslib@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==

tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==
Expand Down
Expand Up @@ -153,7 +153,7 @@ public void test_incompatible_typescript() throws Exception {
@Test
public void test_new_typescript() throws Exception {
File dir = TestUtils.projectDir("tsproject-no-typescript");
TestUtils.npmInstall(dir, "typescript@3.6.2", "--no-save");
TestUtils.npmInstall(dir, "typescript@3.7.0-beta", "--no-save");
String projectKey = "tsproject-new-typescript";
SonarScanner build = SonarScanner.create()
.setProjectKey(projectKey)
Expand All @@ -164,7 +164,7 @@ public void test_new_typescript() throws Exception {
Tests.setProfile(projectKey, "eslint-based-rules-profile", "ts");
BuildResult result = orchestrator.executeBuild(build);
assertThat(result.isSuccess()).isTrue();
assertThat(result.getLogsLines(l -> l.contains("You are using version of TypeScript 3.6.2 which is not officially supported; supported versions >=3.2.1 <3.6.0"))).hasSize(1);
assertThat(result.getLogsLines(l -> l.contains("You are using version of TypeScript 3.7.0-beta which is not officially supported; supported versions >=3.2.1 <3.7.0"))).hasSize(1);
}

@Test
Expand Down
Expand Up @@ -20,7 +20,6 @@
3337,
3366,
3433,
3844,
3895,
3959,
3988,
Expand Down Expand Up @@ -67,7 +66,6 @@
'TypeScript:src/harness/unittests/session.ts':[
400,
401,
451,
452,
],
'TypeScript:src/harness/unittests/tsserverProjectSystem.ts':[
Expand Down Expand Up @@ -114,9 +112,6 @@
'TypeScript:src/server/utilities.ts':[
196,
],
'TypeScript:src/services/codefixes/importFixes.ts':[
26,
],
'TypeScript:src/services/formatting/ruleOperationContext.ts':[
7,
],
Expand Down

0 comments on commit 0499c2f

Please sign in to comment.