Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance/repository-cloudant/docker.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function createDB() {
// retry if socket hangs up too early
try {
dbRequest(opts);
} catch (error) {
} catch {
dbRequest(opts);
}
return new Promise(() => {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/rest-routing/routing-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function givenRouter(router: RestRouter, spec: OpenApiSpec, count: number) {
try {
table.find(request);
found++;
} catch (e) {
} catch {
missed++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/context/src/custom-configuration-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EnvConfigResolver
);
try {
return JSON.parse(val);
} catch (err) {
} catch {
return val;
}
}
Expand Down
6 changes: 2 additions & 4 deletions examples/file-transfer/src/services/file-upload.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import {FileUploadHandler} from '../types';
})
export class FileUploadProvider implements Provider<FileUploadHandler> {
constructor(@config() private options: multer.Options = {}) {
if (!this.options.storage) {
// Default to in-memory storage
this.options.storage = multer.memoryStorage();
}
// Default to in-memory storage
this.options.storage ??= multer.memoryStorage();
}

value(): FileUploadHandler {
Expand Down
2 changes: 1 addition & 1 deletion examples/log-extension/src/decorators/log.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {LevelMetadata} from '../types';
* @param level - The Log Level at or above it should log
*/
export function log(level?: number) {
if (level === undefined) level = LOG_LEVEL.WARN;
level ??= LOG_LEVEL.WARN;
return MethodDecoratorFactory.createDecorator<LevelMetadata>(
EXAMPLE_LOG_METADATA_KEY,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export class BasicStrategy implements AuthenticationStrategy {
return done(null, false);
}
const user = users[0];
// Keep the explicit guard, `credentials?.password !== password` would
// accept a user without credentials when `password` is `undefined`
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (!user.credentials || user.credentials.password !== password) {
return done(null, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export class LocalAuthStrategy implements AuthenticationStrategy {
return done(null, null, {message: AUTH_FAILED_MESSAGE});
}
const user = users[0];
// Keep the explicit guard, `credentials?.password !== password` would
// accept a user without credentials when `password` is `undefined`
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (!user.credentials || user.credentials.password !== password) {
return done(null, null, {message: AUTH_FAILED_MESSAGE});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/src/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function givenTodo(todo?: Partial<Todo>) {

export const aLocation = {
address: '1 New Orchard Road, Armonk, 10504',
geopoint: <GeoPoint>{y: 41.109728357749, x: -73.72462031805},
geopoint: <GeoPoint>{y: 41.109725723771, x: -73.724620709372},
get geostring() {
return `${this.geopoint.y},${this.geopoint.x}`;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ skipIf<[(this: Suite) => void], void>(
let browser: Browser;
let html: string;
before(async function (this: Mocha.Context) {
this.timeout(15000);
// Launching the browser can be slow on CI
this.timeout(30000);
browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class RefreshtokenService {
await this.refreshTokenRepository.delete(
new RefreshToken({refreshToken: refreshToken}),
);
} catch (e) {
} catch {
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,7 @@ export class SequelizeCrudRepository<
return [];
}

if (!sourceModel) {
sourceModel = this.sequelizeModel;
}
sourceModel ??= this.sequelizeModel;

if (sourceModel === this.sequelizeModel) {
const invalidInclusions = inclusionFilters.filter(
Expand Down Expand Up @@ -663,8 +661,7 @@ export class SequelizeCrudRepository<
}

const entityClassCol = this.entityClass.definition.properties[columnName];
const isBooleanColumn =
entityClassCol && entityClassCol.type === 'boolean';
const isBooleanColumn = entityClassCol?.type === 'boolean';

if (isTruelyObject(conditionValue)) {
sequelizeWhere[columnName] = {};
Expand Down Expand Up @@ -934,7 +931,7 @@ export class SequelizeCrudRepository<
const stringTypeArray =
definition[propName].itemType === String ||
['String', 'string'].includes(
definition[propName].itemType?.toString() || '',
definition[propName].itemType?.toString() ?? '',
);
dataType = stringTypeArray
? DataTypes.ARRAY(DataTypes.STRING)
Expand Down Expand Up @@ -1008,7 +1005,7 @@ export class SequelizeCrudRepository<
if (typeof value === 'string') {
try {
return JSON.parse(value);
} catch (_error) {
} catch {
return null;
}
}
Expand Down
15 changes: 5 additions & 10 deletions extensions/socketio/src/socketio.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export class SocketIoServer extends Context {
if (meta instanceof RegExp || typeof meta === 'string') {
meta = {namespace: meta} as SocketIoMetadata;
}
if (meta == null) {
meta = getSocketIoMetadata(controllerClass) as SocketIoMetadata;
}
meta ??= getSocketIoMetadata(controllerClass) as SocketIoMetadata;
const nsp = meta?.namespace ? this.io.of(meta.namespace) : this.io;
if (meta?.name) {
this.app.bind(getNamespaceKeyForName(meta.name)).to(nsp);
Expand Down Expand Up @@ -280,14 +278,11 @@ function resolveHttpServerConfig(
);

// Can't check falsiness, 0 is a valid port.
if (result.port == null) {
result.port = 3000;
}
result.port ??= 3000;

if (result.host == null) {
// Set it to '' so that the http server will listen on all interfaces
result.host = undefined;
}
// Normalize a `null` host to `undefined` so that the http server listens on
// all interfaces
result.host ??= undefined;

return result;
}
Loading
Loading