Skip to content

Commit

Permalink
Update dependency @types/bytes to v3.1.5 (#4987)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tibor Blenessy <[email protected]>
  • Loading branch information
renovate[bot] and saberduck authored Dec 4, 2024
1 parent 01cfe53 commit a9062bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@babel/preset-typescript": "7.26.0",
"@inquirer/prompts": "^7.1.0",
"@types/babel__preset-env": "7.9.7",
"@types/bytes": "3.1.4",
"@types/bytes": "3.1.5",
"@types/eslint": "8.56.12",
"@types/eslint-scope": "3.7.7",
"@types/estree": "1.0.6",
Expand Down
10 changes: 5 additions & 5 deletions packages/jsts/src/rules/S5693/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function checkSize(
context: Rule.RuleContext,
callExpr: estree.CallExpression,
property?: estree.Property | null,
defaultLimit?: number,
defaultLimit?: number | null,
useStandardSizeLimit = false,
) {
if (property) {
Expand All @@ -199,7 +199,7 @@ function visitAssignment(context: Rule.RuleContext, assignment: estree.Assignmen
const formOptions = formidableObjects.get(objectVariable);
if (formOptions && property === MAX_FILE_SIZE) {
const rhsValue = getSizeValue(context, assignment.right);
if (rhsValue !== undefined) {
if (rhsValue) {
formOptions.maxFileSize = rhsValue;
formOptions.nodeToReport = assignment;
} else {
Expand All @@ -208,7 +208,7 @@ function visitAssignment(context: Rule.RuleContext, assignment: estree.Assignmen
}
}

function getSizeValue(context: Rule.RuleContext, node: estree.Node): number | undefined {
function getSizeValue(context: Rule.RuleContext, node: estree.Node): number | null {
const literal = getValueOfExpression(context, node, 'Literal');
if (literal) {
if (typeof literal.value === 'number') {
Expand All @@ -217,13 +217,13 @@ function getSizeValue(context: Rule.RuleContext, node: estree.Node): number | un
return parse(literal.value);
}
}
return undefined;
return null;
}

function report(
context: Rule.RuleContext,
nodeToReport: estree.Node,
size?: number,
size?: number | null,
useStandardSizeLimit = false,
) {
const { fileUploadSizeLimit, standardSizeLimit } = {
Expand Down

0 comments on commit a9062bf

Please sign in to comment.