fix(all): disallow throwing literals (@typescript-eslint/no-throw-literal
)
#3086
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Better linting
This PR adds the
@typescript-eslint/no-throw-literal
ESLint rule, which removes the ability to throw non-Error
errors.Slight changes to tsconfig generation
In Forge, we generate each
tsconfig.json
per-package in a postinstall script. This means there is no globaltsconfig.json
for the project (aside from atsconfig.test.json
that we use for tests.)However, since the
@typescript-eslint/no-throw-literal
rule requires a config to be specified inparserOptions.project
, I moved the base TSConfig JavaScript object that we use to generate each package's TSConfig into its owntsconfig.base.json
file in the project's root folder.No more
[object Object]
errorsRef #3084
We used to throw a non-standard error object in the core Make API, which ended up logging a
[object Object]
error in the CLI. This is fixed by following the new lint rule.Testing
You can test this case easily on macOS by attempting to build the Squirrel.Windows without
mono
installed. As you can see, this PR adds a lot more clarity to the exact error message.Before:
After: