Skip to content

Commit

Permalink
fix!: upgrade eslint-scope@8.0.0 (#17942)
Browse files Browse the repository at this point in the history
* chore: upgrade eslint-scope@8.0.0

* add test with parenthesized 'use strict'

* update package.json
  • Loading branch information
mdjermanovic committed Jan 4, 2024
1 parent 3ee0f6c commit 07107a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
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
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
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
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

0 comments on commit 07107a5

Please sign in to comment.