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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint/eslint-scope
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.0.0
Choose a base ref
...
head repository: eslint/eslint-scope
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.0.0
Choose a head ref
  • 5 commits
  • 7 files changed
  • 3 contributors

Commits on Oct 26, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    263c762 View commit details

Commits on Nov 9, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4aafb61 View commit details

Commits on Nov 14, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    22a55c0 View commit details

Commits on Nov 16, 2021

  1. Build: changelog update for 7.0.0

    ESLint Jenkins committed Nov 16, 2021
    Copy the full SHA
    a26761f View commit details
  2. 7.0.0

    ESLint Jenkins committed Nov 16, 2021
    Copy the full SHA
    bc86b15 View commit details
Showing with 916 additions and 8 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +6 −0 CHANGELOG.md
  3. +8 −0 lib/referencer.js
  4. +5 −0 lib/scope-manager.js
  5. +17 −3 lib/scope.js
  6. +4 −4 package.json
  7. +875 −0 tests/class-static-blocks.js
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [16.x, 14.x, 12.x, "12.22.0"]
node: [17.x, 16.x, 14.x, 12.x, "12.22.0"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v7.0.0 - November 16, 2021

* [`22a55c0`](https://github.com/eslint/eslint-scope/commit/22a55c01d1a28fd3ffd45c8818b49e65bd3e5005) feat!: support class static blocks (#80) (Milos Djermanovic)
* [`4aafb61`](https://github.com/eslint/eslint-scope/commit/4aafb616212adc39af37064932da912bdc7d9226) build: upgrade eslint-release to v3.2.0 to support conventional commits (#79) (Milos Djermanovic)
* [`263c762`](https://github.com/eslint/eslint-scope/commit/263c762432c5a3995e30fa814d02b0ed358b0e68) Build: add node v17 (#76) (唯然)

v6.0.0 - July 23, 2021

* [`4ee1d80`](https://github.com/eslint/eslint-scope/commit/4ee1d80ce7dab961d9a158bc664d781bb663b570) Fix: Ensure correct version in package (#73) (Nicholas C. Zakas)
8 changes: 8 additions & 0 deletions lib/referencer.js
Original file line number Diff line number Diff line change
@@ -470,6 +470,14 @@ class Referencer extends esrecurse.Visitor {
}
}

StaticBlock(node) {
this.scopeManager.__nestClassStaticBlockScope(node);

this.visitChildren(node);

this.close(node);
}

MethodDefinition(node) {
this.visitProperty(node);
}
5 changes: 5 additions & 0 deletions lib/scope-manager.js
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import {
BlockScope,
CatchScope,
ClassFieldInitializerScope,
ClassStaticBlockScope,
ClassScope,
ForScope,
FunctionExpressionNameScope,
@@ -228,6 +229,10 @@ class ScopeManager {
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
}

__nestClassStaticBlockScope(node) {
return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
}

__nestSwitchScope(node) {
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
}
20 changes: 17 additions & 3 deletions lib/scope.js
Original file line number Diff line number Diff line change
@@ -157,7 +157,8 @@ class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {

/**
* One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
* One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
* "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
@@ -225,7 +226,13 @@ class Scope {
* @member {Scope} Scope#variableScope
*/
this.variableScope =
(this.type === "global" || this.type === "function" || this.type === "module" || this.type === "class-field-initializer") ? this : upperScope.variableScope;
this.type === "global" ||
this.type === "module" ||
this.type === "function" ||
this.type === "class-field-initializer" ||
this.type === "class-static-block"
? this
: upperScope.variableScope;

/**
* Whether this scope is created by a FunctionExpression.
@@ -738,6 +745,12 @@ class ClassFieldInitializerScope extends Scope {
}
}

class ClassStaticBlockScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class-static-block", upperScope, block, true);
}
}

export {
Scope,
GlobalScope,
@@ -750,7 +763,8 @@ export {
FunctionScope,
ForScope,
ClassScope,
ClassFieldInitializerScope
ClassFieldInitializerScope,
ClassStaticBlockScope
};

/* vim: set sw=4 ts=4 et tw=80 : */
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
},
"./package.json": "./package.json"
},
"version": "6.0.0",
"version": "7.0.0",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@@ -50,9 +50,9 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.1",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"eslint-visitor-keys": "^3.0.0",
"espree": "^8.0.0",
"eslint-release": "^3.2.0",
"eslint-visitor-keys": "^3.1.0",
"espree": "^9.0.0",
"mocha": "^9.0.1",
"npm-license": "^0.3.3",
"rollup": "^2.52.7",
Loading