Skip to content
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

chore(deps): update dependency @typescript-eslint/eslint-plugin to v8 #5989

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
437 changes: 377 additions & 60 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"ci-info": "^4.0.0",
"eslint": "^8.24.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/build-info/src/frameworks/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ describe('Nuxt V3', () => {
NODE_VERSION: '18',
})

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const settings = await getSettings(detected![0], project, cwd)
expect(settings.clearPublishDirectory).toBeTruthy()
})
Expand Down
12 changes: 6 additions & 6 deletions packages/build-info/src/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ describe('metrics', () => {
test('returns an error when passed a string', async () => {
const errorSpy = vi.spyOn(console, 'error')
report('error happened', { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
})

test('returns an error when passed an error', async () => {
const errorSpy = vi.spyOn(console, 'error')
report(new Error('error happened'), { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
})

test('returns an object when passed an object in an expected format (1)', async () => {
const errorSpy = vi.spyOn(console, 'error')
report({ name: 'Error', message: 'error happened' }, { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).not.toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].name).toBe('Error')
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
Expand All @@ -35,7 +35,7 @@ describe('metrics', () => {
test('returns an object when passed an object in an expected format (2)', async () => {
const errorSpy = vi.spyOn(console, 'error')
report({ errorClass: 'Error', errorMessage: 'error happened' }, { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).not.toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].errorClass).toBe('Error')
expect(errorSpy.mock.calls[0][0].errorMessage).toBe('error happened')
Expand All @@ -44,15 +44,15 @@ describe('metrics', () => {
test('returns an error when passed an object in an unexpected format but includes a message', async () => {
const errorSpy = vi.spyOn(console, 'error')
report({ message: 'error happened', documentation_url: 'bar' }, { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].message).toBe('error happened')
})

test('returns an error when passed an object in an unexpected format', async () => {
const errorSpy = vi.spyOn(console, 'error')
report({ foo: 'bar' }, { client: mockClient })
expect(errorSpy).toHaveBeenCalledOnce
expect(errorSpy).toHaveBeenCalledOnce()
expect(errorSpy.mock.calls[0][0]).toBeInstanceOf(Error)
expect(errorSpy.mock.calls[0][0].message).toBe('Unexpected error format: {"foo":"bar"}')
})
Expand Down
6 changes: 3 additions & 3 deletions packages/build-info/src/node/get-build-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test('should not crash on invalid projects', async (ctx) => {
test.skipIf(platform() === 'win32')('should retrieve the build info for providing a rootDir', async (ctx) => {
const fixture = await createFixture('pnpm-workspace', ctx)
const info = await getBuildInfo({ rootDir: fixture.cwd })
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
expect(info).toMatchSnapshot()
})
Expand All @@ -76,7 +76,7 @@ test.skipIf(platform() === 'win32')(
async (ctx) => {
const fixture = await createFixture('pnpm-workspace', ctx)
const info = await getBuildInfo({ rootDir: fixture.cwd, projectDir: fixture.cwd })
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
expect(info).toMatchSnapshot()
},
Expand All @@ -87,7 +87,7 @@ test.skipIf(platform() === 'win32')(
async (ctx) => {
const fixture = await createFixture('pnpm-workspace', ctx)
const info = await getBuildInfo({ rootDir: fixture.cwd, projectDir: join(fixture.cwd, 'packages/blog') })
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

info.jsWorkspaces!.rootDir = '/cleaned-for-snapshot'
expect(info).toMatchSnapshot()
},
Expand Down
5 changes: 0 additions & 5 deletions packages/build-info/src/runtime/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Project } from '../project.js'

export interface LangRuntime {
id: string
name: string
}

export abstract class LangRuntime {
id: string
name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function findPackages(
: project.fs.resolve(dir)
try {
content = await project.fs.readDir(startDir, true)
} catch (err) {
} catch {
// noop
}

Expand Down
73 changes: 35 additions & 38 deletions packages/build/src/error/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,44 @@ export type BasicErrorInfo = {
/**
* Error severity groups the errors emitted by build and used to translate to exit code via SEVERITY_MAP
*/
enum ErrorSeverity {
type ErrorSeverity =
/**
* build success
*/
success = 'success',
| 'success'
/**
* not an error, e.g. build cancellation
*/
none = 'none',
| 'none'
/**
* user error
*/
info = 'info',
| 'info'
/**
* community plugin error
*/
warning = 'warning',
| 'warning'
/**
* system error, including core plugin error
*/
error = 'Error',
}
| 'error'

/**
* How the stack trace should appear in the build error logs
*/
enum StackType {
type StackType =
/**
* not printed
*/
none = 'none',
| 'none'
/*
* printed as is
*/
stack = 'stack',
| 'stack'
/**
* 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.
*/
message = 'message',
}
| 'message'

type GroupFunction = ({ location }: { location: ErrorLocation }) => string
export type TitleFunction = ({ location }: { location: ErrorLocation }) => string
Expand Down Expand Up @@ -274,42 +272,41 @@ export interface ErrorType {
/**
* error severity (also used by Bugsnag)
*/
severity: keyof typeof ErrorSeverity
severity: ErrorSeverity
/**
* how the stack trace should appear in build error logs
*/
stackType: keyof typeof StackType
stackType: StackType
}

const ErrorTypeMap = {
type ErrorTypeMap =
/**
* Plugin called `utils.build.cancelBuild()`
*/
cancelBuild: 'cancelBuild',
resolveConfig: 'resolveConfig',
dependencies: 'dependencies',
pluginInput: 'pluginInput',
pluginUnsupportedVersion: 'pluginUnsupportedVersion',
buildCommand: 'buildCommand',
functionsBundling: 'functionsBundling',
secretScanningFoundSecrets: 'secretScanningFoundSecrets',
failPlugin: 'failPlugin',
failBuild: 'failBuild',
pluginValidation: 'pluginValidation',
pluginInternal: 'pluginInternal',
ipc: 'ipc',
corePlugin: 'corePlugin',
trustedPlugin: 'trustedPlugin',
coreStep: 'coreStep',
api: 'api',
deploy: 'deploy',
deployInternal: 'deployInternal',
exception: 'exception',
telemetry: 'telemetry',
} as const
| 'cancelBuild'
| 'resolveConfig'
| 'dependencies'
| 'pluginInput'
| 'pluginUnsupportedVersion'
| 'buildCommand'
| 'functionsBundling'
| 'secretScanningFoundSecrets'
| 'failPlugin'
| 'failBuild'
| 'pluginValidation'
| 'pluginInternal'
| 'ipc'
| 'corePlugin'
| 'trustedPlugin'
| 'coreStep'
| 'api'
| 'deploy'
| 'deployInternal'
| 'exception'
| 'telemetry'

/* Error classes for build executions */
export type ErrorTypes = keyof typeof ErrorTypeMap
export type ErrorTypes = ErrorTypeMap

/**
* List of error types, and their related properties
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/plugins/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const getSpawnInfo = (): {
}
} => {
// we know that this package.json has a name as it's ours
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

const packageName = ROOT_PACKAGE_JSON.name!
return {
plugin: { packageName, pluginPackageJson: ROOT_PACKAGE_JSON },
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/plugins_core/pre_dev_cleanup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const dirExists = async (path: string): Promise<boolean> => {
try {
await stat(path)
return true
} catch (error) {
} catch {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/utils/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const resolvePath = async function (path, basedir) {
// Fallback.
// `resolve` sometimes gives unhelpful error messages.
// https://github.com/browserify/resolve/issues/223
} catch (e) {
} catch {
return require.resolve(path, { paths: [basedir] })
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/api/site_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const getIntegrations = async function ({
const response = await fetch(url)
const integrations = await response.json()
return Array.isArray(integrations) ? integrations : []
} catch (error) {
} catch {
return []
}
}
4 changes: 3 additions & 1 deletion packages/js-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ type APIOptions = {
* const sites = await client.listSites()
* ```
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- NetlifyAPI is a class and the interface just inherits mapped types
// NetlifyAPI is a class and the interface just inherits mapped types
// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-unsafe-declaration-merging
export interface NetlifyAPI extends DynamicMethods {}

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

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sdk-setup/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ test('Tracing - trace id and resource definition', async () => {
const tracer = trace.getTracer('test')
const span = tracer.startSpan('test', {}, ctx) as Span

expect(span.spanContext().traceId).not.empty
expect(span.spanContext().traceId).toBeDefined()
expect(span.parentSpanId).toBeUndefined()
})

Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-utils/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('addErrorToActiveSpan - no attributes are added', async () => {

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

const firstEvent = span.events[0]
expect(firstEvent.name).equal('exception')
expect(firstEvent.attributes?.['exception.stacktrace']).to.exist
expect(firstEvent.attributes?.['exception.stacktrace']).toBeDefined()
expect(firstEvent.attributes?.['exception.type']).equal('Error')
})
})
Expand Down
5 changes: 3 additions & 2 deletions packages/zip-it-and-ship-it/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ interface CustomMatchers {
}

declare module 'vitest' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Assertion extends CustomMatchers {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface AsymmetricMatchersContaining extends CustomMatchers {}
}

Expand Down
Loading