Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Implement strict mode #453

Merged
merged 29 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6e30522
add TS strict mode to CI
bartlomieju May 25, 2019
9b96923
strict - clean log/
bartlomieju May 25, 2019
742c19e
strict - clean ws/ and testing/
bartlomieju May 25, 2019
d40b031
strict - clean archive/
bartlomieju May 25, 2019
68452b1
strict - clean fs/
bartlomieju May 25, 2019
c4948a5
strict - clean http/
bartlomieju May 25, 2019
1c2c688
strict - clean log/, mime/, prettier/, textproto/
bartlomieju May 25, 2019
2b2ec3a
strict - clean ws/, io/, fs/
bartlomieju May 25, 2019
fa00df0
fix CSV
zekth May 25, 2019
589cfb4
fixing toml
zekth May 25, 2019
681a87c
Merge pull request #1 from zekth/fix_toml_strict
bartlomieju May 25, 2019
ce6b612
more strict fixes
bartlomieju May 26, 2019
c072d6f
rewrite flags module in strict mode
bartlomieju May 26, 2019
3284359
Merge branch 'chore-refactor_flags_strict_mode' into chore-strict_tsc…
bartlomieju May 26, 2019
a8c8aa8
fs module strict
zekth May 26, 2019
d294937
Merge pull request #2 from zekth/strict_contrib
bartlomieju May 26, 2019
6f733a1
strict fix
zekth May 26, 2019
295e6bd
Merge pull request #3 from zekth/strict_another
bartlomieju May 26, 2019
898718f
last part of cleanup
bartlomieju May 26, 2019
e9364c2
fmt
bartlomieju May 26, 2019
eb7a354
Merge branch 'master' into chore-strict_tsconfig
bartlomieju May 26, 2019
2644bf1
lint
bartlomieju May 26, 2019
0429cb1
more fixes for strict mode
bartlomieju May 26, 2019
79cd16a
fix testing/format.ts
bartlomieju May 26, 2019
eef15e6
fix textproto
bartlomieju May 26, 2019
158ae3b
rename deno.tsconfig.json to tsconfig.test.json
bartlomieju May 26, 2019
77a7a90
Merge branch 'master' into chore-strict_tsconfig
bartlomieju May 30, 2019
f8ebcd6
fmt
bartlomieju May 30, 2019
1e36fdb
strict fixes after master merge
bartlomieju May 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- script: echo '##vso[task.prependpath]$(HOME)/.deno/bin/'
- script: npx eslint **/*.ts --max-warnings=0
- script: deno run --allow-run --allow-write --allow-read format.ts --check
- script: deno run --allow-run --allow-net --allow-write --allow-read test.ts
- script: deno run --allow-run --allow-net --allow-write --allow-read --config=deno.tsconfig.json test.ts

- job: "Mac"
pool:
Expand All @@ -26,7 +26,7 @@ jobs:
- script: echo '##vso[task.prependpath]$(HOME)/.deno/bin/'
- script: eslint **/*.ts --max-warnings=0
- script: deno run --allow-run --allow-write --allow-read format.ts --check
- script: deno run --allow-run --allow-net --allow-write --allow-read test.ts
- script: deno run --allow-run --allow-net --allow-write --allow-read --config=deno.tsconfig.json test.ts

- job: "Windows"
pool:
Expand All @@ -37,4 +37,4 @@ jobs:
- bash: echo "##vso[task.prependpath]C:\Users\VssAdministrator\.deno\\bin"
- bash: npx eslint **/*.ts --max-warnings=0
- bash: deno.exe run --allow-run --allow-write --allow-read format.ts --check
- bash: deno.exe run --allow-run --allow-net --allow-write --allow-read test.ts
- bash: deno.exe run --allow-run --allow-net --allow-write --allow-read --config=deno.tsconfig.json test.ts
5 changes: 5 additions & 0 deletions deno.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"strict": true
}
}
13 changes: 2 additions & 11 deletions log/levels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
export const LogLevel = {
export const LogLevel : {[key: string]: number } = {
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved
NOTSET: 0,
DEBUG: 10,
INFO: 20,
Expand All @@ -8,15 +8,6 @@ export const LogLevel = {
CRITICAL: 50
};

const byName = {
NOTSET: LogLevel.NOTSET,
DEBUG: LogLevel.DEBUG,
INFO: LogLevel.INFO,
WARNING: LogLevel.WARNING,
ERROR: LogLevel.ERROR,
CRITICAL: LogLevel.CRITICAL
};

const byLevel = {
[LogLevel.NOTSET]: "NOTSET",
[LogLevel.DEBUG]: "DEBUG",
Expand All @@ -27,7 +18,7 @@ const byLevel = {
};

export function getLevelByName(name: string): number {
return byName[name];
return LogLevel[name];
}

export function getLevelName(level: number): string {
Expand Down
5 changes: 2 additions & 3 deletions log/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestHandler extends log.handlers.BaseHandler {
}

test(async function defaultHandlers(): Promise<void> {
const loggers = {
const loggers: {[key: string]: (msg: string, ...args: any[]) => void} = {
DEBUG: log.debug,
INFO: log.info,
WARNING: log.warning,
Expand All @@ -29,9 +29,8 @@ test(async function defaultHandlers(): Promise<void> {
continue;
}

const level = LogLevel[levelName];
const logger = loggers[levelName];
const handler = new TestHandler(level);
const handler = new TestHandler(levelName);

await log.setup({
handlers: {
Expand Down