typescript-strictly-typed
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -16,2 +16,3 @@ "use strict"; | ||
function enableAngularStrict(cwd) { | ||
enableCodelyzerStrict(cwd); | ||
const file = config_utils_1.findConfig(cwd, ['tsconfig.base.json', 'tsconfig.json']); | ||
@@ -34,1 +35,36 @@ if (!file) { | ||
exports.default = enableAngularStrict; | ||
/** | ||
* Enable the following Codelizer lint option: | ||
* - `template-no-any` {@link http://codelyzer.com/rules/template-no-any/} | ||
* @param cwd Working directory path | ||
*/ | ||
function enableCodelyzerStrict(cwd) { | ||
const file = config_utils_1.findConfig(cwd, ['tslint.json', 'tslint.yaml', 'tslint.yml']); | ||
if (file) { | ||
const config = config_utils_1.getConfig(cwd, file); | ||
if (config && isCodelyzer(config.rulesDirectory)) { | ||
if (!config.rules) { | ||
config.rules = {}; | ||
} | ||
config.rules['template-no-any'] = true; | ||
config_utils_1.saveConfig(cwd, file, config); | ||
} | ||
} | ||
} | ||
/** | ||
* Check if Codelyzer is enabled | ||
* @param rulesDirectory TSLint `rulesDirectory` | ||
*/ | ||
function isCodelyzer(rulesDirectory) { | ||
if (typeof rulesDirectory === 'string') { | ||
return rulesDirectory.includes('codelyzer'); | ||
} | ||
else if (Array.isArray(rulesDirectory)) { | ||
for (const ruleDirectory of rulesDirectory) { | ||
if (ruleDirectory.includes('codelyzer')) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} |
{ | ||
"name": "typescript-strictly-typed", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Enable configurations for strictly typed TypeScript, ESLint or TSLint, and optionally Angular.", | ||
@@ -55,10 +55,10 @@ "funding": { | ||
"@types/json5": "0.0.30", | ||
"@types/node": "12.12.62", | ||
"@typescript-eslint/eslint-plugin": "4.4.0", | ||
"@typescript-eslint/parser": "4.4.0", | ||
"@types/node": "14.14.6", | ||
"@typescript-eslint/eslint-plugin": "4.6.1", | ||
"@typescript-eslint/parser": "4.6.1", | ||
"copyfiles": "2.4.0", | ||
"eslint": "7.10.0", | ||
"eslint": "7.12.1", | ||
"rimraf": "3.0.2", | ||
"typescript": "4.0.3" | ||
"typescript": "4.0.5" | ||
} | ||
} |
@@ -51,2 +51,4 @@ # TypeScript Strictly Typed | ||
- `strictInputAccessModifiers` | ||
- [Angular Codelyzer lint options](http://codelyzer.com) | ||
- `template-no-any` | ||
@@ -53,0 +55,0 @@ ## By the same author |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22460
394
141