{"id":18365744,"url":"https://github.com/konclave/angular-projects-style-guide","last_synced_at":"2026-02-19T12:01:45.530Z","repository":{"id":146417304,"uuid":"237973123","full_name":"konclave/angular-projects-style-guide","owner":"konclave","description":null,"archived":false,"fork":false,"pushed_at":"2020-02-03T12:16:30.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-25T06:44:00.653Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"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/konclave.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":"2020-02-03T13:36:17.000Z","updated_at":"2020-08-12T20:57:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"fafa7a2d-f7d5-4572-9114-3c87a1ea6566","html_url":"https://github.com/konclave/angular-projects-style-guide","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/konclave/angular-projects-style-guide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konclave%2Fangular-projects-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konclave%2Fangular-projects-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konclave%2Fangular-projects-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konclave%2Fangular-projects-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/konclave","download_url":"https://codeload.github.com/konclave/angular-projects-style-guide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konclave%2Fangular-projects-style-guide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29612508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T10:52:55.328Z","status":"ssl_error","status_checked_at":"2026-02-19T10:52:26.323Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-05T23:14:27.147Z","updated_at":"2026-02-19T12:01:45.483Z","avatar_url":"https://github.com/konclave.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Projects Style Guide\n\n* Use appropriate prefix for new projects instead of `app`.\n* Use [prettier](https://prettier.io/), [husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged) to support consistent code style.\n* Clear your subscriptions on `NgDestroy` using [Unsubscribe](https://gist.github.com/phassttt/4214b29983982e7cce8b672ad4121e7c) class.\n* Do not create `SharedModule`. All the common components that is not part of a specific routing page should be placed inside `src/lib` directory. Create separate modules for every semantically similar groups of components. For example, create `lib/forms/forms.module.ts` for forms related components.\n* Use `Type | undefined` for `@Input()` fields to represent missing input value.\n\n    ```typescript\n        export class SomeComponent {\n            @Input()\n            posts: Posts | undefined;\n        }\n    ```\n\n* Use `$` at the end of class field name for Observables.\n\n    ```typescript\n        export class SomeClass {\n          private posts$: Observable\u003cPosts\u003e;\n        }\n    ```\n\n## How to configure Prettier and TSLint\n\n1. Install `prettier`, `husky`, `lint-staged` and `tslint-config-prettier` using command:\n\n    ```bash\n        # if you are using npm:\n        npm install --save-dev prettier husky lint-staged tslint-config-prettier\n        # if you are using yarn:\n        yarn add --dev prettier husky lint-staged tslint-config-prettier\n    ```\n\n2. Create `prettier` configuration file in the root directory of your project. Call the configuration file `prettier.config.js`. Use [prettier documentation](https://prettier.io/docs/en/options.html) to set options.\n\n\n\n    **Prettier configuration I use can be found [here](https://gist.github.com/phassttt/cb99f5fc91ef049c7747527e26f8c634). It works well with Angular projects.**\n\n3. Add this lines at the end of your `package.json` file:\n\n    ```json\n      \"husky\": {\n        \"hooks\": {\n          \"pre-commit\": \"lint-staged\"\n        }\n      },\n      \"lint-staged\": {\n          \"*.{js,json,ts,css,scss,html}\": [\n          \"prettier --write\",\n          \"git add\"\n        ]\n      }\n    ```\n\n4. Then, extend your tslint.json, and make sure `tslint-config-prettier` is at the end:\n\n    ```json\n        \"extends\": [\n            \"tslint:latest\",\n            \"tslint-config-prettier\"\n        ]\n    ```\n\n## How to use `Unsubscribe` class\n\n```typescript\n\nimport { Unsubscribe } from \"...\";\n\n@Component({\n    // ...\n})\nexport class SomeComponent extends Unsubscribe {\n  fetchPosts() {\n      return this.http.get('http://my-project.com/posts').pipe(\n          // clears this subscription on NgDestroy life cycle hook\n          this.takeUntilDestroy()\n      );\n  }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonclave%2Fangular-projects-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonclave%2Fangular-projects-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonclave%2Fangular-projects-style-guide/lists"}