File tree 5 files changed +21
-4
lines changed
packages/eslint-scope/lib
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 46
46
* @module escope
47
47
*/
48
48
49
- import assert from "node: assert" ;
49
+ import { assert } from "./ assert.js " ;
50
50
51
51
import ScopeManager from "./scope-manager.js" ;
52
52
import Referencer from "./referencer.js" ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import Reference from "./reference.js";
28
28
import Variable from "./variable.js" ;
29
29
import PatternVisitor from "./pattern-visitor.js" ;
30
30
import { Definition , ParameterDefinition } from "./definition.js" ;
31
- import assert from "node: assert" ;
31
+ import { assert } from "./ assert.js " ;
32
32
33
33
const { Syntax } = estraverse ;
34
34
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import {
36
36
SwitchScope ,
37
37
WithScope
38
38
} from "./scope.js" ;
39
- import assert from "node: assert" ;
39
+ import { assert } from "./ assert.js " ;
40
40
41
41
/**
42
42
* @constructor ScopeManager
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import estraverse from "estraverse";
27
27
import Reference from "./reference.js" ;
28
28
import Variable from "./variable.js" ;
29
29
import { Definition } from "./definition.js" ;
30
- import assert from "node: assert" ;
30
+ import { assert } from "./ assert.js " ;
31
31
32
32
const { Syntax } = estraverse ;
33
33
You can’t perform that action at this time.
0 commit comments