Skip to content

Commit 2775717

Browse files
renovate[bot]JakeChampionmrstork
authored
chore(deps): update dependency @typescript-eslint/eslint-plugin to v8 (#5989)
* chore(deps): update dependency @typescript-eslint/eslint-plugin to v8 * chore: fix all the issues found from updating @typescript-eslint/eslint-plugin to v8 * fix: adjust eslint ignore rules for NetlifyAPI as the rules were renamed --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: jake champion <[email protected]> Co-authored-by: Mateusz Bocian <[email protected]>
1 parent b88daae commit 2775717

File tree

16 files changed

+436
-125
lines changed

16 files changed

+436
-125
lines changed

package-lock.json

Lines changed: 377 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"devDependencies": {
5050
"@commitlint/cli": "^17.1.2",
5151
"@commitlint/config-conventional": "^17.1.0",
52-
"@typescript-eslint/eslint-plugin": "^5.39.0",
52+
"@typescript-eslint/eslint-plugin": "^8.0.0",
5353
"ci-info": "^4.0.0",
5454
"eslint": "^8.24.0",
5555
"eslint-config-prettier": "^9.0.0",

packages/build-info/src/frameworks/nuxt.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ describe('Nuxt V3', () => {
5151
NODE_VERSION: '18',
5252
})
5353

54-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5554
const settings = await getSettings(detected![0], project, cwd)
5655
expect(settings.clearPublishDirectory).toBeTruthy()
5756
})

packages/build-info/src/metrics.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ describe('metrics', () => {
1010
test('returns an error when passed a string', async () => {
1111
const errorSpy = vi.spyOn(console, 'error')
1212
report('error happened', { client: mockClient })
13-
expect(errorSpy).toHaveBeenCalledOnce
13+
expect(errorSpy).toHaveBeenCalledOnce()
1414
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
1515
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
1616
})
1717

1818
test('returns an error when passed an error', async () => {
1919
const errorSpy = vi.spyOn(console, 'error')
2020
report(new Error('error happened'), { client: mockClient })
21-
expect(errorSpy).toHaveBeenCalledOnce
21+
expect(errorSpy).toHaveBeenCalledOnce()
2222
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
2323
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
2424
})
2525

2626
test('returns an object when passed an object in an expected format (1)', async () => {
2727
const errorSpy = vi.spyOn(console, 'error')
2828
report({ name: 'Error', message: 'error happened' }, { client: mockClient })
29-
expect(errorSpy).toHaveBeenCalledOnce
29+
expect(errorSpy).toHaveBeenCalledOnce()
3030
expect(errorSpy.mock.calls[0][0]).not.toBeInstanceOf(Error)
3131
expect(errorSpy.mock.calls[0][0].name).toBe('Error')
3232
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
@@ -35,7 +35,7 @@ describe('metrics', () => {
3535
test('returns an object when passed an object in an expected format (2)', async () => {
3636
const errorSpy = vi.spyOn(console, 'error')
3737
report({ errorClass: 'Error', errorMessage: 'error happened' }, { client: mockClient })
38-
expect(errorSpy).toHaveBeenCalledOnce
38+
expect(errorSpy).toHaveBeenCalledOnce()
3939
expect(errorSpy.mock.calls[0][0]).not.toBeInstanceOf(Error)
4040
expect(errorSpy.mock.calls[0][0].errorClass).toBe('Error')
4141
expect(errorSpy.mock.calls[0][0].errorMessage).toBe('error happened')
@@ -44,15 +44,15 @@ describe('metrics', () => {
4444
test('returns an error when passed an object in an unexpected format but includes a message', async () => {
4545
const errorSpy = vi.spyOn(console, 'error')
4646
report({ message: 'error happened', documentation_url: 'bar' }, { client: mockClient })
47-
expect(errorSpy).toHaveBeenCalledOnce
47+
expect(errorSpy).toHaveBeenCalledOnce()
4848
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
4949
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
5050
})
5151

5252
test('returns an error when passed an object in an unexpected format', async () => {
5353
const errorSpy = vi.spyOn(console, 'error')
5454
report({ foo: 'bar' }, { client: mockClient })
55-
expect(errorSpy).toHaveBeenCalledOnce
55+
expect(errorSpy).toHaveBeenCalledOnce()
5656
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
5757
expect(errorSpy.mock.calls[0][0].message).toBe('Unexpected error format: {"foo":"bar"}')
5858
})

packages/build-info/src/node/get-build-info.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ test('should not crash on invalid projects', async (ctx) => {
6666
test.skipIf(platform() === 'win32')('should retrieve the build info for providing a rootDir', async (ctx) => {
6767
const fixture = await createFixture('pnpm-workspace', ctx)
6868
const info = await getBuildInfo({ rootDir: fixture.cwd })
69-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
69+
7070
info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
7171
expect(info).toMatchSnapshot()
7272
})
@@ -76,7 +76,7 @@ test.skipIf(platform() === 'win32')(
7676
async (ctx) => {
7777
const fixture = await createFixture('pnpm-workspace', ctx)
7878
const info = await getBuildInfo({ rootDir: fixture.cwd, projectDir: fixture.cwd })
79-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
79+
8080
info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
8181
expect(info).toMatchSnapshot()
8282
},
@@ -87,7 +87,7 @@ test.skipIf(platform() === 'win32')(
8787
async (ctx) => {
8888
const fixture = await createFixture('pnpm-workspace', ctx)
8989
const info = await getBuildInfo({ rootDir: fixture.cwd, projectDir: join(fixture.cwd, 'packages/blog') })
90-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90+
9191
info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
9292
expect(info).toMatchSnapshot()
9393
},

packages/build-info/src/runtime/runtime.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { Project } from '../project.js'
22

3-
export interface LangRuntime {
4-
id: string
5-
name: string
6-
}
7-
83
export abstract class LangRuntime {
94
id: string
105
name: string

packages/build-info/src/workspaces/get-workspace-packages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function findPackages(
7070
: project.fs.resolve(dir)
7171
try {
7272
content = await project.fs.readDir(startDir, true)
73-
} catch (err) {
73+
} catch {
7474
// noop
7575
}
7676

packages/build/src/error/types.ts

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,44 @@ export type BasicErrorInfo = {
2626
/**
2727
* Error severity groups the errors emitted by build and used to translate to exit code via SEVERITY_MAP
2828
*/
29-
enum ErrorSeverity {
29+
type ErrorSeverity =
3030
/**
3131
* build success
3232
*/
33-
success = 'success',
33+
| 'success'
3434
/**
3535
* not an error, e.g. build cancellation
3636
*/
37-
none = 'none',
37+
| 'none'
3838
/**
3939
* user error
4040
*/
41-
info = 'info',
41+
| 'info'
4242
/**
4343
* community plugin error
4444
*/
45-
warning = 'warning',
45+
| 'warning'
4646
/**
4747
* system error, including core plugin error
4848
*/
49-
error = 'Error',
50-
}
49+
| 'error'
5150

5251
/**
5352
* How the stack trace should appear in the build error logs
5453
*/
55-
enum StackType {
54+
type StackType =
5655
/**
5756
* not printed
5857
*/
59-
none = 'none',
58+
| 'none'
6059
/*
6160
* printed as is
6261
*/
63-
stack = 'stack',
62+
| 'stack'
6463
/**
6564
* printed as is, but taken from `error.message`. Used when `error.stack` is not being correct due to the error being passed between different processes.
6665
*/
67-
message = 'message',
68-
}
66+
| 'message'
6967

7068
type GroupFunction = ({ location }: { location: ErrorLocation }) => string
7169
export type TitleFunction = ({ location }: { location: ErrorLocation }) => string
@@ -274,42 +272,41 @@ export interface ErrorType {
274272
/**
275273
* error severity (also used by Bugsnag)
276274
*/
277-
severity: keyof typeof ErrorSeverity
275+
severity: ErrorSeverity
278276
/**
279277
* how the stack trace should appear in build error logs
280278
*/
281-
stackType: keyof typeof StackType
279+
stackType: StackType
282280
}
283281

284-
const ErrorTypeMap = {
282+
type ErrorTypeMap =
285283
/**
286284
* Plugin called `utils.build.cancelBuild()`
287285
*/
288-
cancelBuild: 'cancelBuild',
289-
resolveConfig: 'resolveConfig',
290-
dependencies: 'dependencies',
291-
pluginInput: 'pluginInput',
292-
pluginUnsupportedVersion: 'pluginUnsupportedVersion',
293-
buildCommand: 'buildCommand',
294-
functionsBundling: 'functionsBundling',
295-
secretScanningFoundSecrets: 'secretScanningFoundSecrets',
296-
failPlugin: 'failPlugin',
297-
failBuild: 'failBuild',
298-
pluginValidation: 'pluginValidation',
299-
pluginInternal: 'pluginInternal',
300-
ipc: 'ipc',
301-
corePlugin: 'corePlugin',
302-
trustedPlugin: 'trustedPlugin',
303-
coreStep: 'coreStep',
304-
api: 'api',
305-
deploy: 'deploy',
306-
deployInternal: 'deployInternal',
307-
exception: 'exception',
308-
telemetry: 'telemetry',
309-
} as const
286+
| 'cancelBuild'
287+
| 'resolveConfig'
288+
| 'dependencies'
289+
| 'pluginInput'
290+
| 'pluginUnsupportedVersion'
291+
| 'buildCommand'
292+
| 'functionsBundling'
293+
| 'secretScanningFoundSecrets'
294+
| 'failPlugin'
295+
| 'failBuild'
296+
| 'pluginValidation'
297+
| 'pluginInternal'
298+
| 'ipc'
299+
| 'corePlugin'
300+
| 'trustedPlugin'
301+
| 'coreStep'
302+
| 'api'
303+
| 'deploy'
304+
| 'deployInternal'
305+
| 'exception'
306+
| 'telemetry'
310307

311308
/* Error classes for build executions */
312-
export type ErrorTypes = keyof typeof ErrorTypeMap
309+
export type ErrorTypes = ErrorTypeMap
313310

314311
/**
315312
* List of error types, and their related properties

packages/build/src/plugins/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const getSpawnInfo = (): {
113113
}
114114
} => {
115115
// we know that this package.json has a name as it's ours
116-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
116+
117117
const packageName = ROOT_PACKAGE_JSON.name!
118118
return {
119119
plugin: { packageName, pluginPackageJson: ROOT_PACKAGE_JSON },

packages/build/src/plugins_core/pre_dev_cleanup/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const dirExists = async (path: string): Promise<boolean> => {
99
try {
1010
await stat(path)
1111
return true
12-
} catch (error) {
12+
} catch {
1313
return false
1414
}
1515
}

packages/build/src/utils/resolve.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const resolvePath = async function (path, basedir) {
2323
// Fallback.
2424
// `resolve` sometimes gives unhelpful error messages.
2525
// https://github.com/browserify/resolve/issues/223
26-
} catch (e) {
26+
} catch {
2727
return require.resolve(path, { paths: [basedir] })
2828
}
2929
}

packages/config/src/api/site_info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const getIntegrations = async function ({
160160
const response = await fetch(url)
161161
const integrations = await response.json()
162162
return Array.isArray(integrations) ? integrations : []
163-
} catch (error) {
163+
} catch {
164164
return []
165165
}
166166
}

packages/js-client/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ type APIOptions = {
4040
* const sites = await client.listSites()
4141
* ```
4242
*/
43-
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- NetlifyAPI is a class and the interface just inherits mapped types
43+
// NetlifyAPI is a class and the interface just inherits mapped types
44+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-unsafe-declaration-merging
4445
export interface NetlifyAPI extends DynamicMethods {}
4546

47+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
4648
export class NetlifyAPI {
4749
#accessToken: string | undefined | null = null
4850

packages/opentelemetry-sdk-setup/tests/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ test('Tracing - trace id and resource definition', async () => {
126126
const tracer = trace.getTracer('test')
127127
const span = tracer.startSpan('test', {}, ctx) as Span
128128

129-
expect(span.spanContext().traceId).not.empty
129+
expect(span.spanContext().traceId).toBeDefined()
130130
expect(span.parentSpanId).toBeUndefined()
131131
})
132132

packages/opentelemetry-utils/tests/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test('addErrorToActiveSpan - no attributes are added', async () => {
6464

6565
const firstEvent = span.events[0]
6666
expect(firstEvent.name).equal('exception')
67-
expect(firstEvent.attributes?.['exception.stacktrace']).to.exist
67+
expect(firstEvent.attributes?.['exception.stacktrace']).toBeDefined()
6868
expect(firstEvent.attributes?.['exception.type']).equal('Error')
6969
})
7070
})
@@ -90,7 +90,7 @@ test('addErrorToActiveSpan - attributes are added', async () => {
9090

9191
const firstEvent = span.events[0]
9292
expect(firstEvent.name).equal('exception')
93-
expect(firstEvent.attributes?.['exception.stacktrace']).to.exist
93+
expect(firstEvent.attributes?.['exception.stacktrace']).toBeDefined()
9494
expect(firstEvent.attributes?.['exception.type']).equal('Error')
9595
})
9696
})

packages/zip-it-and-ship-it/tests/main.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ interface CustomMatchers {
5353
}
5454

5555
declare module 'vitest' {
56-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
56+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
5757
interface Assertion extends CustomMatchers {}
58-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
58+
59+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
5960
interface AsymmetricMatchersContaining extends CustomMatchers {}
6061
}
6162

0 commit comments

Comments
 (0)