eslint for angular project
-
Follow the latest Getting Started guide on https://angular.io/ in order to install the Angular CLI
-
install this package in your project
# use npm npm install @kidwen/eslint-config-angular@latest --save-dev # use yarn yarn add @kidwen/eslint-config-angular@latest --dev
-
add
tsconfig.eslint.jsonfile like this{ "extends": "./tsconfig.app.json", "include": [ // adjust "includes" to what makes sense for you and your project "src/**/*.ts", "projects/**/*.ts", ] } -
add
eslint.config.jsonfile like thisimport tseslint from 'typescript-eslint'; import angular from 'angular-eslint'; import kidwenLint from '@kidwen/eslint-config-angular'; import globals from 'globals'; export default tseslint.config( ...kidwenLint, { files: ['**/*.ts'], processor: angular.processInlineTemplates, languageOptions: { ecmaVersion: 6, sourceType: 'module', globals: { ...globals.es6, }, parserOptions: { modules: true, projectService: { defaultProject: "tsconfig.eslint.json", }, } }, rules: {}, } );
git clone https://github.com/kidwen/eslint-config-angular.git
cd eslint-config-angular
yarn
cd example/lint
yarn
yarn lint