{"id":16974274,"url":"https://github.com/jerone/eslint-plugin-angular-template-consistent-this","last_synced_at":"2025-03-22T14:31:34.000Z","repository":{"id":45726179,"uuid":"315705494","full_name":"jerone/eslint-plugin-angular-template-consistent-this","owner":"jerone","description":"ESLint Angular Template consistent this for properties, variables \u0026 template references.","archived":false,"fork":false,"pushed_at":"2024-05-09T04:33:41.000Z","size":831,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T12:02:14.270Z","etag":null,"topics":["angular","angular-template","eslint","eslint-plugin","eslint-rule","eslint-rules","linting"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-plugin-angular-template-consistent-this","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jerone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-24T17:28:26.000Z","updated_at":"2022-08-30T12:20:57.000Z","dependencies_parsed_at":"2024-02-17T10:28:45.058Z","dependency_job_id":"1e8c476e-bb60-4f56-97f6-c918a432db24","html_url":"https://github.com/jerone/eslint-plugin-angular-template-consistent-this","commit_stats":{"total_commits":235,"total_committers":3,"mean_commits":78.33333333333333,"dds":0.05957446808510636,"last_synced_commit":"5a1f299eefbcd9e5d2f94c3bf2622c2ed2cf1428"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerone%2Feslint-plugin-angular-template-consistent-this","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerone%2Feslint-plugin-angular-template-consistent-this/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerone%2Feslint-plugin-angular-template-consistent-this/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerone%2Feslint-plugin-angular-template-consistent-this/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerone","download_url":"https://codeload.github.com/jerone/eslint-plugin-angular-template-consistent-this/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244972055,"owners_count":20540916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-template","eslint","eslint-plugin","eslint-rule","eslint-rules","linting"],"created_at":"2024-10-14T01:05:53.185Z","updated_at":"2025-03-22T14:31:33.652Z","avatar_url":"https://github.com/jerone.png","language":"TypeScript","readme":"# ESLint Angular Template consistent this \u003cbr\u003e`eslint-plugin-angular-template-consistent-this`\n\n[![npm](https://img.shields.io/npm/v/eslint-plugin-angular-template-consistent-this)](https://www.npmjs.com/package/eslint-plugin-angular-template-consistent-this)\n[![GitHub Action: CI](https://img.shields.io/github/actions/workflow/status/jerone/eslint-plugin-angular-template-consistent-this/.github/workflows/ci.yml?branch=master\u0026label=CI\u0026logo=github)](https://github.com/jerone/eslint-plugin-angular-template-consistent-this/actions/workflows/ci.yml)\n[![GitHub Action: Security](https://img.shields.io/github/actions/workflow/status/jerone/eslint-plugin-angular-template-consistent-this/.github/workflows/security.yml?branch=master\u0026label=Security\u0026logo=github)](https://github.com/jerone/eslint-plugin-angular-template-consistent-this/actions/workflows/security.yml)\n[![Codecov](https://codecov.io/gh/jerone/eslint-plugin-angular-template-consistent-this/branch/master/graph/badge.svg?token=BTJRO49LZT)](https://codecov.io/gh/jerone/eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Coverage](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Bugs](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![SonarCloud: Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=jerone_eslint-plugin-angular-template-consistent-this\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=jerone_eslint-plugin-angular-template-consistent-this)\n[![Snyk vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/jerone/eslint-plugin-angular-template-consistent-this?logo=snyk)](https://snyk.io/test/github/jerone/eslint-plugin-angular-template-consistent-this)\n[![GitHub issues](https://img.shields.io/github/issues/jerone/eslint-plugin-angular-template-consistent-this?logo=github)](https://github.com/jerone/eslint-plugin-angular-template-consistent-this)\n[![MIT license](https://img.shields.io/github/license/jerone/eslint-plugin-angular-template-consistent-this)](https://opensource.org/licenses/MIT)\n[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat\u0026logo=prettier)](https://github.com/prettier/prettier)\n\nExplicit/implicit prefix properties, variables and template references with `this.` in Angular HTML templates.\n\nThere is no functional reason to start properties with `this`. It is solely aesthetic. But by giving developers the choice to apply it or not, the code will look inconsistent.\n\nExplicit means that properties, variables and template references start with `this.`, like: `\u003ctest *ngIf=\"this.foo\"\u003e{{this.bar}}\u003c/test\u003e`.\n\nRead more about this rule [in the documentation](https://github.com/jerone/eslint-plugin-angular-template-consistent-this/blob/master/docs/rules/eslint-plugin-angular-template-consistent-this.md).\n\n## Requirements\n\nYou'll need to have an Angular project with the following packages installed:\n\n- [ESLint](https://eslint.org/) - version 7 and 8 are tested.\n- [Angular ESLint](https://github.com/angular-eslint/angular-eslint) - version 13, 14 \u0026 15 \u0026 16 are tested.\n\n## Installation\n\nInstall `eslint-plugin-angular-template-consistent-this`:\n\n```sh\nnpm install eslint-plugin-angular-template-consistent-this --save-dev\n```\n\n## Usage\n\nAdd `eslint-plugin-angular-template-consistent-this` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:\n\n```diff\n{\n  \"root\": true,\n  \"ignorePatterns\": [\"projects/**/*\"],\n  \"overrides\": [\n    // ...\n    {\n      \"files\": [\"*.html\"],\n      \"extends\": [\n        \"plugin:@angular-eslint/template/recommended\"\n      ],\n+     \"plugins\": [\"angular-template-consistent-this\"],\n      \"rules\": {\n        // ...\n      }\n    }\n  ]\n}\n```\n\nThen configure the rules you want to use under the rules section. The recommended configuration is:\n\n```diff\n{\n  \"root\": true,\n  \"ignorePatterns\": [\"projects/**/*\"],\n  \"overrides\": [\n    // ...\n    {\n      \"files\": [\"*.html\"],\n      \"extends\": [\n        \"plugin:@angular-eslint/template/recommended\"\n      ],\n      \"plugins\": [\"angular-template-consistent-this\"],\n      \"rules\": {\n+       // Prepend properties with `this`.\n+       \"angular-template-consistent-this/eslint-plugin-angular-template-consistent-this\": [\n+         \"error\",\n+         {\n+           \"properties\": \"explicit\",\n+           \"variables\": \"implicit\",\n+           \"templateReferences\": \"implicit\"\n+         }\n+       ]\n      }\n    }\n  ]\n}\n```\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerone%2Feslint-plugin-angular-template-consistent-this","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerone%2Feslint-plugin-angular-template-consistent-this","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerone%2Feslint-plugin-angular-template-consistent-this/lists"}