File tree Expand file tree Collapse file tree 5 files changed +21
-4
lines changed
packages/eslint-scope/lib Expand file tree Collapse file tree 5 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @fileoverview Assertion utilities.
3+ * @author Nicholas C. Zakas
4+ */
5+
6+ /**
7+ * Throws an error if the given condition is not truthy.
8+ * @param {boolean } condition The condition to check.
9+ * @param {string } message The message to include with the error.
10+ * @returns {void }
11+ * @throws {Error } When the condition is not truthy.
12+ */
13+ export function assert ( condition , message = "Assertion failed." ) {
14+ if ( ! condition ) {
15+ throw new Error ( message ) ;
16+ }
17+ }
Original file line number Diff line number Diff line change 4646 * @module escope
4747 */
4848
49- import assert from "node: assert" ;
49+ import { assert } from "./ assert.js " ;
5050
5151import ScopeManager from "./scope-manager.js" ;
5252import Referencer from "./referencer.js" ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import Reference from "./reference.js";
2828import Variable from "./variable.js" ;
2929import PatternVisitor from "./pattern-visitor.js" ;
3030import { Definition , ParameterDefinition } from "./definition.js" ;
31- import assert from "node: assert" ;
31+ import { assert } from "./ assert.js " ;
3232
3333const { Syntax } = estraverse ;
3434
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import {
3636 SwitchScope ,
3737 WithScope
3838} from "./scope.js" ;
39- import assert from "node: assert" ;
39+ import { assert } from "./ assert.js " ;
4040
4141/**
4242 * @constructor ScopeManager
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import estraverse from "estraverse";
2727import Reference from "./reference.js" ;
2828import Variable from "./variable.js" ;
2929import { Definition } from "./definition.js" ;
30- import assert from "node: assert" ;
30+ import { assert } from "./ assert.js " ;
3131
3232const { Syntax } = estraverse ;
3333
You can’t perform that action at this time.
0 commit comments