Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: upgrade eslint-scope@8.0.0 #17942

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^7.2.2",
"eslint-scope": "^8.0.0",
"eslint-visitor-keys": "^3.4.3",
"espree": "^9.6.1",
"esquery": "^1.4.2",
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/rules/no-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ ruleTester.run("no-eval", rule, {
{ code: "() => { this.eval('foo') }", languageOptions: { ecmaVersion: 6, sourceType: "module" } },
{ code: "function f() { 'use strict'; () => { this.eval('foo') } }", languageOptions: { ecmaVersion: 6 } },
{ code: "(function f() { 'use strict'; () => { this.eval('foo') } })", languageOptions: { ecmaVersion: 6 } },
{ code: "class C extends function () { this.eval('foo'); } {}", languageOptions: { ecmaVersion: 6 } },
{ code: "class A { foo() { this.eval(); } }", languageOptions: { ecmaVersion: 6 } },
{ code: "class A { static foo() { this.eval(); } }", languageOptions: { ecmaVersion: 6 } },
{ code: "class A { field = this.eval(); }", languageOptions: { ecmaVersion: 2022 } },
Expand Down Expand Up @@ -106,6 +107,7 @@ ruleTester.run("no-eval", rule, {
{ code: "var EVAL = eval; EVAL('foo')", errors: [{ messageId: "unexpected", type: "Identifier", column: 12, endColumn: 16 }] },
{ code: "var EVAL = this.eval; EVAL('foo')", errors: [{ messageId: "unexpected", type: "MemberExpression", column: 17, endColumn: 21 }] },
{ code: "'use strict'; var EVAL = this.eval; EVAL('foo')", errors: [{ messageId: "unexpected", type: "MemberExpression", column: 31, endColumn: 35 }] },
{ code: "function foo() { ('use strict'); this.eval; }", errors: [{ messageId: "unexpected", type: "MemberExpression", column: 39, endColumn: 43 }] },
{ code: "() => { this.eval('foo'); }", languageOptions: { ecmaVersion: 6 }, errors: [{ messageId: "unexpected", type: "CallExpression", column: 14, endColumn: 18 }] },
{ code: "() => { 'use strict'; this.eval('foo'); }", languageOptions: { ecmaVersion: 6 }, errors: [{ messageId: "unexpected", type: "CallExpression", column: 28, endColumn: 32 }] },
{ code: "'use strict'; () => { this.eval('foo'); }", languageOptions: { ecmaVersion: 6 }, errors: [{ messageId: "unexpected", type: "CallExpression", column: 28, endColumn: 32 }] },
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-undef.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ ruleTester.run("no-undef", rule, {
{ code: "customElements;", languageOptions: { globals: globals.browser } },
{ code: "PromiseRejectionEvent;", languageOptions: { globals: globals.browser } },
{ code: "(foo, bar) => { foo ||= WeakRef; bar ??= FinalizationRegistry; }", languageOptions: { ecmaVersion: 2021 } },
{ code: "(class C extends C {})", languageOptions: { ecmaVersion: 6 } },

// Notifications of readonly are removed: https://github.com/eslint/eslint/issues/4504
"/*global b:false*/ function f() { b = 1; }",
Expand Down
58 changes: 27 additions & 31 deletions tests/lib/rules/no-use-before-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,37 +1129,33 @@ ruleTester.run("no-use-before-define", rule, {
data: { name: "a" }
}]
},

/*
* TODO(mdjermanovic): Add the following test cases once https://github.com/eslint/eslint-scope/issues/59 gets fixed:
* {
* code: "(class C extends C {});",
* options: [{ classes: false }],
* languageOptions: { ecmaVersion: 6 },
* errors: [{
* messageId: "usedBeforeDefined",
* data: { name: "C" }
* }]
* },
* {
* code: "(class C extends (class { [C](){} }) {});",
* options: [{ classes: false }],
* languageOptions: { ecmaVersion: 6 },
* errors: [{
* messageId: "usedBeforeDefined",
* data: { name: "C" }
* }]
* },
* {
* code: "(class C extends (class { static field = C; }) {});",
* options: [{ classes: false }],
* languageOptions: { ecmaVersion: 2022 },
* errors: [{
* messageId: "usedBeforeDefined",
* data: { name: "C" }
* }]
* }
*/
{
code: "(class C extends C {});",
options: [{ classes: false }],
languageOptions: { ecmaVersion: 6 },
errors: [{
messageId: "usedBeforeDefined",
data: { name: "C" }
}]
},
{
code: "(class C extends (class { [C](){} }) {});",
options: [{ classes: false }],
languageOptions: { ecmaVersion: 6 },
errors: [{
messageId: "usedBeforeDefined",
data: { name: "C" }
}]
},
{
code: "(class C extends (class { static field = C; }) {});",
options: [{ classes: false }],
languageOptions: { ecmaVersion: 2022 },
errors: [{
messageId: "usedBeforeDefined",
data: { name: "C" }
}]
},

// "allowNamedExports" option
{
Expand Down