From 3d10ba5beb39cb82e7b4ef1dfb36230a982d4503 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 28 Nov 2019 16:16:09 -0800 Subject: [PATCH 1/3] Configure eslint to lint ts files --- .eslintrc.json | 2 +- package-lock.json | 96 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 3 files changed, 99 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f296c1ba..5c16a4cb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,6 @@ { "extends": "google", + "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 2017, "sourceType": "module" @@ -36,4 +37,3 @@ "jasmine": true } } - diff --git a/package-lock.json b/package-lock.json index d15c6d4d..d2a9fd10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -303,16 +303,97 @@ "core-js": "^2.5.7" } }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/jasmine": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.5.0.tgz", "integrity": "sha512-kGCRI9oiCxFS6soGKlyzhMzDydfcPix9PpTkr7h11huxOxhWwP37Tg7DYBaQ18eQTNreZEuLkhpbGSqVNZPnnw==" }, + "@types/json-schema": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz", + "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==", + "dev": true + }, "@types/node": { "version": "12.12.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.12.tgz", "integrity": "sha512-MGuvYJrPU0HUwqF7LqvIj50RZUX23Z+m583KBygKYUZLlZ88n6w28XRNJRJgsHukLEnLz6w6SvxZoLgbr5wLqQ==" }, + "@typescript-eslint/experimental-utils": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.9.0.tgz", + "integrity": "sha512-0lOLFdpdJsCMqMSZT7l7W2ta0+GX8A3iefG3FovJjrX+QR8y6htFlFdU7aOVPL6pDvt6XcsOb8fxk5sq+girTw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.9.0", + "eslint-scope": "^5.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.9.0.tgz", + "integrity": "sha512-fJ+dNs3CCvEsJK2/Vg5c2ZjuQ860ySOAsodDPwBaVlrGvRN+iCNC8kUfLFL8cT49W4GSiLPa/bHiMjYXA7EhKQ==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.9.0", + "@typescript-eslint/typescript-estree": "2.9.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.9.0.tgz", + "integrity": "sha512-v6btSPXEWCP594eZbM+JCXuFoXWXyF/z8kaSBSdCb83DF+Y7+xItW29SsKtSULgLemqJBT+LpT+0ZqdfH7QVmA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash.unescape": "4.0.1", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, "acorn": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", @@ -1268,6 +1349,12 @@ "lodash._reinterpolate": "^3.0.0" } }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -1848,6 +1935,15 @@ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", diff --git a/package.json b/package.json index 9ad0fa05..b1edca68 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "postinstall": "tsc", "build": "tsc", - "lint": "eslint .", + "lint": "eslint src/**/*.{js,ts}", "test": "tsc && jasmine --config=jasmine.json" }, "main": "dist/index.js", @@ -39,6 +39,7 @@ "valid-url": "^1.0.9" }, "devDependencies": { + "@typescript-eslint/parser": "^2.9.0", "eslint": "^6.6.0", "eslint-config-google": "^0.14.0", "jasmine": "^3.5.0" From b1bc10af15cf5d539eed9d51c9289bbb6217d9f6 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 28 Nov 2019 16:23:47 -0800 Subject: [PATCH 2/3] Fix failing rules --- src/index.ts | 2 +- src/spec/lib/ConfigSpec.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index d1400758..e7ee561d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ module.exports = () => { const args = process.argv.slice(2); // TODO(peconn): Tighten up the `any` below once CLI is typed. cli.run(args) - .catch((err: any) => { + .catch((err: any) => { console.error(err.message); process.exit(1); }); diff --git a/src/spec/lib/ConfigSpec.ts b/src/spec/lib/ConfigSpec.ts index f5602bf9..597f4007 100644 --- a/src/spec/lib/ConfigSpec.ts +++ b/src/spec/lib/ConfigSpec.ts @@ -20,9 +20,8 @@ describe('config', () => { describe('#constructor', () => { it('Assigns values correctly', () => { const config: Config = new Config('/jdk', '/androidSdk'); - expect(config.jdkPath).toBe('/jdk'); - expect(config.androidSdkPath).toBe('/androidSdk'); + expect(config.jdkPath).toBe('/jdk'); + expect(config.androidSdkPath).toBe('/androidSdk'); }); - }) + }); }); - From c3b5094540531fad97829c7cace7c99acc22856f Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Sat, 30 Nov 2019 20:20:44 -0800 Subject: [PATCH 3/3] Add @typescript-eslint/eslint-plugin --- .eslintrc.json | 1 + package-lock.json | 21 +++++++++++++++++++++ package.json | 1 + 3 files changed, 23 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 5c16a4cb..d339a6e7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "extends": "google", "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], "parserOptions": { "ecmaVersion": 2017, "sourceType": "module" diff --git a/package-lock.json b/package-lock.json index d2a9fd10..14b403fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -325,6 +325,27 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.12.tgz", "integrity": "sha512-MGuvYJrPU0HUwqF7LqvIj50RZUX23Z+m583KBygKYUZLlZ88n6w28XRNJRJgsHukLEnLz6w6SvxZoLgbr5wLqQ==" }, + "@typescript-eslint/eslint-plugin": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.9.0.tgz", + "integrity": "sha512-98rfOt3NYn5Gr9wekTB8TexxN6oM8ZRvYuphPs1Atfsy419SDLYCaE30aJkRiiTCwGEY98vOhFsEVm7Zs4toQQ==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "2.9.0", + "eslint-utils": "^1.4.3", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + } + } + }, "@typescript-eslint/experimental-utils": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.9.0.tgz", diff --git a/package.json b/package.json index b1edca68..314ceaa7 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "valid-url": "^1.0.9" }, "devDependencies": { + "@typescript-eslint/eslint-plugin": "^2.9.0", "@typescript-eslint/parser": "^2.9.0", "eslint": "^6.6.0", "eslint-config-google": "^0.14.0",