This repository has been archived by the owner on Feb 21, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from FloEdelmann/eslint-5.5.0
Update eslint to version 5.7.0
- Loading branch information
Showing
12 changed files
with
209 additions
and
54 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/resources/docs/description/max-classes-per-file.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This rule enforces that each file may contain only a particular number | ||
of classes and no more. | ||
|
||
``` | ||
//Bad (with parameter 1): | ||
class Foo {} | ||
class Bar {} | ||
//Good (with parameter 1): | ||
class Foo {} | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/max-classes-per-file) |
3 changes: 3 additions & 0 deletions
3
src/main/resources/docs/description/max-lines-per-function.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This rule enforces a maximum number of lines per function, in order to aid in maintainability and reduce complexity. | ||
|
||
[Source](http://eslint.org/docs/rules/max-lines-per-function) |
31 changes: 31 additions & 0 deletions
31
src/main/resources/docs/description/no-async-promise-executor.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This rule aims to disallow async Promise executor functions. | ||
|
||
``` | ||
//Bad: | ||
const result = new Promise(async (resolve, reject) => { | ||
readFile('foo.txt', function(err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
}); | ||
}); | ||
const result = new Promise(async (resolve, reject) => { | ||
resolve(await foo); | ||
}); | ||
//Good: | ||
const result = new Promise((resolve, reject) => { | ||
readFile('foo.txt', function(err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
}); | ||
}); | ||
const result = Promise.resolve(foo); | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/no-async-promise-executor) |
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
src/main/resources/docs/description/no-misleading-character-class.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This rule reports the regular expressions which include multiple code point characters in character class syntax. | ||
|
||
``` | ||
//Bad: | ||
/^[Á]$/u | ||
/^[❇️]$/u | ||
/^[👶🏻]$/u | ||
/^[🇯🇵]$/u | ||
/^[👨👩👦]$/u | ||
/^[👍]$/ | ||
//Good: | ||
/^[abc]$/ | ||
/^[👍]$/u | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/no-misleading-character-class) |
24 changes: 24 additions & 0 deletions
24
src/main/resources/docs/description/prefer-object-spread.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Prefer use of an object spread over `Object.assign`. | ||
|
||
``` | ||
//Bad: | ||
Object.assign({}, foo) | ||
Object.assign({}, {foo: 'bar'}) | ||
Object.assign({ foo: 'bar'}, baz) | ||
Object.assign({ foo: 'bar' }, Object.assign({ bar: 'foo' })) | ||
Object.assign({}, { foo, bar, baz }) | ||
Object.assign({}, { ...baz }) | ||
// Object.assign with a single argument that is an object literal | ||
Object.assign({}); | ||
Object.assign({ foo: bar }); | ||
//Good: | ||
Object.assign(...foo); | ||
// Any Object.assign call without an object literal as the first argument | ||
Object.assign(foo, { bar: baz }); | ||
Object.assign(foo, Object.assign(bar)); | ||
Object.assign(foo, { bar, baz }) | ||
Object.assign(foo, { ...baz }); | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/prefer-object-spread) |
39 changes: 39 additions & 0 deletions
39
src/main/resources/docs/description/require-atomic-updates.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
This rule aims to report assignments to variables or properties where all of the following are true: | ||
|
||
* A variable or property is reassigned to a new value which is based on its old value. | ||
* A `yield` or `await` expression interrupts the assignment after the old value is read, and before the new value is set. | ||
* The rule cannot easily verify that the assignment is safe (e.g. if an assigned variable is local and would not be readable from anywhere else while the function is paused). | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
``` | ||
//Bad: | ||
let result; | ||
async function foo() { | ||
result += await somethingElse; | ||
result = result + await somethingElse; | ||
result = result + doSomething(await somethingElse); | ||
} | ||
function* bar() { | ||
result += yield; | ||
result = result + (yield somethingElse); | ||
result = result + doSomething(yield somethingElse); | ||
} | ||
//Good: | ||
let result; | ||
async function foo() { | ||
result = await somethingElse + result; | ||
let tmp = await somethingElse; | ||
result += tmp; | ||
let localVariable = 0; | ||
localVariable += await somethingElse; | ||
} | ||
function* bar() { | ||
result += yield; | ||
result = (yield somethingElse) + result; | ||
result = doSomething(yield somethingElse, result); | ||
} | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/require-atomic-updates) |
17 changes: 17 additions & 0 deletions
17
src/main/resources/docs/description/require-unicode-regexp.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This rule aims to enforce the use of `u` flag on regular expressions. | ||
|
||
``` | ||
//Bad: | ||
const a = /aaa/ | ||
const b = /bbb/gi | ||
const c = new RegExp("ccc") | ||
const d = new RegExp("ddd", "gi") | ||
//Good: | ||
const a = /aaa/u | ||
const b = /bbb/giu | ||
const c = new RegExp("ccc", "u") | ||
const d = new RegExp("ddd", "giu") | ||
``` | ||
|
||
[Source](http://eslint.org/docs/rules/require-unicode-regexp) |
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 was deleted.
Oops, something went wrong.
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