From fb0b73ab8330571bef48ba220e5c4ef003d6f2f2 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 18 Sep 2018 10:21:55 -0700 Subject: [PATCH] Enforce core layering and enable strict Part of #1507 Part of #1319 --- package.json | 2 +- src/common/tsconfig.json | 1 + src/core/data/Charsets.ts | 4 ++-- src/core/input/Keyboard.test.ts | 5 +++-- src/core/tsconfig.json | 20 ++++++++++++++++++++ 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/core/tsconfig.json diff --git a/package.json b/package.json index 2d4ff239..eaf3ad8c 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,6 @@ "webpack": "gulp webpack", "watch": "concurrently --kill-others-on-fail --names \"lib,css\" \"tsc -w\" \"gulp watch-css\"", "watch-addons": "concurrently --kill-others-on-fail --names \"attach,fit,fullscreen,search,terminado,webLinks,winptyCompat,zmodem\" \"tsc -w -p ./src/addons/attach\" \"tsc -w -p ./src/addons/fit\" \"tsc -w -p ./src/addons/fullscreen\" \"tsc -w -p ./src/addons/search\" \"tsc -w -p ./src/addons/terminado\" \"tsc -w -p ./src/addons/webLinks\" \"tsc -w -p ./src/addons/winptyCompat\" \"tsc -w -p ./src/addons/zmodem\"", - "layering": "tsc -p ./src/common" + "layering": "concurrently --kill-others-on-fail --names \"common,core\" \"tsc -p ./src/common\" \"tsc -p ./src/core\"" } } diff --git a/src/common/tsconfig.json b/src/common/tsconfig.json index 34198fdd..19dd0273 100644 --- a/src/common/tsconfig.json +++ b/src/common/tsconfig.json @@ -7,6 +7,7 @@ "rootDir": ".", "noEmit": true, "strict": true, + "pretty": true, "types": [ "../../node_modules/@types/mocha", "../../" diff --git a/src/core/data/Charsets.ts b/src/core/data/Charsets.ts index b49ee77f..5fc36ac1 100644 --- a/src/core/data/Charsets.ts +++ b/src/core/data/Charsets.ts @@ -10,12 +10,12 @@ import { ICharset } from '../Types'; * to be represented within the terminal with only 8-bit encoding. See ISO 2022 * for a discussion on character sets. Only VT100 character sets are supported. */ -export const CHARSETS: { [key: string]: ICharset } = {}; +export const CHARSETS: { [key: string]: ICharset | null } = {}; /** * The default character set, US. */ -export const DEFAULT_CHARSET: ICharset = CHARSETS['B']; +export const DEFAULT_CHARSET: ICharset | null = CHARSETS['B']; /** * DEC Special Character and Line Drawing Set. diff --git a/src/core/input/Keyboard.test.ts b/src/core/input/Keyboard.test.ts index 1104fc61..e9846831 100644 --- a/src/core/input/Keyboard.test.ts +++ b/src/core/input/Keyboard.test.ts @@ -2,6 +2,7 @@ import { assert } from 'chai'; import { evaluateKeyboardEvent } from './Keyboard'; import { IKeyboardResult } from '../Types'; +import { IKeyboardEvent } from '../../common/Types'; /** * A helper function for testing which allows passing in a partial event and defaults will be filled @@ -20,12 +21,12 @@ function testEvaluateKeyboardEvent(partialEvent: { isMac?: boolean; macOptionIsMeta?: boolean; } = {}): IKeyboardResult { - const event = { + const event: IKeyboardEvent = { altKey: partialEvent.altKey || false, ctrlKey: partialEvent.ctrlKey || false, shiftKey: partialEvent.shiftKey || false, metaKey: partialEvent.metaKey || false, - keyCode: partialEvent.keyCode !== undefined ? partialEvent.keyCode : undefined, + keyCode: partialEvent.keyCode !== undefined ? partialEvent.keyCode : 0, key: partialEvent.key || '', type: partialEvent.type || '' }; diff --git a/src/core/tsconfig.json b/src/core/tsconfig.json new file mode 100644 index 00000000..4f024a28 --- /dev/null +++ b/src/core/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "es5" + ], + "rootDir": ".", + "noEmit": true, + "strict": true, + "pretty": true, + "types": [ + "../../node_modules/@types/mocha", + "../../" + ] + }, + "include": [ + "./**/*", + "../common/**/*" + ] +}