-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix throwing non-new Errors and literals (#1338)
* Add linting to enforce `new Error()` * Fix throwing non-new Errors and literals
- Loading branch information
Showing
10 changed files
with
1,308 additions
and
326 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# Opt-ins | ||
!GOVERNANCE.md | ||
!eslint.config.js | ||
|
||
!/features/*.yml | ||
/features/*.yml.dist | ||
|
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import newWithError from "eslint-plugin-new-with-error"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default tseslint.config(tseslint.configs.base, { | ||
plugins: { newWithError }, | ||
rules: { | ||
"no-throw-literal": "error", | ||
"newWithError/new-with-error": "error", | ||
}, | ||
files: ["**/*.ts"], | ||
}); | ||
|
||
// TODO: do linting more comprehensively, something like: | ||
// import eslint from "@eslint/js"; | ||
// export default tseslint.config( | ||
// eslint.configs.recommendedTypeChecked, | ||
// ...tseslint.configs.recommended, | ||
// { | ||
// plugins: { newWithError }, | ||
// rules: { | ||
// "no-throw-literal": "error", | ||
// "newWithError/new-with-error": "error", | ||
// }, | ||
// ); |
Oops, something went wrong.