@@ -9,10 +9,18 @@ import { registeredRules } from './load.js';
99import { assertIs } from './utils.js' ;
1010import { addVisitorToCompiled , compiledVisitor , finalizeCompiledVisitor , initCompiledVisitor } from './visitor.js' ;
1111
12+ // Lazy implementation
13+ /*
1214// @ts -expect-error we need to generate `.d.ts` file for this module.
1315import { TOKEN } from '../../dist/src-js/raw-transfer/lazy-common.mjs';
1416// @ts -expect-error we need to generate `.d.ts` file for this module.
1517import { 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' ;
1624
1725// Buffer with typed array views of itself stored as properties
1826interface BufferWithArrays extends Uint8Array {
@@ -80,6 +88,14 @@ export function lintFile(filePath: string, bufferId: number, buffer: Uint8Array
8088 sourceByteLen = uint32 [ ( programPos + SOURCE_LEN_OFFSET ) >> 2 ] ;
8189
8290 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+ /*
8399 const sourceIsAscii = sourceText.length === sourceByteLen;
84100 const ast = {
85101 buffer,
@@ -91,6 +107,7 @@ export function lintFile(filePath: string, bufferId: number, buffer: Uint8Array
91107 };
92108
93109 walkProgram(programPos, ast, compiledVisitor);
110+ */
94111 }
95112
96113 // Send diagnostics back to Rust
0 commit comments