Skip to content

Commit

Permalink
add a couple of more recommended lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 24, 2024
1 parent 4383ee5 commit 7e9c417
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ module.exports = {
'no-dupe-keys': 'error',
'no-unreachable': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/no-unused-vars': [
'warn',
// Never warn about unused parameters
// See: https://eslint.org/docs/latest/rules/no-unused-vars#args
{'args': 'none'}
{ 'argsIgnorePattern': '^_' }
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/collections/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class FindCursor {
* @returns Promise<number>
* @param options
*/
async count(options?: any) {
async count(_options?: any) {
return executeOperation(async () => {
await this.getAll();
return this.documents.length;
Expand All @@ -188,7 +188,7 @@ export class FindCursor {
*
* @param options
*/
stream(options?: any) {
stream(_options?: any) {
throw new Error('Streaming cursors are not supported');
}
}
2 changes: 1 addition & 1 deletion src/collections/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const updateOneInternalOptionsKeys: Set<string> = new Set(

export type IndexingOptions = { deny: string[], allow?: never } | { allow: string[], deny?: never };

export type DefaultIdOptions = { type: 'objectId' | 'uuid' | 'uuid6' | 'uuid7' };
export interface DefaultIdOptions { type: 'objectId' | 'uuid' | 'uuid6' | 'uuid7' }

class _CreateCollectionOptions {
vector?: VectorOptions = undefined;
Expand Down
12 changes: 6 additions & 6 deletions src/driver/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class Collection extends MongooseCollection {
* @param ops
* @param options
*/
bulkWrite(ops: any[], options?: any) {
bulkWrite(_ops: any[], _options?: any) {
throw new OperationNotSupportedError('bulkWrite() Not Implemented');
}

Expand All @@ -302,7 +302,7 @@ export class Collection extends MongooseCollection {
* @param pipeline
* @param options
*/
aggregate(pipeline: any[], options?: any) {
aggregate(_pipeline: any[], _options?: any) {
throw new OperationNotSupportedError('aggregate() Not Implemented');
}

Expand All @@ -311,23 +311,23 @@ export class Collection extends MongooseCollection {
* @param docs
* @param options
*/
bulkSave(docs: any[], options?: any) {
bulkSave(_docs: any[], _options?: any) {
throw new OperationNotSupportedError('bulkSave() Not Implemented');
}

/**
* Clean indexes not supported.
* @param options
*/
cleanIndexes(options?: any) {
cleanIndexes(_options?: any) {
throw new OperationNotSupportedError('cleanIndexes() Not Implemented');
}

/**
* List indexes not supported.
* @param options
*/
listIndexes(options?: any) {
listIndexes(_options?: any) {
throw new OperationNotSupportedError('listIndexes() Not Implemented');
}

Expand All @@ -336,7 +336,7 @@ export class Collection extends MongooseCollection {
* @param fieldOrSpec
* @param options
*/
createIndex(fieldOrSpec: any, options?: any) {
createIndex(_fieldOrSpec: any, _options?: any) {
throw new OperationNotSupportedError('createIndex() Not Implemented');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const createSampleDoc = () => ({
username: 'aaron'
});

export type Employee = {
export interface Employee {
_id?: string;
username?: string;
human?: boolean;
Expand Down

0 comments on commit 7e9c417

Please sign in to comment.