Metadata
- Source
- FLUID-6419
- Type
- Bug
- Priority
- Major
- Status
- Closed
- Resolution
- Cannot Reproduce
- Assignee
- Colin Clark
- Reporter
- Gregor Moss
- Created
2019-10-30T13:43:02.694-0400 - Updated
2024-07-25T12:28:36.813-0400 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- fluid-eslint-config
Description
I attempted to use the .catch() and .finally() functions associated with the Promise object, but the linter fails with the following feedback:
"error .catch is a syntax error dot-notation"
The source of the issue to this particular setting in the eslint config file: https://github.com/fluid-project/eslint-config-fluid/blob/041cd0f476fc02d0293914962c14912750e753f5/.eslintrc.json#L26
The particular setting of the allowKeywords flag should be considered/reconsidered with .catch and .finally in mind.
The code that fails the linter looks like the following
somePromise.catch(function () {
// do some error handling
}).finally(function () {
// do some final things
});
Whereas this is somewhat kludgy but passes linting
somePromise["catch"](function () {
// do some error handling
})["finally"](function () {
// do some final things
});
cc @@Tony Atkins [RtF] and @@Antranig Basman
Environments
Windows 10 1903
Node v10.15.3
eslint-config-fluid 1.1.0
Comments
-
Justin Obara commented
2019-10-31T08:07:18.076-0400 It appears that setting
allowKeywords
to false is to follow ECMAScript version 3 style of avoiding dot notation for reserved words. (see: https://eslint.org/docs/rules/dot-notation#require-dot-notation-dot-notation ) As of ECMAScript 5.1 reserved words only apply to identifiers and not identifierNames.See:
-
Justin Obara commented
2024-07-25T12:28:36.813-0400 I’m not able to reproduce this issue and I’m not noticing configuration for
dot-notation
anymore: https://github.com/fluid-project/eslint-config-fluid/blob/51e2cb087c68f1dc43e2b23fcb308e4a68ea0644/.eslintrc-fluid.json