This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autogenerated new docs and demo at Fri Dec 09 2016 11:56:38
- Loading branch information
ESLint Jenkins
committed
Dec 9, 2016
1 parent
fef7006
commit 0ce3dc1
Showing
15 changed files
with
946 additions
and
340 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
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,84 @@ | ||
--- | ||
layout: post | ||
title: ESLint v3.12.0 released | ||
tags: | ||
- release | ||
- minor | ||
--- | ||
# ESLint v3.12.0 released | ||
|
||
We just pushed ESLint v3.12.0, which is a minor release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. | ||
|
||
|
||
|
||
|
||
|
||
|
||
## Features | ||
|
||
|
||
* [1d0d61d](https://github.com/eslint/eslint/commit/1d0d61d) New: Add [no-await-in-loop](/docs/rules/no-await-in-loop) rule ([#7563](https://github.com/eslint/eslint/issues/7563)) (Nat Mote) | ||
* [2cdfb4e](https://github.com/eslint/eslint/commit/2cdfb4e) New: Additional APIs (fixes [#6256](https://github.com/eslint/eslint/issues/6256)) ([#7669](https://github.com/eslint/eslint/issues/7669)) (Ilya Volodin) | ||
|
||
|
||
|
||
|
||
## Enhancements | ||
|
||
|
||
* [e569225](https://github.com/eslint/eslint/commit/e569225) Update: fix false positive/negative of [yoda](/docs/rules/yoda) rule (fixes [#7676](https://github.com/eslint/eslint/issues/7676)) ([#7695](https://github.com/eslint/eslint/issues/7695)) (Toru Nagashima) | ||
* [4278c42](https://github.com/eslint/eslint/commit/4278c42) Update: make [no-obj-calls](/docs/rules/no-obj-calls) report errors for Reflect (fixes [#7700](https://github.com/eslint/eslint/issues/7700)) ([#7710](https://github.com/eslint/eslint/issues/7710)) (Tomas Echeverri Valencia) | ||
* [b921d1f](https://github.com/eslint/eslint/commit/b921d1f) Update: add [`indent`](/docs/rules/`indent`) options for array and object literals (fixes [#7473](https://github.com/eslint/eslint/issues/7473)) ([#7681](https://github.com/eslint/eslint/issues/7681)) (Teddy Katz) | ||
* [7079c89](https://github.com/eslint/eslint/commit/7079c89) Update: Add airbnb-base to init styleguides (fixes [#6986](https://github.com/eslint/eslint/issues/6986)) ([#7699](https://github.com/eslint/eslint/issues/7699)) (alberto) | ||
* [f8786fb](https://github.com/eslint/eslint/commit/f8786fb) Update: add fixer for [`capitalized-comments`](/docs/rules/`capitalized-comments`) ([#7701](https://github.com/eslint/eslint/issues/7701)) (Teddy Katz) | ||
|
||
|
||
|
||
|
||
## Bug Fixes | ||
|
||
|
||
* [e95a230](https://github.com/eslint/eslint/commit/e95a230) Fix: [indent](/docs/rules/indent) "first" option false positive on nested arrays (fixes [#7727](https://github.com/eslint/eslint/issues/7727)) ([#7728](https://github.com/eslint/eslint/issues/7728)) (Teddy Katz) | ||
* [81f9e7d](https://github.com/eslint/eslint/commit/81f9e7d) Fix: Allow duplicated let declarations in [`prefer-const`](/docs/rules/`prefer-const`) (fixes [#7712](https://github.com/eslint/eslint/issues/7712)) ([#7717](https://github.com/eslint/eslint/issues/7717)) (Teddy Katz) | ||
* [abfd24f](https://github.com/eslint/eslint/commit/abfd24f) Fix: don't validate schemas for disabled rules (fixes [#7690](https://github.com/eslint/eslint/issues/7690)) ([#7692](https://github.com/eslint/eslint/issues/7692)) (Teddy Katz) | ||
* [0a2a7fd](https://github.com/eslint/eslint/commit/0a2a7fd) Fix: Allow \u2028 and \u2029 as string escapes in [no-useless-escape](/docs/rules/no-useless-escape) ([#7672](https://github.com/eslint/eslint/issues/7672)) (Teddy Katz) | ||
|
||
|
||
|
||
|
||
## Documentation | ||
|
||
|
||
* [4742d82](https://github.com/eslint/eslint/commit/4742d82) Docs: clarify the default behavior of [`operator-linebreak`](/docs/rules/`operator-linebreak`) (fixes [#7459](https://github.com/eslint/eslint/issues/7459)) ([#7726](https://github.com/eslint/eslint/issues/7726)) (Teddy Katz) | ||
* [63bb3f8](https://github.com/eslint/eslint/commit/63bb3f8) Docs: improve the documentation for the autofix API ([#7716](https://github.com/eslint/eslint/issues/7716)) (Teddy Katz) | ||
* [90a5d29](https://github.com/eslint/eslint/commit/90a5d29) Docs: Remove incorrect info about issue requirements from PR guide ([#7691](https://github.com/eslint/eslint/issues/7691)) (Teddy Katz) | ||
* [f80c278](https://github.com/eslint/eslint/commit/f80c278) Docs: Add sails-hook-lint to integrations list ([#7679](https://github.com/eslint/eslint/issues/7679)) (Anthony M) | ||
* [e96da3f](https://github.com/eslint/eslint/commit/e96da3f) Docs: link first instance of `package.json` ([#7684](https://github.com/eslint/eslint/issues/7684)) (Kent C. Dodds) | ||
* [b30116c](https://github.com/eslint/eslint/commit/b30116c) Docs: Fix code-blocks in [spaced-comment](/docs/rules/spaced-comment) docs ([#7524](https://github.com/eslint/eslint/issues/7524)) (Michał Gołębiowski) | ||
* [76c33a9](https://github.com/eslint/eslint/commit/76c33a9) Docs: Change Sails.js integration to active npm package ([#7675](https://github.com/eslint/eslint/issues/7675)) (Anthony M) | ||
|
||
|
||
|
||
|
||
## Dependency Upgrades | ||
|
||
|
||
* [2ac07d8](https://github.com/eslint/eslint/commit/2ac07d8) Upgrade: Update globals dependency to 9.14.0 ([#7683](https://github.com/eslint/eslint/issues/7683)) (Aleksandr Oleynikov) | ||
|
||
|
||
|
||
|
||
## Build Related | ||
|
||
|
||
* [bf20e20](https://github.com/eslint/eslint/commit/bf20e20) Build: include links to rule pages in release blogpost ([#7671](https://github.com/eslint/eslint/issues/7671)) (Teddy Katz) | ||
|
||
|
||
|
||
|
||
## Chores | ||
|
||
|
||
* [a8489e2](https://github.com/eslint/eslint/commit/a8489e2) Chore: Avoid parserOptions boilerplate in tests for ES6 rules ([#7724](https://github.com/eslint/eslint/issues/7724)) (Teddy Katz) | ||
|
||
|
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
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
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,89 @@ | ||
--- | ||
title: no-await-in-loop - Rules | ||
layout: doc | ||
--- | ||
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. --> | ||
|
||
# Disallow `await` inside of loops (no-await-in-loop) | ||
|
||
Performing an operation on each element of an iterable is a common task. However, performing an | ||
`await` as part of each operation is an indication that the program is not taking full advantage of | ||
the parallelization benefits of `async`/`await`. | ||
|
||
Usually, the code should be refactored to create all the promises at once, then get access to the | ||
results using `Promise.all()`. Otherwise, each successive operation will not start until the | ||
previous one has completed. | ||
|
||
Concretely, the following function should be refactored as shown: | ||
|
||
```js | ||
async function foo(things) { | ||
const results = []; | ||
for (const thing of things) { | ||
// Bad: each loop iteration is delayed until the entire asynchronous operation completes | ||
results.push(await bar(thing)); | ||
} | ||
return baz(results); | ||
} | ||
``` | ||
|
||
```js | ||
async function foo(things) { | ||
const results = []; | ||
for (const thing of things) { | ||
// Good: all asynchronous operations are immediately started. | ||
results.push(bar(thing)); | ||
} | ||
// Now that all the asynchronous operations are running, here we wait until they all complete. | ||
return baz(await Promise.all(results)); | ||
} | ||
``` | ||
|
||
## Rule Details | ||
|
||
This rule disallows the use of `await` within loop bodies. | ||
|
||
## Examples | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
async function foo(things) { | ||
const results = []; | ||
for (const thing of things) { | ||
// Good: all asynchronous operations are immediately started. | ||
results.push(bar(thing)); | ||
} | ||
// Now that all the asynchronous operations are running, here we wait until they all complete. | ||
return baz(await Promise.all(results)); | ||
} | ||
``` | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```js | ||
async function foo(things) { | ||
const results = []; | ||
for (const thing of things) { | ||
// Bad: each loop iteration is delayed until the entire asynchronous operation completes | ||
results.push(await bar(thing)); | ||
} | ||
return baz(results); | ||
} | ||
``` | ||
|
||
## When Not To Use It | ||
|
||
In many cases the iterations of a loop are not actually independent of each-other. For example, the | ||
output of one iteration might be used as the input to another. Or, loops may be used to retry | ||
asynchronous operations that were unsuccessful. In such cases it makes sense to use `await` within a | ||
loop and it is recommended to disable the rule via a standard ESLint disable comment. | ||
|
||
## Version | ||
|
||
This rule was introduced in ESLint 3.12.0. | ||
|
||
## Resources | ||
|
||
* [Rule source](https://github.com/eslint/eslint/tree/master/lib/rules/no-await-in-loop.js) | ||
* [Documentation source](https://github.com/eslint/eslint/tree/master/docs/rules/no-await-in-loop.md) |
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.