chore: enable lint cleanup rules (#4673)
## Summary Enable small cleanup rules for redundant boolean expressions, object ownership checks, assignments, and object construction. The existing call sites now use the simpler equivalent forms, keeping future code consistent without changing behavior. Base: [#4672](https://github.com/triggerdotdev/trigger.dev/pull/4672)
This commit is contained in:
@@ -1158,11 +1158,11 @@ function shouldPush(imageTag: string, push?: boolean) {
|
||||
return false;
|
||||
}
|
||||
case undefined: {
|
||||
return imageTag.startsWith("localhost") ||
|
||||
return !(
|
||||
imageTag.startsWith("localhost") ||
|
||||
imageTag.startsWith("127.0.0.1") ||
|
||||
imageTag.startsWith("0.0.0.0")
|
||||
? false
|
||||
: true;
|
||||
);
|
||||
}
|
||||
default: {
|
||||
assertExhaustive(push);
|
||||
@@ -1180,7 +1180,7 @@ function shouldLoad(load?: boolean, push?: boolean) {
|
||||
return false;
|
||||
}
|
||||
case undefined: {
|
||||
return push ? false : true;
|
||||
return !push;
|
||||
}
|
||||
default: {
|
||||
assertExhaustive(load);
|
||||
|
||||
@@ -613,7 +613,7 @@ export function isEmptyObj(obj: object | null | undefined): boolean {
|
||||
|
||||
// https://eslint.org/docs/latest/rules/no-prototype-builtins
|
||||
export function hasOwn(obj: object, key: string): boolean {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
return Object.hasOwn(obj, key);
|
||||
}
|
||||
|
||||
// If the requestInit has a header x-trigger-worker = true, then we will do
|
||||
|
||||
@@ -39,7 +39,7 @@ export function populateEnv(
|
||||
|
||||
// Set process.env values
|
||||
for (const key of Object.keys(envObject)) {
|
||||
if (Object.prototype.hasOwnProperty.call(process.env, key)) {
|
||||
if (Object.hasOwn(process.env, key)) {
|
||||
if (override) {
|
||||
process.env[key] = envObject[key];
|
||||
|
||||
@@ -57,7 +57,7 @@ export function populateEnv(
|
||||
if (previousEnv) {
|
||||
// if there are any keys in previousEnv that are not in envObject, remove them from process.env
|
||||
for (const key of Object.keys(previousEnv)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(envObject, key)) {
|
||||
if (!Object.hasOwn(envObject, key)) {
|
||||
delete process.env[key];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user