typescript-strictly-typed
Advanced tools
Comparing version 3.4.0 to 3.6.0
@@ -21,3 +21,3 @@ import {} from "jsonc-parser"; | ||
export async function enableESLintStrict(cwd) { | ||
const possibleConfigFiles = [".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.yml", ".eslintrc.json", "package.json"]; | ||
const possibleConfigFiles = ["eslint.config.js", ".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.yml", ".eslintrc.json", "package.json"]; | ||
const tsFilesConfig = "*.ts"; | ||
@@ -33,2 +33,8 @@ const htmlFilesConfig = "*.html"; | ||
if (file === "package.json") { | ||
config = { | ||
raw: "{}", | ||
json: {}, | ||
}; | ||
} | ||
else if (file === "package.json") { | ||
packageJSONConfig = await getConfig(cwd, file); | ||
@@ -49,4 +55,4 @@ if (!packageJSONConfig?.json.eslintConfig) { | ||
} | ||
if (!dependencyExists(cwd, "@typescript-eslint/eslint-plugin")) { | ||
logWarning(`'@typescript-eslint/eslint-plugin' dependency must be installed, otherwise rules won't be checked.`); | ||
if (!dependencyExists(cwd, "@typescript-eslint/eslint-plugin") && !dependencyExists(cwd, "typescript-eslint")) { | ||
logWarning(`'@typescript-eslint/eslint-plugin' or 'typescript-eslint' dependency must be installed, otherwise rules will not be checked.`); | ||
} | ||
@@ -77,6 +83,14 @@ let tsConfigAdded = false; | ||
} | ||
else if (file.endsWith(".js") || file.endsWith(".cjs")) { | ||
logWarning(`Your project is using the advanced .eslintrc.(c)js format for ESLint config, and it can't be overwrited directly, as it could mess up with advanced configuration. So the new strict configuration was saved in .eslintrc.json. As .eslintrc.(c)js has precedence over .eslintrc.json, you need to manually copy the new options from the new .eslintrc.json to your preexisting .eslintrc.(c)js.`); | ||
else if (file === "eslint.config.json") { | ||
logWarning(`Your project is using the new eslint.config.js format, and it cannot be overwrited directly, as it could mess up with advanced configuration. So the new strict configuration was saved in eslint.config.json. You need to manually copy the options from eslint.config.json to eslint.config.js. Once done, you can delete eslint.config.json.`); | ||
return saveConfig(cwd, "eslint.config.json", config); | ||
} | ||
else if (file === ".eslintrc.js") { | ||
logWarning(`Your project is using the advanced .eslintrc.js format, and it cannot be overwrited directly, as it could mess up with advanced configuration. So the new strict configuration was saved in .eslintrc.json. As .eslintrc.js has precedence over .eslintrc.json, you need to manually copy the options from .eslintrc.json to .eslintrc.js. Once done, you can delete .eslintrc.json.`); | ||
return saveConfig(cwd, ".eslintrc.json", config); | ||
} | ||
else if (file === ".eslintrc.cjs") { | ||
logWarning(`Your project is using the advanced .eslintrc.cjs format, and it cannot be overwrited directly, as it could mess up with advanced configuration. So the new strict configuration was saved in .eslintrc.json. As .eslintrc.cjs has precedence over .eslintrc.json, you need to manually copy the options from .eslintrc.json to .eslintrc.cjs. Once done, you can delete .eslintrc.json.`); | ||
return saveConfig(cwd, ".eslintrc.json", config); | ||
} | ||
else { | ||
@@ -83,0 +97,0 @@ return saveConfig(cwd, file, config); |
{ | ||
"name": "typescript-strictly-typed", | ||
"version": "3.4.0", | ||
"version": "3.6.0", | ||
"description": "Enable configurations for strictly typed TypeScript, ESLint, and optionally Angular.", | ||
@@ -5,0 +5,0 @@ "funding": { |
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
24124
532