Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Nov 4, 2023
1 parent 99d1370 commit 546f482
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class Database {
* @param {function} [callback]
* @return {Promise}
*/
save(callback?: NodeJSLikeCallback<any>): Bluebird<void>{
save(callback?: NodeJSLikeCallback<any>): Bluebird<void> {
const { path } = this.options;

if (!path) throw new WarehouseError('options.path is required');
Expand Down
6 changes: 3 additions & 3 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const hookWrapper = (fn: (callback: NodeJSLikeCallback<any>, options?: Promise.P
/**
* @param {Function[]} stack
*/
const execSortStack = (stack: Function[]) => {
const execSortStack = (stack: ((a: unknown, b: unknown) => number)[]) => {
const len = stack.length;

return (a: any, b: any) => {
Expand Down Expand Up @@ -430,7 +430,7 @@ class Schema {
* @param {Object} schema
* @param {String} prefix
*/
add(schema: Record<string, any>, prefix: string = ''): void {
add(schema: Record<string, any>, prefix = ''): void {
const keys = Object.keys(schema);
const len = keys.length;

Expand Down Expand Up @@ -715,7 +715,7 @@ class Schema {
* @return {queryParseCallback[]}
* @private
*/
_parseSort(sorts: object, prefix: string = '', stack: queryParseCallback[] = []): queryParseCallback[] {
_parseSort(sorts: object, prefix = '', stack: queryParseCallback[] = []): queryParseCallback[] {
const { paths } = this;
const keys = Object.keys(sorts);

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ interface Options {
skip?: number;
limit?: number;
[key: PropertyKey]: any;
}
}
2 changes: 1 addition & 1 deletion src/types/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SchemaTypeString extends SchemaType<string> {
return value === query;
}

if (typeof (query as any).test === 'function') {
if (typeof(query as any).test === 'function') {
return (query as RegExp).test(value);
}

Expand Down
8 changes: 4 additions & 4 deletions test/scripts/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('Schema', () => {
(() => schema.pre('wtf', () => {})).should.to.throw(TypeError, 'Hook type must be `save` or `remove`!');

// hook is not a function
//@ts-ignore
// @ts-ignore
(() => schema.pre('save', {})).should.to.throw(TypeError, 'Hook must be a function!');
});

Expand All @@ -124,7 +124,7 @@ describe('Schema', () => {
(() => schema.post('wtf', () => {})).should.throw(TypeError, 'Hook type must be `save` or `remove`!');

// hook is not a function
//@ts-ignore
// @ts-ignore
(() => schema.post('save', {})).should.to.throw(TypeError, 'Hook must be a function!');
});

Expand All @@ -139,7 +139,7 @@ describe('Schema', () => {
schema.method.should.to.throw(TypeError, 'Method name is required!');

// without function
//@ts-ignore
// @ts-ignore
(() => schema.method('wtf', {})).should.to.throw(TypeError, 'Instance method must be a function!');
});

Expand All @@ -154,7 +154,7 @@ describe('Schema', () => {
schema.static.should.to.throw(TypeError, 'Method name is required!');

// without function
//@ts-ignore
// @ts-ignore
(() => schema.static('wtf', {})).should.to.throw(TypeError, 'Static method must be a function!');
});
});
4 changes: 2 additions & 2 deletions test/scripts/types/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('SchemaTypeBuffer', () => {
it('match()', () => {
type.match(Buffer.from([97, 98, 99]), Buffer.from([97, 98, 99])).should.be.true;
type.match(Buffer.from([97, 98, 99]), Buffer.from([97, 98, 100])).should.be.false;
//@ts-ignore
// @ts-ignore
type.match(undefined, Buffer.from([97, 98, 99])).should.be.false;
//@ts-ignore
// @ts-ignore
type.match(undefined, undefined).should.be.true;
});

Expand Down
4 changes: 2 additions & 2 deletions test/scripts/types/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ describe('SchemaTypeDate', () => {
it('match()', () => {
type.match(new Date(2014, 1, 1), new Date(2014, 1, 1)).should.be.true;
type.match(new Date(2014, 1, 1), new Date(2014, 1, 2)).should.be.false;
//@ts-ignore
// @ts-ignore
type.match(undefined, new Date()).should.be.false;
//@ts-ignore
// @ts-ignore
type.match(undefined, undefined).should.be.true;
});

Expand Down
4 changes: 2 additions & 2 deletions test/scripts/types/virtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('SchemaTypeVirtual', () => {
});

it('get() - type check', () => {
//@ts-ignore
// @ts-ignore
(() => type.get(123)).should.to.throw(TypeError, 'Getter must be a function!');
});

Expand All @@ -27,7 +27,7 @@ describe('SchemaTypeVirtual', () => {
});

it('set() - type check', () => {
//@ts-ignore
// @ts-ignore
(() => type.set(123)).should.to.throw(TypeError, 'Setter must be a function!');
});

Expand Down

0 comments on commit 546f482

Please sign in to comment.