-
Couldn't load subscription status.
- Fork 65
fixing eslint issues #1480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fixing eslint issues #1480
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export declare enum HandshakeProtocol { | ||
| Connections = "https://didcomm.org/connections/1.0", | ||
| DidExchange = "https://didcomm.org/didexchange/1.0" | ||
| } | ||
| Connections = 'https://didcomm.org/connections/1.0', | ||
| DidExchange = 'https://didcomm.org/didexchange/1.0' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export declare enum HandshakeProtocol { | ||
| Connections = "https://didcomm.org/connections/1.0", | ||
| DidExchange = "https://didcomm.org/didexchange/1.0" | ||
| } | ||
| Connections = 'https://didcomm.org/connections/1.0', | ||
| DidExchange = 'https://didcomm.org/didexchange/1.0' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,39 @@ | ||
| import { ApiProperty } from "@nestjs/swagger"; | ||
| import { IsArray, IsNotEmpty, IsString } from "class-validator"; | ||
| import { ApiProperty } from '@nestjs/swagger'; | ||
| import { IsArray, IsNotEmpty, IsString } from 'class-validator'; | ||
|
|
||
| interface attributeValue { | ||
| name: string, | ||
| value: string, | ||
| name: string; | ||
| value: string; | ||
| } | ||
|
|
||
| export class IssueCredentialOffer { | ||
| @ApiProperty({ example: { protocolVersion: 'v1' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid protocol-version' }) | ||
| @IsString({ message: 'protocol-version should be string' }) | ||
| protocolVersion: string; | ||
|
|
||
| @ApiProperty({ example: { 'protocolVersion': 'v1' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid protocol-version' }) | ||
| @IsString({ message: 'protocol-version should be string' }) | ||
| protocolVersion: string; | ||
|
|
||
| @ApiProperty({ example: { 'attributes': [{ 'value': 'string', 'name': 'string' }] } }) | ||
| @IsNotEmpty({ message: 'Please provide valid attributes' }) | ||
| @IsArray({ message: 'attributes should be array' }) | ||
| attributes: attributeValue[]; | ||
| @ApiProperty({ example: { attributes: [{ value: 'string', name: 'string' }] } }) | ||
| @IsNotEmpty({ message: 'Please provide valid attributes' }) | ||
| @IsArray({ message: 'attributes should be array' }) | ||
| attributes: attributeValue[]; | ||
|
|
||
| @ApiProperty({ example: { 'credentialDefinitionId': 'string' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid credentialDefinitionId' }) | ||
| @IsString({ message: 'credentialDefinitionId should be string' }) | ||
| credentialDefinitionId: string; | ||
| @ApiProperty({ example: { credentialDefinitionId: 'string' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid credentialDefinitionId' }) | ||
| @IsString({ message: 'credentialDefinitionId should be string' }) | ||
| credentialDefinitionId: string; | ||
|
|
||
| @ApiProperty({ example: { autoAcceptCredential: 'always' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid autoAcceptCredential' }) | ||
| @IsString({ message: 'autoAcceptCredential should be string' }) | ||
| autoAcceptCredential: string; | ||
| @ApiProperty({ example: { autoAcceptCredential: 'always' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid autoAcceptCredential' }) | ||
| @IsString({ message: 'autoAcceptCredential should be string' }) | ||
| autoAcceptCredential: string; | ||
|
|
||
| @ApiProperty({ example: { comment: 'string' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid comment' }) | ||
| @IsString({ message: 'comment should be string' }) | ||
| comment: string; | ||
| @ApiProperty({ example: { comment: 'string' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid comment' }) | ||
| @IsString({ message: 'comment should be string' }) | ||
| comment: string; | ||
|
|
||
| @ApiProperty({ example: { connectionId: '3fa85f64-5717-4562-b3fc-2c963f66afa6' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid connection-id' }) | ||
| @IsString({ message: 'Connection-id should be string' }) | ||
| connectionId: string; | ||
| @ApiProperty({ example: { connectionId: '3fa85f64-5717-4562-b3fc-2c963f66afa6' } }) | ||
| @IsNotEmpty({ message: 'Please provide valid connection-id' }) | ||
| @IsString({ message: 'Connection-id should be string' }) | ||
| connectionId: string; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| import { ApiProperty } from "@nestjs/swagger"; | ||
| import { IsNotEmpty, IsString } from "class-validator"; | ||
| import { ApiProperty } from '@nestjs/swagger'; | ||
| import { IsNotEmpty, IsString } from 'class-validator'; | ||
|
|
||
| export class CredentialSendOffer { | ||
|
|
||
| @ApiProperty({ example: 'string' }) | ||
| @IsNotEmpty({ message: 'Please provide valid credentialRecordId' }) | ||
| @IsString({ message: 'credentialRecordId should be string' }) | ||
| credentialRecordId: string; | ||
| @ApiProperty({ example: 'string' }) | ||
| @IsNotEmpty({ message: 'Please provide valid credentialRecordId' }) | ||
| @IsString({ message: 'credentialRecordId should be string' }) | ||
| credentialRecordId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,36 +1,26 @@ | ||||||||||||||||||||||||||||||||||||||||
| import { promisify } from "util"; | ||||||||||||||||||||||||||||||||||||||||
| import * as fs from "fs"; | ||||||||||||||||||||||||||||||||||||||||
| import { promisify } from 'util'; | ||||||||||||||||||||||||||||||||||||||||
| import * as fs from 'fs'; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export const createFile = async (path: string, fileName: string, data: string): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line @typescript-eslint/no-use-before-define | ||||||||||||||||||||||||||||||||||||||||
| if (!checkIfFileOrDirectoryExists(path)) { | ||||||||||||||||||||||||||||||||||||||||
| fs.mkdirSync(path, { recursive: true }); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||||||||||||||||||||||||||||||||||||||
| const writeFile = promisify(fs.writeFile); | ||||||||||||||||||||||||||||||||||||||||
| return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8'); | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused promisified The function promisifies Choose one approach: Option 1 (async): Use the promisified version consistently: export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {
fs.mkdirSync(path);
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const writeFile = promisify(fs.writeFile);
- return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
+ return writeFile(`${path}/${fileName}`, data, 'utf8');
};Option 2 (sync): Remove async and promisify: -export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
+export const createFile = (path: string, fileName: string, data: string): void => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {
fs.mkdirSync(path);
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- const writeFile = promisify(fs.writeFile);
- return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
+ fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
};📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export const createFile = async ( | ||||||||||||||||||||||||||||||||||||||||
| path: string, | ||||||||||||||||||||||||||||||||||||||||
| fileName: string, | ||||||||||||||||||||||||||||||||||||||||
| data: string | ||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line @typescript-eslint/no-use-before-define | ||||||||||||||||||||||||||||||||||||||||
| if (!checkIfFileOrDirectoryExists(path)) { | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| fs.mkdirSync(path); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||||||||||||||||||||||||||||||||||||||
| const writeFile = promisify(fs.writeFile); | ||||||||||||||||||||||||||||||||||||||||
| return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8'); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| export const checkIfFileOrDirectoryExists = (path: string): boolean => fs.existsSync(path); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export const checkIfFileOrDirectoryExists = (path: string): boolean => fs.existsSync(path); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export const getFile = async ( | ||||||||||||||||||||||||||||||||||||||||
| path: string, | ||||||||||||||||||||||||||||||||||||||||
| encoding: BufferEncoding | ||||||||||||||||||||||||||||||||||||||||
| ): Promise<string | Buffer> => { | ||||||||||||||||||||||||||||||||||||||||
| const readFile = promisify(fs.readFile); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return encoding ? readFile(path, {encoding}) : readFile(path, {}); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| export const getFile = async (path: string, encoding: BufferEncoding): Promise<string | Buffer> => { | ||||||||||||||||||||||||||||||||||||||||
| const readFile = promisify(fs.readFile); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return encoding ? readFile(path, { encoding }) : readFile(path, {}); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export const deleteFile = async (path: string): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||
| const unlink = promisify(fs.unlink); | ||||||||||||||||||||||||||||||||||||||||
| return unlink(path); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| export const deleteFile = async (path: string): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||
| const unlink = promisify(fs.unlink); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return unlink(path); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,83 +1,82 @@ | ||
| import { ApiPropertyOptional } from "@nestjs/swagger"; | ||
| import { IsOptional } from "class-validator"; | ||
| import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
| import { IsOptional } from 'class-validator'; | ||
|
|
||
| interface IWebhookPresentationProof { | ||
| threadId: string; | ||
| state: string; | ||
| connectionId | ||
| threadId: string; | ||
| state: string; | ||
| connectionId; | ||
| } | ||
|
|
||
| export class WebhookPresentationProofDto { | ||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| metadata: object; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| metadata: object; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| _tags: IWebhookPresentationProof; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| id: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| createdAt: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| protocolVersion: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| state: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| connectionId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| threadId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| parentThreadId?: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| presentationId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| autoAcceptProof: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| updatedAt: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| isVerified: boolean; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| contextCorrelationId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| type: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| proofData: object; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| orgId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| errorMessage: string; | ||
| } | ||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| _tags: IWebhookPresentationProof; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| id: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| createdAt: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| protocolVersion: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| state: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| connectionId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| threadId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| parentThreadId?: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| presentationId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| autoAcceptProof: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| updatedAt: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| isVerified: boolean; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| contextCorrelationId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| type: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| proofData: object; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| orgId: string; | ||
|
|
||
| @ApiPropertyOptional() | ||
| @IsOptional() | ||
| errorMessage: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swagger examples are incorrectly nested; use field-value examples.
Examples should represent the property value directly, not
{ propertyName: value }. Fix to avoid misleading API docs.Optional:
attributeValuetoAttributeValue(PascalCase for interfaces).@IsUUID()forconnectionId.🤖 Prompt for AI Agents