From d534b6ce75ec7b8eca75712878283f8b970826b3 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 5 Feb 2020 00:10:36 +0100 Subject: [PATCH 1/2] chore: enable typescript error on unused locals --- @commitlint/resolve-extends/src/index.ts | 2 +- tsconfig.shared.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/@commitlint/resolve-extends/src/index.ts b/@commitlint/resolve-extends/src/index.ts index 163ae1d9d4..252ca9379d 100644 --- a/@commitlint/resolve-extends/src/index.ts +++ b/@commitlint/resolve-extends/src/index.ts @@ -94,7 +94,7 @@ function getId(raw: string = '', prefix: string = ''): string { return relative || absolute ? raw : [prefix, raw].filter(String).join('-'); } -function resolveConfig( +function resolveConfig( raw: string, context: ResolveExtendsContext = {} ): string { diff --git a/tsconfig.shared.json b/tsconfig.shared.json index 9b015b776e..d25831fe4c 100644 --- a/tsconfig.shared.json +++ b/tsconfig.shared.json @@ -9,6 +9,9 @@ "module": "commonjs", "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "strict": true + "strict": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noUnusedLocals": true } } From 5c8bb52d2834dad180ba2faeeaac85de0f2133f9 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 5 Feb 2020 00:45:12 +0100 Subject: [PATCH 2/2] chore: add more typescript compiler flags --- @commitlint/load/src/load.test.ts | 1 - @commitlint/resolve-extends/src/index.test.ts | 1 - @commitlint/rules/src/body-max-length.ts | 2 +- @commitlint/rules/src/body-max-line-length.ts | 2 +- @commitlint/rules/src/body-min-length.ts | 2 +- @commitlint/rules/src/footer-max-length.ts | 2 +- @commitlint/rules/src/footer-max-line-length.ts | 2 +- @commitlint/rules/src/footer-min-length.ts | 2 +- @commitlint/rules/src/header-max-length.ts | 2 +- @commitlint/rules/src/header-min-length.ts | 2 +- @commitlint/rules/src/scope-max-length.ts | 2 +- @commitlint/rules/src/scope-min-length.ts | 2 +- @commitlint/rules/src/subject-max-length.ts | 2 +- @commitlint/rules/src/subject-min-length.ts | 2 +- @commitlint/rules/src/type-max-length.ts | 2 +- @commitlint/rules/src/type-min-length.ts | 2 +- tsconfig.shared.json | 6 +++++- 17 files changed, 19 insertions(+), 17 deletions(-) diff --git a/@commitlint/load/src/load.test.ts b/@commitlint/load/src/load.test.ts index 4caeb1cf9e..bf633a8c82 100644 --- a/@commitlint/load/src/load.test.ts +++ b/@commitlint/load/src/load.test.ts @@ -12,7 +12,6 @@ import resolveFrom from 'resolve-from'; import {fix, git, npm} from '@commitlint/test'; import load from './load'; -import {RuleSeverity} from './types'; const fixBootstrap = (name: string) => fix.bootstrap(name, __dirname); const gitBootstrap = (name: string) => git.bootstrap(name, __dirname); diff --git a/@commitlint/resolve-extends/src/index.test.ts b/@commitlint/resolve-extends/src/index.test.ts index e7f3ff75aa..556dffc79b 100644 --- a/@commitlint/resolve-extends/src/index.test.ts +++ b/@commitlint/resolve-extends/src/index.test.ts @@ -1,5 +1,4 @@ import resolveExtends, {ResolveExtendsContext} from '.'; -import resolveGlobal from 'resolve-global'; const id = (id: unknown) => id; diff --git a/@commitlint/rules/src/body-max-length.ts b/@commitlint/rules/src/body-max-length.ts index 461fdb84b7..995f29cb11 100644 --- a/@commitlint/rules/src/body-max-length.ts +++ b/@commitlint/rules/src/body-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const bodyMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.body; diff --git a/@commitlint/rules/src/body-max-line-length.ts b/@commitlint/rules/src/body-max-line-length.ts index 76d42d2d81..83019ca195 100644 --- a/@commitlint/rules/src/body-max-line-length.ts +++ b/@commitlint/rules/src/body-max-line-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const bodyMaxLineLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.body; diff --git a/@commitlint/rules/src/body-min-length.ts b/@commitlint/rules/src/body-min-length.ts index a866db8512..c554746e5d 100644 --- a/@commitlint/rules/src/body-min-length.ts +++ b/@commitlint/rules/src/body-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const bodyMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { if (!parsed.body) { diff --git a/@commitlint/rules/src/footer-max-length.ts b/@commitlint/rules/src/footer-max-length.ts index 0b7dfaffbb..82dd42961f 100644 --- a/@commitlint/rules/src/footer-max-length.ts +++ b/@commitlint/rules/src/footer-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const footerMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.footer; diff --git a/@commitlint/rules/src/footer-max-line-length.ts b/@commitlint/rules/src/footer-max-line-length.ts index 09a0c58743..5ef7123222 100644 --- a/@commitlint/rules/src/footer-max-line-length.ts +++ b/@commitlint/rules/src/footer-max-line-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const footerMaxLineLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.footer; diff --git a/@commitlint/rules/src/footer-min-length.ts b/@commitlint/rules/src/footer-min-length.ts index 980a756d25..9447444e10 100644 --- a/@commitlint/rules/src/footer-min-length.ts +++ b/@commitlint/rules/src/footer-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const footerMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { if (!parsed.footer) { diff --git a/@commitlint/rules/src/header-max-length.ts b/@commitlint/rules/src/header-max-length.ts index ea0c3af965..32bbd65b69 100644 --- a/@commitlint/rules/src/header-max-length.ts +++ b/@commitlint/rules/src/header-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const headerMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { return [ diff --git a/@commitlint/rules/src/header-min-length.ts b/@commitlint/rules/src/header-min-length.ts index 82362d2de5..c36b549867 100644 --- a/@commitlint/rules/src/header-min-length.ts +++ b/@commitlint/rules/src/header-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const headerMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { return [ diff --git a/@commitlint/rules/src/scope-max-length.ts b/@commitlint/rules/src/scope-max-length.ts index f6eabaa105..24e3d5f478 100644 --- a/@commitlint/rules/src/scope-max-length.ts +++ b/@commitlint/rules/src/scope-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const scopeMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.scope; diff --git a/@commitlint/rules/src/scope-min-length.ts b/@commitlint/rules/src/scope-min-length.ts index cf307968ee..ec088f6848 100644 --- a/@commitlint/rules/src/scope-min-length.ts +++ b/@commitlint/rules/src/scope-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const scopeMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.scope; diff --git a/@commitlint/rules/src/subject-max-length.ts b/@commitlint/rules/src/subject-max-length.ts index af5000260f..c8d492c706 100644 --- a/@commitlint/rules/src/subject-max-length.ts +++ b/@commitlint/rules/src/subject-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const subjectMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.subject; diff --git a/@commitlint/rules/src/subject-min-length.ts b/@commitlint/rules/src/subject-min-length.ts index 5f86be8949..5cd7077c8a 100644 --- a/@commitlint/rules/src/subject-min-length.ts +++ b/@commitlint/rules/src/subject-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const subjectMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.subject; diff --git a/@commitlint/rules/src/type-max-length.ts b/@commitlint/rules/src/type-max-length.ts index fc06da43a6..29fc60076c 100644 --- a/@commitlint/rules/src/type-max-length.ts +++ b/@commitlint/rules/src/type-max-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const typeMaxLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.type; diff --git a/@commitlint/rules/src/type-min-length.ts b/@commitlint/rules/src/type-min-length.ts index 663091e989..c48852c398 100644 --- a/@commitlint/rules/src/type-min-length.ts +++ b/@commitlint/rules/src/type-min-length.ts @@ -3,7 +3,7 @@ import {Rule} from './types'; export const typeMinLength: Rule = ( parsed, - when = undefined, + _when = undefined, value = 0 ) => { const input = parsed.type; diff --git a/tsconfig.shared.json b/tsconfig.shared.json index d25831fe4c..a37ec27451 100644 --- a/tsconfig.shared.json +++ b/tsconfig.shared.json @@ -12,6 +12,10 @@ "strict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, - "noUnusedLocals": true + "noUnusedLocals": true, + "noUnusedParameters": true, + "forceConsistentCasingInFileNames": true, + "keyofStringsOnly": true, + "noFallthroughCasesInSwitch": true } }