From c5a8eda150791a1118615733865c0e602ea7e4ff Mon Sep 17 00:00:00 2001 From: Crawl Date: Tue, 13 Nov 2018 03:40:24 +0100 Subject: [PATCH] tslint: fix --- package.json | 1 + src/client/RPCClient.ts | 10 ++-- src/extension.ts | 6 +-- src/structures/Activity.ts | 10 ++-- src/structures/Logger.ts | 15 +++--- tslint.json | 3 ++ yarn.lock | 99 +++++++++++++++++++------------------- 7 files changed, 74 insertions(+), 70 deletions(-) create mode 100644 tslint.json diff --git a/package.json b/package.json index db3a0c6..a78ed3f 100644 --- a/package.json +++ b/package.json @@ -151,6 +151,7 @@ "gulp-typescript": "^5.0.0-alpha.3", "merge2": "^1.2.3", "tslint": "^5.11.0", + "tslint-config-fire": "^1.0.0", "typescript": "^3.1.6", "vscode": "^1.1.21" }, diff --git a/src/client/RPCClient.ts b/src/client/RPCClient.ts index 25a639d..4137da7 100644 --- a/src/client/RPCClient.ts +++ b/src/client/RPCClient.ts @@ -1,10 +1,10 @@ -const { Client } = require('discord-rpc'); +const { Client } = require('discord-rpc'); // tslint:disable-line import { Disposable, StatusBarItem, window, workspace -} from 'vscode'; +} from 'vscode'; // tslint:disable-line import Activity from '../structures/Activity'; import Logger from '../structures/Logger'; @@ -15,11 +15,11 @@ export default class RPCClient implements Disposable { public config = workspace.getConfiguration('discord'); - private _rpc: any; + private _rpc: any; // tslint:disable-line - private _activity = new Activity(); + private readonly _activity = new Activity(); // tslint:disable-line - private _clientId: string; + private readonly _clientId: string; // tslint:disable-line public constructor(clientId: string, statusBarIcon: StatusBarItem) { this._clientId = clientId; diff --git a/src/extension.ts b/src/extension.ts index fd741b9..6818a0d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,7 +5,7 @@ import { StatusBarItem, window, workspace -} from 'vscode'; +} from 'vscode'; // tslint:disable-line import RPCClient from './client/RPCClient'; import Logger from './structures/Logger'; @@ -37,7 +37,7 @@ export async function activate(context: ExtensionContext) { const enabler = commands.registerCommand('discord.enable', async () => { await rpc.dispose(); - await config.update('enabled', true); + config.update('enabled', true); rpc.config = workspace.getConfiguration('discord'); rpc.statusBarIcon.text = '$(pulse) Connecting...'; rpc.statusBarIcon.show(); @@ -46,7 +46,7 @@ export async function activate(context: ExtensionContext) { }); const disabler = commands.registerCommand('discord.disable', async () => { - await config.update('enabled', false); + config.update('enabled', false); rpc.config = workspace.getConfiguration('discord'); await rpc.dispose(); window.showInformationMessage('Disabled Discord Rich Presence for this workspace.'); diff --git a/src/structures/Activity.ts b/src/structures/Activity.ts index a75e1f3..f6dff7f 100644 --- a/src/structures/Activity.ts +++ b/src/structures/Activity.ts @@ -6,8 +6,8 @@ import { env, window, workspace -} from 'vscode'; -const lang = require('../data/languages.json'); +} from 'vscode'; // tslint:disable-line +const lang = require('../data/languages.json'); // tslint:disable-line const knownExtentions: { [key: string]: { image: string } } = lang.knownExtentions; const knownLanguages: string[] = lang.knownLanguages; @@ -33,11 +33,11 @@ interface FileDetail { } export default class Activity implements Disposable { - private _state: State | null = null; + private _state: State | null = null; // tslint:disable-line - private _config = workspace.getConfiguration('discord'); + private readonly _config = workspace.getConfiguration('discord'); // tslint:disable-line - private _lastKnownFile: string = ''; + private _lastKnownFile: string = ''; // tslint:disable-line public get state() { return this._state; diff --git a/src/structures/Logger.ts b/src/structures/Logger.ts index 91fd43b..29822da 100644 --- a/src/structures/Logger.ts +++ b/src/structures/Logger.ts @@ -1,14 +1,15 @@ -import { OutputChannel, window } from 'vscode'; +import { OutputChannel, window } from 'vscode'; // tslint:disable-line +// tslint:disable-next-line export default class Logger { - static output: OutputChannel; + private static _output: OutputChannel; // tslint:disable-line - static setup() { - this.output = this.output || window.createOutputChannel('Discord Presence'); + private static _setup() { + this._output = this._output || window.createOutputChannel('Discord Presence'); } - static log(message: string) { - if (!this.output) this.setup(); - this.output.appendLine(message); + public static log(message: string) { + if (!this._output) this._setup(); + this._output.appendLine(message); } } diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..f2972d0 --- /dev/null +++ b/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "tslint-config-fire" +} diff --git a/yarn.lock b/yarn.lock index cd27637..d3c02a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,15 +31,15 @@ acorn@5.X, acorn@^5.0.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -ajv@^5.3.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" - integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= +ajv@^6.5.5: + version "6.5.5" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1" + integrity sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg== dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" + fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" ansi-colors@^1.0.1: version "1.1.0" @@ -432,11 +432,6 @@ cloneable-readable@^1.0.0: process-nextick-args "^2.0.0" readable-stream "^2.3.5" -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" @@ -868,10 +863,10 @@ fancy-log@^1.1.0: color-support "^1.1.3" time-stamp "^1.0.0" -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" - integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-json-stable-stringify@^2.0.0: version "2.0.0" @@ -1226,7 +1221,7 @@ glogg@^1.0.0: dependencies: sparkles "^1.0.0" -graceful-fs@4.X, graceful-fs@^4.1.11, graceful-fs@^4.1.6: +graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== @@ -1238,11 +1233,6 @@ graceful-fs@^3.0.0: dependencies: natives "^1.1.0" -graceful-fs@^4.0.0, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg= - graceful-fs@~1.2.0: version "1.2.3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" @@ -1376,15 +1366,15 @@ gulp-util@^3.0.0: vinyl "^0.5.0" gulp-vinyl-zip@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.0.tgz#24e40685dc05b7149995245099e0590263be8dad" - integrity sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0= + version "2.1.1" + resolved "https://registry.yarnpkg.com/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.1.tgz#211aebdc5e4f702ddaf17b4e8b1ef6e3612a8b04" + integrity sha512-OPnsZkMwiU8UbH5BMlYRb/SccOAZUnwUW7mQvqYadap8MMdgN7ae0ua1rMEE2s9EyqqijN1Sdvoz29/MbPaq9Q== dependencies: event-stream "^3.3.1" queue "^4.2.1" through2 "^2.0.3" vinyl "^2.0.2" - vinyl-fs "^2.0.0" + vinyl-fs "^3.0.3" yauzl "^2.2.1" yazl "^2.2.1" @@ -1420,11 +1410,11 @@ har-schema@^2.0.0: integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.0.tgz#44657f5688a22cfd4b72486e81b3a3fb11742c29" - integrity sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA== + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: - ajv "^5.3.0" + ajv "^6.5.5" har-schema "^2.0.0" has-ansi@^2.0.0: @@ -1800,10 +1790,10 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema@0.2.3: version "0.2.3" @@ -2238,9 +2228,9 @@ next-tick@1: integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= node-fetch@^2.1.2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.0.tgz#4ee79bde909262f9775f731e3656d0db55ced5b5" - integrity sha512-OayFWziIxiHY8bCUyLX6sTpDH8Jsbp4FfYd1j1f7vZyfgkcOnAyM4oQR16f8a0s7Gl/viMGRey8eScYk4V4EZA== + version "2.2.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.1.tgz#1fe551e0ded6c45b3b3b937d0fb46f76df718d1e" + integrity sha512-ObXBpNCD3A/vYQiQtEWl7DuqjAXjfptYFuGHLdPl5U19/6kJuZV+8uMHLrkj3wJrJoyfg4nhgyFixZdaZoAiEQ== node.extend@^1.1.2: version "1.1.7" @@ -2532,6 +2522,11 @@ punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -3023,7 +3018,7 @@ through2-filter@^2.0.0: through2 "~2.0.0" xtend "~4.0.0" -through2@2.X: +through2@2.X, through2@^2.0.0, through2@^2.0.3, through2@~2.0.0, through2@~2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== @@ -3039,14 +3034,6 @@ through2@^0.6.0, through2@^0.6.1, through2@~0.6.5: readable-stream ">=1.0.33-1 <1.1.0-0" xtend ">=4.0.0 <4.1.0-0" -through2@^2.0.0, through2@^2.0.3, through2@~2.0.0, through2@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" - integrity sha1-AARWmzfHx0ujnEPzzteNGtlBQL4= - dependencies: - readable-stream "^2.1.5" - xtend "~4.0.1" - through@2, through@^2.3.8, through@~2.3, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -3132,6 +3119,11 @@ tslib@^1.8.0, tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== +tslint-config-fire@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tslint-config-fire/-/tslint-config-fire-1.0.0.tgz#6445c0b5e38c00e78de25c9bab35dd7b690b55b6" + integrity sha512-wrbpfGwjNuJfPLiWeTIL3IcHy18krxRl3j074SO05ZZr44rg37gIR9DEgkLJnODqx6m5tSkRBV4FP/NEGKEebg== + tslint@^5.11.0: version "5.11.0" resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed" @@ -3210,15 +3202,22 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= url-parse@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.3.tgz#bfaee455c889023219d757e045fa6a684ec36c15" - integrity sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw== + version "1.4.4" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8" + integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg== dependencies: querystringify "^2.0.0" requires-port "^1.0.0" @@ -3283,7 +3282,7 @@ vinyl-fs@^0.3.0: through2 "^0.6.1" vinyl "^0.4.0" -vinyl-fs@^2.0.0, vinyl-fs@^2.4.3: +vinyl-fs@^2.4.3: version "2.4.4" resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-2.4.4.tgz#be6ff3270cb55dfd7d3063640de81f25d7532239" integrity sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=