-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): throw typed errors (#33005)
### Reason for this change In #32548 we enabled typed errors for some places in the CLI. However many places were missed and the eslint rule wasn't enabled to enforce it in future. ### Description of changes Enforce by enabling the respective eslint rule. Also adds and implements the eslint rule in the toolkit. This has little functional effect since all new errors are still `Error`s. The printed output of an error will slightly change. ### Describe any new or updated permissions being added n/a ### Description of how you validated changes existing tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
43 changed files
with
218 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); | ||
baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; | ||
|
||
// custom rules | ||
baseConfig.rules['@cdklabs/no-throw-default-error'] = ['error']; | ||
baseConfig.overrides.push({ | ||
files: ["./test/**"], | ||
rules: { | ||
"@cdklabs/no-throw-default-error": "off", | ||
}, | ||
}); | ||
|
||
module.exports = baseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); | ||
baseConfig.ignorePatterns.push('lib/init-templates/**/typescript/**/*.ts'); | ||
baseConfig.ignorePatterns.push('test/integ/cli/sam_cdk_integ_app/**/*.ts'); | ||
baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; | ||
const baseConfig = require("@aws-cdk/cdk-build-tools/config/eslintrc"); | ||
baseConfig.ignorePatterns.push("lib/init-templates/**/typescript/**/*.ts"); | ||
baseConfig.ignorePatterns.push("test/integ/cli/sam_cdk_integ_app/**/*.ts"); | ||
baseConfig.parserOptions.project = __dirname + "/tsconfig.json"; | ||
|
||
// custom rules | ||
baseConfig.rules["@cdklabs/no-throw-default-error"] = ["error"]; | ||
baseConfig.overrides.push({ | ||
files: ["./test/**"], | ||
rules: { | ||
"@cdklabs/no-throw-default-error": "off", | ||
}, | ||
}); | ||
|
||
module.exports = baseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.