@@ -9,10 +9,18 @@ import { registeredRules } from './load.js';
9
9
import { assertIs } from './utils.js' ;
10
10
import { addVisitorToCompiled , compiledVisitor , finalizeCompiledVisitor , initCompiledVisitor } from './visitor.js' ;
11
11
12
+ // Lazy implementation
13
+ /*
12
14
// @ts -expect-error we need to generate `.d.ts` file for this module.
13
15
import { TOKEN } from '../../dist/src-js/raw-transfer/lazy-common.mjs';
14
16
// @ts -expect-error we need to generate `.d.ts` file for this module.
15
17
import { walkProgram } from '../../dist/generated/lazy/walk.mjs';
18
+ */
19
+
20
+ // @ts -expect-error we need to generate `.d.ts` file for this module
21
+ import { deserializeProgramOnly } from '../../dist/generated/deserialize/ts.mjs' ;
22
+ // @ts -expect-error we need to generate `.d.ts` file for this module
23
+ import { walkProgram } from '../../dist/generated/visit/walk.mjs' ;
16
24
17
25
// Buffer with typed array views of itself stored as properties
18
26
interface BufferWithArrays extends Uint8Array {
@@ -80,6 +88,14 @@ export function lintFile(filePath: string, bufferId: number, buffer: Uint8Array
80
88
sourceByteLen = uint32 [ ( programPos + SOURCE_LEN_OFFSET ) >> 2 ] ;
81
89
82
90
const sourceText = textDecoder . decode ( buffer . subarray ( 0 , sourceByteLen ) ) ;
91
+
92
+ // `preserveParens` argument is `false`, to match ESLint.
93
+ // ESLint does not include `ParenthesizedExpression` nodes in its AST.
94
+ const program = deserializeProgramOnly ( buffer , sourceText , sourceByteLen , false ) ;
95
+ walkProgram ( program , compiledVisitor ) ;
96
+
97
+ // Lazy implementation
98
+ /*
83
99
const sourceIsAscii = sourceText.length === sourceByteLen;
84
100
const ast = {
85
101
buffer,
@@ -91,6 +107,7 @@ export function lintFile(filePath: string, bufferId: number, buffer: Uint8Array
91
107
};
92
108
93
109
walkProgram(programPos, ast, compiledVisitor);
110
+ */
94
111
}
95
112
96
113
// Send diagnostics back to Rust
0 commit comments