What is the use of codelyzer in angular 2 application.

All enterprise applications follows a set of coding conventions and guidelines to maintain code in better way. Codelyzer is an open source tool to run and check whether the pre-defined coding guidelines has been followed or not. Codelyzer does only static code analysis for angular and typescript project.

Codelyzer runs on top of tslint and its coding conventions are usually defined in tslint.json file. Codelyzer can be run via angular cli or npm directly. Editors like Visual Studio Code and Atom also supports codelyzer just by doing a basic settings.

To set up the codelyzer in Visual Studio code, we can go to File -> Preferences -> User Settings and add the path for tslint rules.

{
"tslint.rulesDirectory": ".ode_modules/codelyzer",
"typescript.tsdk": "node_modules/typescript/lib"
}

To run from cli:ng lint.

To run from npm:npm run lint

results matching ""

    No results matching ""