Skip to content

Change all .then to await#814

Merged
sindresorhus merged 1 commit into
masterfrom
and-then
Nov 15, 2017
Merged

Change all .then to await#814
sindresorhus merged 1 commit into
masterfrom
and-then

Conversation

@fregante
Copy link
Copy Markdown
Member

As requested in #800 (comment)

All were changed except:

src/libs/synchronous-storage.js:
   28  		this._get = get;
   29  		this._set = set;
   30: 		return get().then(value => {
   31  			this._cache = value;
   32  			return this;

-> because It's inside a constructor.

src/libs/utils.js:
   30  
   31  	// Don't check ad-infinitum
   32: 	domLoaded.then(() => requestAnimationFrame(() => waiting.cancel()));
   33  
   34  	// If cancelled, return null like a regular select() would

-> because it's not meant to be awaited.

@fregante
Copy link
Copy Markdown
Member Author

fregante commented Mar 15, 2018

@sindresorhus
Copy link
Copy Markdown
Member

github/eslint-plugin-github:docs/rules/no-then.md@master

If we add "engine": { "node": ">=8" } to our package.json, it will automatically be enforced: https://github.com/xojs/xo/blob/f67ff58c7cafcc7e5ebacbd311532c6886f1063a/lib/options-manager.js#L69-L71

@sindresorhus
Copy link
Copy Markdown
Member

And this one is useful as well: github/eslint-plugin-github:docs/rules/array-foreach.md@master

It's too naive and doesn't have a fixer. See: sindresorhus/eslint-plugin-unicorn#49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants