Skip to content

Commit 881f8a1

Browse files
committed
fix: update eslint-config, fix eslint test issues
1 parent 801ea53 commit 881f8a1

18 files changed

+114
-104
lines changed

.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,15 @@
44
"jsdoc": {
55
"ignorePrivate": true
66
}
7+
},
8+
"rules": {
9+
"jsdoc/tag-lines": [
10+
// The Error level should be `error`, `warn`, or `off` (or 2, 1, or 0)
11+
"error",
12+
"never",
13+
{
14+
"startLines": null
15+
}
16+
]
717
}
818
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
},
2020
"repository": "adobe/aio-cli-plugin-events",
2121
"devDependencies": {
22-
"@adobe/eslint-config-aio-lib-config": "^2.0.0",
22+
"@adobe/eslint-config-aio-lib-config": "^2.0.1",
2323
"@types/jest": "^29.5.3",
2424
"acorn": "^8.10.0",
2525
"babel-runtime": "^6.26.0",
2626
"chalk": "^4.0.0",
2727
"eol": "^0.9.1",
28-
"eslint": "^8.38.0",
28+
"eslint": "^8.47.0",
2929
"eslint-config-oclif": "^3.1.0",
30-
"eslint-config-standard": "^17.0.0",
31-
"eslint-plugin-import": "^2.27.5",
32-
"eslint-plugin-jest": "^23.20.0",
33-
"eslint-plugin-jsdoc": "^37.9.7",
34-
"eslint-plugin-n": "^15.7.0",
30+
"eslint-config-standard": "^17.1.0",
31+
"eslint-plugin-import": "^2.28.0",
32+
"eslint-plugin-jest": "^27.2.3",
33+
"eslint-plugin-jsdoc": "^42.0.0",
34+
"eslint-plugin-n": "^16.0.1",
3535
"eslint-plugin-node": "^11.1.0",
3636
"eslint-plugin-promise": "^6.1.1",
3737
"eslint-plugin-standard": "^5.0.0",
@@ -42,7 +42,7 @@
4242
"jest-resolve": "^29.5.0",
4343
"oclif": "^3.2.0",
4444
"stdout-stderr": "^0.1.13",
45-
"typescript": "^5.0.4"
45+
"typescript": "^5.1.6"
4646
},
4747
"engines": {
4848
"node": "^14.18 || ^16.13 || >=18"

test/commands/event/eventmetadata/create.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,21 @@ describe('console:eventmetadata:create', () => {
8080
test('should create an event metadata and return response', async () => {
8181
command.argv = ['providerId']
8282
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', event_code: 'come.adobe.CODE01' })
83-
await expect(command.run()).resolves.not.toThrowError()
83+
await expect(command.run()).resolves.not.toThrow()
8484
expect(stdout.output).toMatchFixture('eventmetadata/create.txt')
8585
})
8686

8787
test('should create an event metadata and return response as json', async () => {
8888
command.argv = ['providerId', '--json']
8989
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', event_code: 'come.adobe.CODE01' })
90-
await expect(command.run()).resolves.not.toThrowError()
90+
await expect(command.run()).resolves.not.toThrow()
9191
expect(JSON.parse(stdout.output)).toMatchFixtureJson('eventmetadata/create.json')
9292
})
9393

9494
test('should create an event metadata and return response as yaml', async () => {
9595
command.argv = ['providerId', '--yml']
9696
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', event_code: 'come.adobe.CODE01' })
97-
await expect(command.run()).resolves.not.toThrowError()
97+
await expect(command.run()).resolves.not.toThrow()
9898
expect(stdout.output).toMatchFixture('eventmetadata/create.yml')
9999
})
100100
})
@@ -113,7 +113,7 @@ describe('console:eventmetadata:create', () => {
113113
test('should return error on create event metadata', async () => {
114114
command.argv = ['providerId']
115115
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', event_code: 'come.adobe.CODE01' })
116-
await expect(command.run()).rejects.toThrowError(new Error('Error creating event metadata'))
116+
await expect(command.run()).rejects.toThrow(new Error('Error creating event metadata'))
117117
})
118118
})
119119
})

test/commands/event/eventmetadata/delete.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,27 @@ describe('console:eventmetadata:delete', () => {
7676
command.argv = ['providerId']
7777
command.eventClient = { deleteAllEventMetadata: jest.fn().mockReturnValue('OK') }
7878
inquirer.prompt.mockResolvedValueOnce({ delete: true })
79-
await expect(command.run()).resolves.not.toThrowError()
79+
await expect(command.run()).resolves.not.toThrow()
8080
expect(stdout.output).toBe('All event metadata of provider providerId has been deleted successfully\n')
8181
})
8282
test('should delete one event metadata', async () => {
8383
command.argv = ['providerId', 'com.adobe.CODE01']
8484
command.eventClient = { deleteEventMetadata: jest.fn().mockReturnValue('OK') }
8585
inquirer.prompt.mockResolvedValueOnce({ delete: true })
86-
await expect(command.run()).resolves.not.toThrowError()
86+
await expect(command.run()).resolves.not.toThrow()
8787
expect(stdout.output).toBe('com.adobe.CODE01 event metadata of provider providerId has been deleted successfully\n')
8888
})
8989

9090
test('cancel delete all event metadata', async () => {
9191
command.argv = ['providerId']
9292
inquirer.prompt.mockResolvedValueOnce({ delete: false })
93-
await expect(command.run()).resolves.not.toThrowError()
93+
await expect(command.run()).resolves.not.toThrow()
9494
expect(stdout.output).toBe('Deletion operation has been cancelled. For more information on delete use --help\n')
9595
})
9696
test('cancel delete one event metadata', async () => {
9797
command.argv = ['providerId', 'com.adobe.CODE01']
9898
inquirer.prompt.mockResolvedValueOnce({ delete: false })
99-
await expect(command.run()).resolves.not.toThrowError()
99+
await expect(command.run()).resolves.not.toThrow()
100100
expect(stdout.output).toBe('Deletion operation has been cancelled. For more information on delete use --help\n')
101101
})
102102
})
@@ -115,14 +115,14 @@ describe('console:eventmetadata:delete', () => {
115115
command.argv = ['providerId']
116116
inquirer.prompt.mockResolvedValueOnce({ delete: true })
117117
command.eventClient = { deleteAllEventMetadata: jest.fn().mockRejectedValue('Error deleting all event metadata') }
118-
await expect(command.run()).rejects.toThrowError(new Error('Error deleting all event metadata'))
118+
await expect(command.run()).rejects.toThrow(new Error('Error deleting all event metadata'))
119119
})
120120

121121
test('should return error on delete one event metadata', async () => {
122122
command.argv = ['providerId', 'com.adobe.CODE01']
123123
command.eventClient = { deleteEventMetadata: jest.fn().mockRejectedValue('Error deleting event metadata') }
124124
inquirer.prompt.mockResolvedValueOnce({ delete: true })
125-
await expect(command.run()).rejects.toThrowError(new Error('Error deleting event metadata'))
125+
await expect(command.run()).rejects.toThrow(new Error('Error deleting event metadata'))
126126
})
127127
})
128128
})

test/commands/event/eventmetadata/get.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ describe('console:eventmetadata:get', () => {
6868
})
6969

7070
test('should return am event metadata', async () => {
71-
await expect(command.run()).resolves.not.toThrowError()
71+
await expect(command.run()).resolves.not.toThrow()
7272
expect(stdout.output).toMatchFixture('eventmetadata/get.txt')
7373
})
7474

7575
test('should return event metadata as json', async () => {
7676
command.argv = ['providerId', 'com.adobe.CODE01', '--json']
77-
await expect(command.run()).resolves.not.toThrowError()
77+
await expect(command.run()).resolves.not.toThrow()
7878
expect(JSON.parse(stdout.output)).toMatchFixtureJson('eventmetadata/get.json')
7979
})
8080

8181
test('should return event metadata as yaml', async () => {
8282
command.argv = ['providerId', 'com.adobe.CODE01', '--yml']
83-
await expect(command.run()).resolves.not.toThrowError()
83+
await expect(command.run()).resolves.not.toThrow()
8484
expect(stdout.output).toMatchFixture('eventmetadata/get.yml')
8585
})
8686
})
@@ -98,7 +98,7 @@ describe('console:eventmetadata:get', () => {
9898

9999
test('should return error on get event metadata', async () => {
100100
command.argv = ['providerId', 'com.adobe.CODE01']
101-
await expect(command.run()).rejects.toThrowError(new Error('Error retrieving event metadata'))
101+
await expect(command.run()).rejects.toThrow(new Error('Error retrieving event metadata'))
102102
})
103103
})
104104
})

test/commands/event/eventmetadata/list.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ describe('console:eventmetadata:list', () => {
6565

6666
test('should return list of event metadata', async () => {
6767
command.argv = ['providerId']
68-
await expect(command.run()).resolves.not.toThrowError()
68+
await expect(command.run()).resolves.not.toThrow()
6969
expect(stdout.output).toMatchFixture('eventmetadata/list.txt')
7070
})
7171

7272
test('should return list of event metadata as json', async () => {
7373
command.argv = ['providerId', '--json']
74-
await expect(command.run()).resolves.not.toThrowError()
74+
await expect(command.run()).resolves.not.toThrow()
7575
expect(JSON.parse(stdout.output)).toMatchFixtureJson('eventmetadata/list.json')
7676
})
7777

7878
test('should return list of event metadata as yaml', async () => {
7979
command.argv = ['providerId', '--yml']
80-
await expect(command.run()).resolves.not.toThrowError()
80+
await expect(command.run()).resolves.not.toThrow()
8181
expect(stdout.output).toMatchFixture('eventmetadata/list.yml')
8282
})
8383
})
@@ -95,7 +95,7 @@ describe('console:eventmetadata:list', () => {
9595

9696
test('should return error on get list of event metadata', async () => {
9797
command.argv = ['providerId']
98-
await expect(command.run()).rejects.toThrowError(new Error('Error retrieving event metadata'))
98+
await expect(command.run()).rejects.toThrow(new Error('Error retrieving event metadata'))
9999
})
100100
})
101101
})

test/commands/event/eventmetadata/update.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,21 @@ describe('console:eventmetadata:update', () => {
8282
test('should update an event metadata and return response', async () => {
8383
command.argv = ['providerId', 'com.adobe.CODE01']
8484
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL04', description: 'DESC04', docs_url: 'DOCS01' })
85-
await expect(command.run()).resolves.not.toThrowError()
85+
await expect(command.run()).resolves.not.toThrow()
8686
expect(stdout.output).toMatchFixture('eventmetadata/update.txt')
8787
})
8888

8989
test('should update an event metadata and return response as json', async () => {
9090
command.argv = ['providerId', 'com.adobe.CODE01', '--json']
9191
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL04', description: 'DESC04', docs_url: 'DOCS01' })
92-
await expect(command.run()).resolves.not.toThrowError()
92+
await expect(command.run()).resolves.not.toThrow()
9393
expect(JSON.parse(stdout.output)).toMatchFixtureJson('eventmetadata/update.json')
9494
})
9595

9696
test('should update a provider and return response as yaml', async () => {
9797
command.argv = ['providerId', 'com.adobe.CODE01', '--yml']
9898
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL04', description: 'DESC04', docs_url: 'DOCS01' })
99-
await expect(command.run()).resolves.not.toThrowError()
99+
await expect(command.run()).resolves.not.toThrow()
100100
expect(stdout.output).toMatchFixture('eventmetadata/update.yml')
101101
})
102102
})
@@ -115,7 +115,7 @@ describe('console:eventmetadata:update', () => {
115115
test('should return error on update provider', async () => {
116116
command.argv = ['providerId', 'com.adobe.CODE01']
117117
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL04', description: 'DESC04', docs_url: 'DOCS01' })
118-
await expect(command.run()).rejects.toThrowError(new Error('Error updating event metadata'))
118+
await expect(command.run()).rejects.toThrow(new Error('Error updating event metadata'))
119119
})
120120
})
121121
})

test/commands/event/provider/create.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,28 @@ describe('console:provider:create', () => {
7878

7979
test('should create a provider and return response', async () => {
8080
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', docs_url: 'DOCS01' })
81-
await expect(command.run()).resolves.not.toThrowError()
81+
await expect(command.run()).resolves.not.toThrow()
8282
expect(stdout.output).toMatchFixture('provider/create.txt')
8383
})
8484

8585
test('should create a provider and return response for empty desc and docs', async () => {
8686
command.eventClient = { createProvider: jest.fn().mockReturnValue(mock.data.createProviderWithoutDescAndDocsUrlResponse) }
8787
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: '', docs_url: '' })
88-
await expect(command.run()).resolves.not.toThrowError()
88+
await expect(command.run()).resolves.not.toThrow()
8989
expect(stdout.output).toMatchFixture('provider/emptyDescCreate.txt')
9090
})
9191

9292
test('should create a provider and return response as json', async () => {
9393
command.argv = ['--json']
9494
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', docs_url: 'DOCS01' })
95-
await expect(command.run()).resolves.not.toThrowError()
95+
await expect(command.run()).resolves.not.toThrow()
9696
expect(JSON.parse(stdout.output)).toMatchFixtureJson('provider/create.json')
9797
})
9898

9999
test('should create a provider and return response as yaml', async () => {
100100
command.argv = ['--yml']
101101
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', docs_url: 'DOCS01' })
102-
await expect(command.run()).resolves.not.toThrowError()
102+
await expect(command.run()).resolves.not.toThrow()
103103
expect(stdout.output).toMatchFixture('provider/create.yml')
104104
})
105105
})
@@ -117,7 +117,7 @@ describe('console:provider:create', () => {
117117

118118
test('should return error on create provider', async () => {
119119
inquirer.prompt.mockResolvedValueOnce({ label: 'LABEL01', description: 'DESC01', docs_url: 'DOCS01' })
120-
await expect(command.run()).rejects.toThrowError(new Error('Error creating provider'))
120+
await expect(command.run()).rejects.toThrow(new Error('Error creating provider'))
121121
})
122122
})
123123
})

test/commands/event/provider/delete.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ describe('console:provider:delete', () => {
7575
test('should delete provider', async () => {
7676
command.argv = ['providerId']
7777
inquirer.prompt.mockResolvedValueOnce({ delete: true })
78-
await expect(command.run()).resolves.not.toThrowError()
78+
await expect(command.run()).resolves.not.toThrow()
7979
expect(stdout.output).toBe('Provider providerId has been deleted successfully\n')
8080
})
8181

8282
test('cancel delete provider', async () => {
8383
command.argv = ['providerId']
8484
inquirer.prompt.mockResolvedValueOnce({ delete: false })
85-
await expect(command.run()).resolves.not.toThrowError()
85+
await expect(command.run()).resolves.not.toThrow()
8686
expect(stdout.output).toBe('Delete operation has been cancelled\n')
8787
})
8888
})
@@ -101,7 +101,7 @@ describe('console:provider:delete', () => {
101101
test('should return error on delete provider', async () => {
102102
command.argv = ['providerId']
103103
inquirer.prompt.mockResolvedValueOnce({ delete: true })
104-
await expect(command.run()).rejects.toThrowError(new Error('Error deleting provider'))
104+
await expect(command.run()).rejects.toThrow(new Error('Error deleting provider'))
105105
})
106106
})
107107
})

test/commands/event/provider/get.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ describe('console:provider:get', () => {
6767
})
6868

6969
test('should return a provider', async () => {
70-
await expect(command.run()).resolves.not.toThrowError()
70+
await expect(command.run()).resolves.not.toThrow()
7171
expect(stdout.output).toMatchFixture('provider/get.txt')
7272
})
7373

7474
test('should return provider as json', async () => {
7575
command.argv = ['providerId', '--json']
76-
await expect(command.run()).resolves.not.toThrowError()
76+
await expect(command.run()).resolves.not.toThrow()
7777
expect(JSON.parse(stdout.output)).toMatchFixtureJson('provider/get.json')
7878
})
7979

8080
test('should return provider as yaml', async () => {
8181
command.argv = ['providerId', '--yml']
82-
await expect(command.run()).resolves.not.toThrowError()
82+
await expect(command.run()).resolves.not.toThrow()
8383
expect(stdout.output).toMatchFixture('provider/get.yml')
8484
})
8585
})
@@ -97,7 +97,7 @@ describe('console:provider:get', () => {
9797

9898
test('should return error on get provider', async () => {
9999
command.argv = ['providerId']
100-
await expect(command.run()).rejects.toThrowError(new Error('Error retrieving provider'))
100+
await expect(command.run()).rejects.toThrow(new Error('Error retrieving provider'))
101101
})
102102
})
103103
})

0 commit comments

Comments
 (0)