This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Update eslint plugins #4
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7111ff6
Adding new eslint-index package :package:
ismail-syed 4e5de59
Update package versions :package:
ismail-syed bc30696
Add new rules for eslint-plugin-react
ismail-syed 4cc649b
Add new rules for eslint-plugin-promise
ismail-syed 6e26878
Fix eslint-index package version
ismail-syed 5fbefbc
Remove eslint-find-rules package and script
ismail-syed 70af7aa
Update eslint-plugin-promise rules
ismail-syed 8daa0d0
Enable ignorePureComponents flag for react/prefer-stateless-function …
ismail-syed 40de604
Update eslint-plugin-lodash package to 2.3.x and add new rule
ismail-syed 3b6f088
Updated rules
ismail-syed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,13 +1,33 @@ | ||
// see https://github.com/xjamundx/eslint-plugin-promise | ||
|
||
module.exports = { | ||
// Promise Rules | ||
|
||
'promise/always-catch': 'off', | ||
// Ensure that each time a then() is applied to a promise, a catch() is applied as well. Exceptions are made if you are returning that promise. | ||
'promise/catch-or-return': 'warn', | ||
// Avoid wrapping values in Promise.resolve or Promise.reject when not needed | ||
'promise/no-return-wrap': 'error', | ||
// Ensure that inside a then() you make sure to return a new promise or value. | ||
'promise/always-return': 'error', | ||
// Enforce standard parameter names for Promise constructors. | ||
'promise/param-names': 'warn', | ||
// Ensure that Promise is included fresh in each file instead of relying on the existence of a native promise implementation. | ||
'promise/no-native': 'off', | ||
// Avoid nested .then() or .catch() statements | ||
'promise/no-nesting': 'warn', | ||
// Avoid using promises inside of callbacks | ||
'promise/no-promise-in-callback': 'off', | ||
// Avoid calling cb() inside of a then() (use nodeify instead) | ||
'promise/no-callback-in-promise': 'off', | ||
// Avoid creating new promises outside of utility libs (use pify instead) | ||
'promise/avoid-new': 'off', | ||
|
||
|
||
// Async/Await Rules | ||
|
||
// Prefer await to then() for reading Promise values | ||
'promise/prefer-await-to-then': 'off', | ||
// Prefer async/await to the callback pattern | ||
'promise/prefer-await-to-callbacks': 'off', | ||
}; |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using the babel compiler for this or something else? Their implementation is not what I'd call light weight.
ex:
transforms to:
source
It also creates a blocking loop with the
while(1)
which is kinda scary. It does look like there's a defined exit condition, but it's hard to say from the generated code how many iterations it'll block on.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😳 That does look quite scary.
@GoodForOneFare: Should we keep this as a 'warn', or even have it turned 'off'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the blocking behaviour, is it even advantageous to encourage the use of await? I feel like it produce a specific behaviour that may be desirable only in specific circumstances (where blocking IO is required)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i have strong feels about preferring await with its current browser support. I'd like to hear some of the justification behind this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ismail-syed is just getting started on FED, so these are just his best guesses. Agree that this should be
off
until browser support is better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, agreed to turn these two off 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I think it's too early for
async
await
at this point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks everyone.
The two await rules are
off
now.70af7aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not using async also would help with removing
regeneratorRuntime
. Are y'all using babel-polyfill as well?Alternatives: you can try https://github.com/babel/kneden although needs work since it's not stable yet, https://github.com/MatAtBread/fast-async, or use http://babeljs.io/docs/plugins/transform-async-to-generator if you support browsers that have generators natively. Would recommend https://github.com/babel/babel-preset-env/ for that as well.
Sorry for the random comment haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hzoo All of our projects support at least IE11, so we're still stuck without native generators, and I'd rather way for async-await until we can do so based on native generators, rather than any kind of runtime. We're excited to start using
babel-preset-env
(Shopify/babel-preset-shopify#4), though. Thanks very much for all your hard work on the Babel project!