Incompatibility with ESLint's "no-throw-literal" rule
See original GitHub issueHi,
Async validation example ( http://redux-form.com/6.4.3/examples/asyncValidation/ ) advises to throw an object on error, however eslint’s “no-throw-literal” (ex. part of AirBnb’s eslint rules) will return an error in this case, expecting an Error object only. However, when trying to throw an Error obj. from the async validator, the validator fails (uncaught exception).
For now, as a workaround I have to use
/* eslint no-throw-literal: "off" */
throw { email: 'Unknown error :(' };
Please advise if it is possible to throw an Error? If not, please consider this to be a feature request.
Thanks D
P.S. Sorry for several words “error” on every line ;-P
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
no-throw-literal - ESLint - Pluggable JavaScript Linter
This rule is aimed at maintaining consistency when throwing exception by disallowing to throw literals and other expressions which cannot possibly be an...
Read more >no-throw-literal | typescript-eslint
This rule is aimed at maintaining consistency when throwing exception by disallowing to throw literals and other expressions which cannot possibly be an...
Read more >Proposal: no-reject-literal rule · Issue #7685 · eslint ... - GitHub
Basically, I think reporting object and array expressions is probably more correct, but it would be inconsistent with no-throw-literal . Since ...
Read more >How to only disable 'no-throw-literal' webpack warnings?
For the moment, I'd like to disable all 'no-throw-literal' warnings globally. How can I do this (without typing // eslint-disable-next-line ...
Read more >Changelog - JavaScript Standard Style
This pre-release exists to test out the ESLint 8 related changes and discover possible backwards incompatible changes that comes with it and mitigate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could do this instead:
It’s not a good workaround. let’s create asyncValidatorError class? or it should accept SubmissionError class.