{"id":21585090,"url":"https://github.com/angular-ru/angular-style-guide","last_synced_at":"2026-03-19T20:55:34.600Z","repository":{"id":90970958,"uuid":"360852470","full_name":"Angular-RU/angular-style-guide","owner":"Angular-RU","description":"Angular / TypeScript projects style guide","archived":false,"fork":false,"pushed_at":"2021-06-20T19:54:01.000Z","size":85,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T09:13:29.986Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Angular-RU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-04-23T10:51:37.000Z","updated_at":"2023-08-16T02:22:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdb98cfb-f97d-40d2-b583-29265d6478a7","html_url":"https://github.com/Angular-RU/angular-style-guide","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Angular-RU/angular-style-guide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Angular-RU%2Fangular-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Angular-RU%2Fangular-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Angular-RU%2Fangular-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Angular-RU%2Fangular-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Angular-RU","download_url":"https://codeload.github.com/Angular-RU/angular-style-guide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Angular-RU%2Fangular-style-guide/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260109574,"owners_count":22960033,"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":[],"created_at":"2024-11-24T15:08:57.450Z","updated_at":"2026-01-31T22:04:03.614Z","avatar_url":"https://github.com/Angular-RU.png","language":null,"readme":"# Angular / TypeScript projects style guide\n\n**TypeScript + ESLint**\n\n-   [Require that member overloads be consecutive](#rules-for-eslint)\n-   [Requires using either `T[]` or `Array\u003cT\u003e` for arrays](#array-types)\n-   [Disallows awaiting a value that is not a Thenable](#await-thenable)\n-   [Requires type annotations to exist (typedef)](#typedef)\n-   [Require explicit return and argument types on exported functions' and classes' public class methods](#explicit-module-boundary-types)\n\n---\n\n## TypeScript + ESLint\n\n-   https://github.com/typescript-eslint/typescript-eslint\n\n### Require that member overloads be consecutive \u003ca id=\"rules-for-eslint\"\u003e\u003c/a\u003e\n\nUse\n[`'@typescript-eslint/adjacent-overload-signatures': 'error'`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md),\nbecause grouping overloaded members together can improve readability of the code.\n\n![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `Bad pattern`\n\n```ts\nclass Foo {\n    foo(s: string): void;\n    foo(n: number): void;\n    bar(): void {}\n    foo(sn: string | number): void {}\n}\n\nexport function foo(s: string): void;\nexport function foo(n: number): void;\nexport function bar(): void;\nexport function foo(sn: string | number): void;\n```\n\n![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `Good pattern`\n\n```ts\nclass Foo {\n    foo(s: string): void;\n    foo(n: number): void;\n    foo(sn: string | number): void {}\n    bar(): void {}\n}\n\nexport function bar(): void;\nexport function foo(s: string): void;\nexport function foo(n: number): void;\nexport function foo(sn: string | number): void;\n```\n\n### Requires using either `T[]` or `Array\u003cT\u003e` for arrays \u003ca id=\"array-types\"\u003e\u003c/a\u003e\n\nUse\n[`'@typescript-eslint/array-type': 'error'`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md)\nfor always using `T[]` or readonly `T[]` for all array types.\n\n![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `Bad pattern`\n\n```ts\nconst x: Array\u003cstring\u003e = ['a', 'b'];\nconst y: ReadonlyArray\u003cstring\u003e = ['a', 'b'];\n```\n\n![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `Good pattern`\n\n```ts\nconst x: string[] = ['a', 'b'];\nconst y: readonly string[] = ['a', 'b'];\n```\n\n### Disallows awaiting a value that is not a Thenable \u003ca id=\"await-thenable\"\u003e\u003c/a\u003e\n\nUse\n[`'@typescript-eslint/await-thenable': 'error'`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md)\n\n![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `Bad pattern`\n\n```ts\nawait 'value';\n\nconst createValue = () =\u003e 'value';\nawait createValue();\n```\n\n![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `Good pattern`\n\n```ts\nawait Promise.resolve('value');\n\nconst createValue = async () =\u003e 'value';\nawait createValue();\n```\n\n### Requires type annotations to exist \u003ca id=\"typedef\"\u003e\u003c/a\u003e\n\nMany believe that requiring type annotations unnecessarily can be cumbersome to maintain and generally reduces code\nreadability. TypeScript is often better at inferring types than easily written type annotations would allow. And many\npeople believe instead of enabling typedef, it is generally recommended using the `--noImplicitAny` and\n`--strictPropertyInitialization` compiler options to enforce type annotations only when useful. This rule can enforce\ntype annotations in locations regardless of whether they're required.\n\nBut why is annotation description useful? Because for the code review, you will not be able to find out what will change\nin runtime due to inferred types. But when you specify types, you know exactly what to change to:\n\n![](https://habrastorage.org/webt/3x/q6/ds/3xq6dsrygwwblzl2ntfdpd_wkw8.gif)\n\nIt is also worth noting that if we do not use type annotations for methods, it may be difficult for us to read the code\nduring the review, we may not notice something and not pay attention to how the data type has changed if the build does\nnot crash with an error.\n\n![](https://habrastorage.org/webt/du/sc/qv/duscqvjgqnaelbkcfmjf2myhhty.gif)\n\nReference to [explicit-module-boundary-types](#explicit-module-boundary-types)\n\n# Require explicit return and argument types on exported functions' and classes' public class methods \u003ca id=\"explicit-module-boundary-types\"\u003e\u003c/a\u003e\n\nExplicit types for function return values and arguments makes it clear to any calling code what is the module boundary's\ninput and output.\n\n![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `Bad pattern`\n\n```ts\n// Should indicate that a number is returned\nexport function myFn() {\n    return 1;\n}\n```\n\n![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `Good pattern`\n\n```ts\n// A return value of type number\nexport function myFn(): number {\n    return 1;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-ru%2Fangular-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular-ru%2Fangular-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-ru%2Fangular-style-guide/lists"}