code-analyzer-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

code-analyzer

Static code analyzer implemented using TypeScript compiler.

Installation

npm install --save code-analyzer-ts

Example Usage

import * as ts from "typescript";
import { CodeAnalyzer } from "code-analyzer-ts";

new CodeAnalyzer()
    .onFileStart((filePath: string, filename: string, fileExtension: string, content: string) => {
        console.log(filePath, filename, fileExtension, content);
    })
    .onNode((node: ts.Node) => {
        if (ts.isCallExpression(node) && node.expression.getText() === "eval") {
            console.error("Eval is evil!");
        }
    })
    .onFileEnd((filePath: string, filename: string, fileExtension: string, content: string) => {
        console.log(filePath, filename, fileExtension, content);
    })
    .analyze("path");

Package Sidebar

Install

npm i code-analyzer-ts

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

10.5 kB

Total Files

9

Last publish

Collaborators

  • o-su