Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 8325ddb

Browse files
Bump ESLint dependency to 7.19.0
1 parent d10f4cc commit 8325ddb

File tree

5 files changed

+998
-987
lines changed

5 files changed

+998
-987
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
"prepack": "yarn build"
2525
},
2626
"peerDependencies": {
27-
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
27+
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
2828
},
2929
"devDependencies": {
30-
"@types/eslint": "6.1.3",
31-
"@types/estree": "0.0.39",
30+
"@types/eslint": "7.2.6",
31+
"@types/estree": "0.0.46",
3232
"@types/jest": "22.2.2",
3333
"@types/lodash": "4.14.106",
3434
"@types/minimist": "1.2.0",
3535
"@types/node": "12.12.6",
3636
"@typescript-eslint/experimental-utils": "2.6.1",
3737
"@typescript-eslint/parser": "2.6.1",
3838
"babel-eslint": "8.2.2",
39-
"eslint": "6.6.0",
39+
"eslint": "7.19.0",
4040
"eslint-config-prettier": "2.9.0",
4141
"eslint-plugin-import": "2.18.2",
4242
"eslint-plugin-notice": "0.6.7",

ruling/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!**/node_modules/**

ruling/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function run() {
5757
rules: getEslintRules(rules),
5858
useEslintrc: false,
5959
allowInlineConfig: false,
60+
ignorePath: path.join(__dirname, ".eslintignore"),
6061
});
6162

6263
const sourcesPath = path.join(__dirname, "javascript-test-sources/src");

tests/rules/prefer-immediate-return.test.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ ruleTester.run("prefer-immediate-return", rule, {
186186
}
187187
`,
188188
errors: [{ line: 3, column: 19, endColumn: 21 }],
189+
output: `
190+
function let_returned() {
191+
return 42;
192+
}
193+
`,
189194
},
190195
{
191196
code: `
@@ -195,6 +200,11 @@ ruleTester.run("prefer-immediate-return", rule, {
195200
}
196201
`,
197202
errors: [{ line: 3, column: 21, endColumn: 23 }],
203+
output: `
204+
function const_returned() {
205+
return 42;
206+
}
207+
`,
198208
},
199209
{
200210
code: `
@@ -205,6 +215,12 @@ ruleTester.run("prefer-immediate-return", rule, {
205215
}
206216
`,
207217
errors: [{ line: 4, column: 19, endColumn: 21 }],
218+
output: `
219+
function code_before_declaration() {
220+
foo();
221+
return 42;
222+
}
223+
`,
208224
},
209225
{
210226
code: `
@@ -244,6 +260,21 @@ ruleTester.run("prefer-immediate-return", rule, {
244260
{ line: 12, column: 21, endColumn: 26 },
245261
{ line: 15, column: 21, endColumn: 26 },
246262
],
263+
output: `
264+
function different_blocks() {
265+
if (foo) {
266+
return foo();
267+
}
268+
269+
try {
270+
return foo();
271+
} catch (e) {
272+
return foo();
273+
} finally {
274+
return foo();
275+
}
276+
}
277+
`,
247278
},
248279
{
249280
code: `
@@ -258,6 +289,16 @@ ruleTester.run("prefer-immediate-return", rule, {
258289
}
259290
`,
260291
errors: [{ line: 4, column: 21, endColumn: 26 }],
292+
output: `
293+
function two_declarations(a) {
294+
if (a) {
295+
return foo();
296+
} else {
297+
let x = bar();
298+
return x + 42;
299+
}
300+
}
301+
`,
261302
},
262303
{
263304
code: `
@@ -275,6 +316,19 @@ ruleTester.run("prefer-immediate-return", rule, {
275316
}
276317
`,
277318
errors: [{ line: 3, column: 23, endLine: 11, endColumn: 12 }],
319+
output: `
320+
function homonymous_is_used() {
321+
return {
322+
doSomethingElse(p) {
323+
var bar = 2;
324+
return p + bar;
325+
},
326+
doSomething() {
327+
return this.doSomethingElse(1);
328+
},
329+
};
330+
}
331+
`,
278332
},
279333
{
280334
code: `
@@ -290,6 +344,16 @@ ruleTester.run("prefer-immediate-return", rule, {
290344
}
291345
`,
292346
errors: [{ line: 5, column: 25, endColumn: 26 }, { line: 8, column: 25, endColumn: 26 }],
347+
output: `
348+
function inside_switch(x) {
349+
switch (x) {
350+
case 1:
351+
return 3;
352+
default:
353+
return 2;
354+
}
355+
}
356+
`,
293357
},
294358
{
295359
code: `
@@ -318,6 +382,13 @@ ruleTester.run("prefer-immediate-return", rule, {
318382
message: 'Immediately return this expression instead of assigning it to the temporary variable "x".',
319383
},
320384
],
385+
output: `
386+
function foo() {
387+
if (cond) {
388+
return 42;
389+
}
390+
}
391+
`,
321392
},
322393
],
323394
});

0 commit comments

Comments
 (0)