-
Notifications
You must be signed in to change notification settings - Fork 623
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
First attempt at enable noUncheckedIndexedAccess
TS compiler option
#4039
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,9 @@ export function resolve(...pathSegments: string[]): string { | |
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) { | ||
let path: string; | ||
|
||
if (i >= 0) path = pathSegments[i]; | ||
else { | ||
if (i >= 0) { | ||
path = pathSegments[i]!; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} else { | ||
// deno-lint-ignore no-explicit-any | ||
const { Deno } = globalThis as any; | ||
if (typeof Deno?.cwd !== "function") { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,19 +41,19 @@ export function parse(version: string | SemVer): SemVer { | |
if (!groups) throw new TypeError(`Invalid Version: ${version}`); | ||
|
||
// these are actually numbers | ||
const major = parseInt(groups.major); | ||
const minor = parseInt(groups.minor); | ||
const patch = parseInt(groups.patch); | ||
const major = parseInt(groups.major!); | ||
const minor = parseInt(groups.minor!); | ||
const patch = parseInt(groups.patch!); | ||
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignoring the lint error with |
||
|
||
if (major > Number.MAX_SAFE_INTEGER || major < 0) { | ||
if (major > Number.MAX_SAFE_INTEGER || major < 0 || Number.isNaN(major)) { | ||
throw new TypeError("Invalid major version"); | ||
} | ||
|
||
if (minor > Number.MAX_SAFE_INTEGER || minor < 0) { | ||
if (minor > Number.MAX_SAFE_INTEGER || minor < 0 || Number.isNaN(minor)) { | ||
throw new TypeError("Invalid minor version"); | ||
} | ||
|
||
if (patch > Number.MAX_SAFE_INTEGER || patch < 0) { | ||
if (patch > Number.MAX_SAFE_INTEGER || patch < 0 || Number.isNaN(patch)) { | ||
throw new TypeError("Invalid patch version"); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there might be a bug here, the semicolon at the end of the for statement means line below is only ever run once. The for loop itself does nothing.