You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when eslint-plugin-import-x finds an import, it will resolve the real path of the module (through the eslint import resolvers), read the file, and then parse the module into the AST using the configured parsers (import-x/parser) or the default parser (ruleContext.parserPath). Then eslint-plugin-import-x tried to extract all exports/imports by walking through AST.
Parse any referenced modules are very heavy tasks, resulting eslint-plugin-import-x being slow. But if we use something like es-module-lexer or cjs-module-lexer to scan the imports/exports we skip the entire parsing-into-AST process and significantly improve performance for a few rules.
The text was updated successfully, but these errors were encountered:
We have es-module-lexer that works for ESM and cjs-module-lexer for CommonJS. But we still need lexers for JSX / TypeScript / TSX (or even flow). I still want TypeScript to benefit from this.
Oxc says they will have one for ESM and TypeScript/TSX, but they won't support the CJS.
SukkaW
changed the title
Ideas about how to significantly improve performance of some rules
Ideas about how to significantly improve performance
Dec 11, 2024
We have es-module-lexer that works for ESM and cjs-module-lexer for CommonJS. But we still need lexers for JSX / TypeScript / TSX (or even flow). I still want TypeScript to benefit from this.
Currently, when
eslint-plugin-import-x
finds an import, it will resolve the real path of the module (through the eslint import resolvers), read the file, and then parse the module into the AST using the configured parsers (import-x/parser
) or the default parser (ruleContext.parserPath
). Theneslint-plugin-import-x
tried to extract all exports/imports by walking through AST.Parse any referenced modules are very heavy tasks, resulting
eslint-plugin-import-x
being slow. But if we use something likees-module-lexer
orcjs-module-lexer
to scan the imports/exports we skip the entire parsing-into-AST process and significantly improve performance for a few rules.The text was updated successfully, but these errors were encountered: