diff --git a/.changeset/happy-adults-think.md b/.changeset/happy-adults-think.md new file mode 100644 index 0000000000..2283459512 --- /dev/null +++ b/.changeset/happy-adults-think.md @@ -0,0 +1,6 @@ +--- +'@aws-amplify/schema-generator': patch +'@aws-amplify/model-generator': patch +--- + +activated no-amplify-errors, ignored lines with valid violations diff --git a/packages/eslint-rules/src/index.ts b/packages/eslint-rules/src/index.ts index 202c961837..c4dea55a36 100644 --- a/packages/eslint-rules/src/index.ts +++ b/packages/eslint-rules/src/index.ts @@ -28,7 +28,15 @@ export const configs = { }, }, { - files: ['packages/auth-construct/src/**'], + files: [ + 'packages/auth-construct/src/**', + 'packages/ai-constructs/src/**', + 'packages/backend-output-storage/src/**', + 'packages/deployed-backend-client/src/**', + 'packages/form-generator/src/**', + 'packages/model-generator/src/**', + 'packages/schema-generator/src/**', + ], rules: { 'amplify-backend-rules/no-amplify-errors': 'error', }, diff --git a/packages/model-generator/src/get_backend_output_with_error_handling.ts b/packages/model-generator/src/get_backend_output_with_error_handling.ts index 98fb6ffc70..1c5e9feb84 100644 --- a/packages/model-generator/src/get_backend_output_with_error_handling.ts +++ b/packages/model-generator/src/get_backend_output_with_error_handling.ts @@ -20,6 +20,7 @@ export const getBackendOutputWithErrorHandling = async ( error instanceof BackendOutputClientError && error.code === BackendOutputClientErrorType.DEPLOYMENT_IN_PROGRESS ) { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'DeploymentInProgressError', { @@ -33,6 +34,7 @@ export const getBackendOutputWithErrorHandling = async ( error instanceof BackendOutputClientError && error.code === BackendOutputClientErrorType.NO_STACK_FOUND ) { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'StackDoesNotExistError', { @@ -47,6 +49,7 @@ export const getBackendOutputWithErrorHandling = async ( error instanceof BackendOutputClientError && error.code === BackendOutputClientErrorType.CREDENTIALS_ERROR ) { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'CredentialsError', { @@ -61,6 +64,7 @@ export const getBackendOutputWithErrorHandling = async ( error instanceof BackendOutputClientError && error.code === BackendOutputClientErrorType.ACCESS_DENIED ) { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'AccessDeniedError', { diff --git a/packages/schema-generator/src/generate_schema.ts b/packages/schema-generator/src/generate_schema.ts index 666fa823bf..bfe5e28ea8 100644 --- a/packages/schema-generator/src/generate_schema.ts +++ b/packages/schema-generator/src/generate_schema.ts @@ -39,6 +39,7 @@ export class SchemaGenerator { } catch (err) { const databaseError = err as DatabaseConnectError; if (databaseError.code === 'ETIMEDOUT') { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'DatabaseConnectionError', { @@ -117,6 +118,7 @@ export const parseDatabaseUrl = (databaseUrl: string): SQLDataSourceConfig => { ).filter((part) => !config[part]); if (missingParts.length > 0) { + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'DatabaseUrlParseError', { @@ -132,6 +134,7 @@ export const parseDatabaseUrl = (databaseUrl: string): SQLDataSourceConfig => { return config; } catch (err) { const error = err as Error; + // eslint-disable-next-line amplify-backend-rules/no-amplify-errors throw new AmplifyUserError( 'DatabaseUrlParseError', {