This repository has been archived by the owner on Feb 21, 2020. It is now read-only.
Update eslint to version 5.7.0 #103
Merged
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d1980e9
Update eslint to version 5.5.0
FloEdelmann 4519436
Remove deprecated no-catch-shadow rule
FloEdelmann 24a0f2f
Add require-atomic-updates rule
FloEdelmann 276b972
Add require-unicode-regexp rule
FloEdelmann 6f92a1f
Add prefer-object-spread
FloEdelmann a955a6e
Add max-classes-per-file rule
FloEdelmann 4dc788b
Add max-lines-per-function rule
FloEdelmann e875ded
Add no-misleading-character-class rule
FloEdelmann 3ee7e36
Add no-async-promise-executor rule
FloEdelmann ff67264
Update eslint to version 5.6.0
FloEdelmann c7e40a4
Fix test for indent rule
FloEdelmann fcfff42
Fix test for no-invalid-regexp rule
FloEdelmann b0888a2
Fix test for valid-jsdoc rule
FloEdelmann d21aab0
Remove test for deprecated no-catch-shadow rule
FloEdelmann 274b539
Update ESLint to version 5.7.0
FloEdelmann 102ded1
Re-enable no-invalid-regexp rule test
FloEdelmann 375359a
Merge branch 'master' into eslint-5.5.0
rtfpessoa File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
RegExp('['); | ||
//#Err: no-invalid-regexp | ||
RegExp('.', 'z'); | ||
//#Err: no-invalid-regexp | ||
new 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
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.
This should still report an error according to eslint website https://eslint.org/docs/rules/no-invalid-regexp
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.
True, it actually should throw an error, but it doesn't. I opened an issue in the eslint repository: eslint/eslint#10861
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.
Is it possible to merge this PR in and then when that fix is in we can make another PR for the minor version update. Because technically this is the way eslint 5.6.0 works right now. When this is fixed itll be a diff version. Unless this PR is meant to cover all eslint rules from 5.6.0 - 5.7.0?
Also, FYI I will be fixing this week eslint/eslint#10861
@rtfpessoa
Thank you
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.
@sstern6 I would prefer to wait a bit more to avoid a regression in the product. It can lead to weird cases.
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.
ok I understand, so then when that fix is merged in codacy will support eslint 5.6.x with the updated fix and will dependent on Eslint next release? How will subsequent releases but handled with eslint. Will a new PR be created in this repo for every minor or major version?
Thanks
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.
Ideally every release we do a new PR here to update the version.
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.
Ok sounds good @rtfpessoa. PR for this issue has been merged in eslint/eslint#10920. Im guessing this will make it into the 5.6.2 release, so we will either need to update this PR to support 5.6.2 and label it asa such. Or merge this in and make another PR for 5.6.2.
Given our previous conversation I assume you would like to update this PR?