typescript-strictly-typed
Advanced tools
Comparing version 3.6.3 to 3.7.0
@@ -15,3 +15,3 @@ import { findConfig, getConfig, modifyJSON, saveConfig } from "./config-utils.js"; | ||
const file = findConfig(cwd, ["tsconfig.base.json", "tsconfig.json"]); | ||
if (!file) { | ||
if (file === null) { | ||
return false; | ||
@@ -18,0 +18,0 @@ } |
@@ -23,3 +23,3 @@ import { dump, load } from "js-yaml"; | ||
} | ||
if (files[0]) { | ||
if (files[0] !== undefined) { | ||
logInfo(`Can't find ${basename(files[0], ".json")} config file. Skipping this configuration.`); | ||
@@ -105,3 +105,3 @@ } | ||
} | ||
if (!configStringified) { | ||
if (configStringified === null) { | ||
logError(`Can't save ${file} config.`); | ||
@@ -138,3 +138,3 @@ return false; | ||
const filePath = packageUpSync({ cwd }); | ||
if (filePath) { | ||
if (filePath !== undefined) { | ||
const packageJsonFile = readFileSync(filePath, { encoding: "utf8" }); | ||
@@ -159,3 +159,3 @@ const packageJsonConfig = parse(packageJsonFile); | ||
const filePath = packageUpSync({ cwd }); | ||
if (filePath) { | ||
if (filePath !== undefined) { | ||
const packageJsonFile = readFileSync(filePath, { encoding: "utf8" }); | ||
@@ -162,0 +162,0 @@ const packageJsonConfig = parse(packageJsonFile); |
@@ -14,2 +14,3 @@ import {} from "jsonc-parser"; | ||
* - `@typescript-eslint/restrict-plus-operands` | ||
* - `@typescript-eslint/strict-boolean-expressions` | ||
* {@link https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin} | ||
@@ -29,3 +30,3 @@ * | ||
const file = findConfig(cwd, possibleConfigFiles); | ||
if (!file) { | ||
if (file === null) { | ||
return false; | ||
@@ -69,3 +70,3 @@ } | ||
const extendsConfig = normalizeConfigToArray(override.extends); | ||
if (override.plugins?.includes(eslintAngularTemplatePlugin) | ||
if ((override.plugins ?? []).includes(eslintAngularTemplatePlugin) | ||
|| extendsConfig.some((extendConfig) => extendConfig.includes(eslintAngularTemplatePlugin))) | ||
@@ -181,2 +182,8 @@ addAngularHTMLConfig(config, ["overrides", indexNumber], config.json.overrides?.[indexNumber]?.rules); | ||
} | ||
if (Array.isArray(rules?.["@typescript-eslint/strict-boolean-expressions"])) { | ||
config.raw = modifyJSON(config.raw, [...path, "rules", "@typescript-eslint/strict-boolean-expressions", 0], "error"); | ||
} | ||
else { | ||
config.raw = modifyJSON(config.raw, [...path, "rules", "@typescript-eslint/strict-boolean-expressions"], "error"); | ||
} | ||
} | ||
@@ -192,3 +199,3 @@ function addAngularHTMLConfig(config, path, rules) { | ||
function normalizeConfigToArray(config) { | ||
return Array.isArray(config) ? config : config ? [config] : []; | ||
return Array.isArray(config) ? config : (config !== undefined ? [config] : []); | ||
} |
@@ -16,3 +16,3 @@ import { enableAngularStrict } from "./angular-strict.js"; | ||
export async function typescriptStrictlyTyped(cwd) { | ||
if (isGitStatusDirty(cwd)) { | ||
if (isGitStatusDirty(cwd) === true) { | ||
return; | ||
@@ -27,3 +27,3 @@ } | ||
} | ||
if (findConfig(cwd, ["angular.json", ".angular.json", "angular-cli.json", ".angular-cli.json"]) | ||
if (findConfig(cwd, ["angular.json", ".angular.json", "angular-cli.json", ".angular-cli.json"]) !== null | ||
&& await enableAngularStrict(cwd)) { | ||
@@ -30,0 +30,0 @@ success.push("Angular"); |
{ | ||
"name": "typescript-strictly-typed", | ||
"version": "3.6.3", | ||
"version": "3.7.0", | ||
"description": "Enable configurations for strictly typed TypeScript, ESLint, and optionally Angular.", | ||
@@ -19,4 +19,4 @@ "funding": { | ||
"scripts": { | ||
"build": "rimraf dist && tsc && copyfiles package.json LICENSE README.md bin/cli.js dist", | ||
"lint": "eslint src/**", | ||
"build": "rimraf dist && tsc && copyfiles package.json LICENSE bin/cli.js dist && copyfiles -f src/README.md dist", | ||
"lint": "eslint src/**/*.ts", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
@@ -49,4 +49,4 @@ "release:major": "VERSION=major npm run release", | ||
"@types/semver": "^7.5.8", | ||
"@typescript-eslint/eslint-plugin": "^7.9.0", | ||
"@typescript-eslint/parser": "^7.9.0", | ||
"@typescript-eslint/eslint-plugin": "^7.10.0", | ||
"@typescript-eslint/parser": "^7.10.0", | ||
"copyfiles": "^2.4.1", | ||
@@ -53,0 +53,0 @@ "eslint": "^8.57.0", |
@@ -18,3 +18,3 @@ import { checkDependencyVersion, findConfig, getConfig, modifyJSON, saveConfig } from "./config-utils.js"; | ||
const file = findConfig(cwd, ["tsconfig.base.json", "tsconfig.json"]); | ||
if (!file) { | ||
if (file === null) { | ||
return false; | ||
@@ -21,0 +21,0 @@ } |
Sorry, the diff of this file is not supported yet
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
24765
539