rlsbl v0.40.1 /rlsbl.lint.npm_ast
On this page

JavaScript and TypeScript linter using tree-sitter AST parsing to detect library boundary violations such as forbidden imports and logging.

#rlsbl.lint.npm_ast

#rlsbl.lint.npm_ast

JavaScript and TypeScript linter using tree-sitter AST parsing to detect library boundary violations such as forbidden imports and logging.

#_lang_for_ext

python
def _lang_for_ext(ext)

Select the tree-sitter language based on file extension.

#_node_line

python
def _node_line(node)

Return 1-based line number for a tree-sitter node.

#_extract_string

python
def _extract_string(node)

Extract text content from a string/string_fragment node.

#_collect_all_imports

python
def _collect_all_imports(tree, filepath)

Walk AST and collect all imported package names.

Returns a set of (package_name, file_path, line_number) tuples.

#_check_forbidden_imports

python
def _check_forbidden_imports(tree, filepath, config)

Walk AST for import/require/export nodes.

#_check_stdout

python
def _check_stdout(tree, filepath, config)

Detect console.log/warn/error/info calls.

#_check_entry_points

python
def _check_entry_points(project_path, config)

Check package.json for 'bin' field.

#NpmAstLinter

npm (JS/TS) linter using tree-sitter AST analysis.

#lint

python
def lint(self, project_path: str, config: LanguageLintConfig) -> list[LintResult]

#scan_imports

python
def scan_imports(self, project_path: str) -> set[tuple[str, str, int]]

Collect all imported package names from JS/TS files.

Returns a set of (package_name, file_path, line_number) tuples.