{"id":20527020,"url":"https://github.com/node-ts/code-standards","last_synced_at":"2025-04-14T04:21:31.225Z","repository":{"id":57131545,"uuid":"165223915","full_name":"node-ts/code-standards","owner":"node-ts","description":"An opinionated set of linting and build configurations for typescript projects to build modern, maintainable TypeScript projects.","archived":false,"fork":false,"pushed_at":"2020-05-06T05:49:54.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T18:13:06.165Z","etag":null,"topics":["bootstrap","code-standards","code-style","configuration","lint","node","tslint","typescript"],"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/node-ts.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}},"created_at":"2019-01-11T10:17:01.000Z","updated_at":"2020-12-16T12:47:02.000Z","dependencies_parsed_at":"2022-09-01T00:12:49.156Z","dependency_job_id":null,"html_url":"https://github.com/node-ts/code-standards","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ts%2Fcode-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ts%2Fcode-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ts%2Fcode-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ts%2Fcode-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-ts","download_url":"https://codeload.github.com/node-ts/code-standards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819651,"owners_count":21166516,"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":["bootstrap","code-standards","code-style","configuration","lint","node","tslint","typescript"],"created_at":"2024-11-15T23:16:58.247Z","updated_at":"2025-04-14T04:21:31.150Z","avatar_url":"https://github.com/node-ts.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# @node-ts/code-standards\n\n[![CircleCI](https://circleci.com/gh/node-ts/code-standards/tree/master.svg?style=svg)](https://circleci.com/gh/node-ts/code-standards/tree/master)\n\nAn opinionated set of linting and build configurations for typescript projects to build modern, maintainable TypeScript projects. \n\n## Linting\n\nThe linting rules aim to produce terse, neat and consistent TypeScript code. This is valuable in any repo that has more than one contributor, but single author projects may also find it useful.\n\nBelow shows a small example of the code produced with this style:\n\n```typescript\n// Enforce ES6 style imports\nimport { S3 } from 'aws-sdk' // single quotes, no semicolon on the end of lines\n\nexport class ObjectStorageService {\n\n  constructor ( // double-space indents\n    private readonly s3 = new S3()\n  ) {\n  }\n\n  async upload (bucket: string, key: string, body: Buffer): Promise\u003cvoid\u003e { // enforce complete method signature\n    const putObjectRequest: S3.Types.PutObjectRequest = { // prefer const\n      Bucket: bucket,\n      Key: key,\n      Body: body\n    }\n    await this.s3.putObject(putObjectRequest).promise()\n  }\n\n}\n// All files end with a new line (LF)\n```\n\n## TypeScript Configuration\n\nTypeScript options have been set in `tsconfig.json` that target Node v8 and up. These options can be overridden for web projects that target browsers.\n\n## Installation\n\n1. Install into your project along with `tslint` and `typescript`\n\n    ```sh\n    npm i @node-ts/code-standards tslint typescript --save-dev\n    ```\n\n2. Copy `.editorconfig` into the root of your project. This will let your code editor confirm to many of the whitespacing rules automatically. See [Editor Config](https://editorconfig.org/) on setting up your code editor for the first time.\n\n3. Create a `tslint.json` file in the root of your project with the following contents:\n\n    ```json\n    {\n      \"extends\": \"./node_modules/@node-ts/code-standards/tslint.json\"\n    }\n    ```\n\n4. Create a `tsconfig.json` file in the root of your project with the following contents. You may wish to extend this with further options\n\n    ```json\n    {\n      \"extends\": \"./node_modules/@node-ts/code-standards/tsconfig.json\"\n    }\n    ```\n\n5. Add the following to the `scripts` block in your project's `package.json`:\n\n    ```json\n    {\n      \"lint\": \"tslint --project tsconfig.json 'src/**/*.ts'\",\n      \"lint:fix\": \"npm lint --fix\"\n    }\n    ```\n\n## IDE Configuration\n\nIDE defaults for line spacing, whitespace etc can be set by placing an `.editorconfig` file (like the one in this package) into the root of your project. This is used by the [Editor Config](https://editorconfig.org/) plugin of your preferred browser to set such defaults for your project. \n\nThis helps ensure any characters inserted by your editor conforms to the linting rules in this package.\n\n## Overriding Rules\n\nIndividual rules can be overridden if they do not suit the particular project they're being imported into. This is common for web sites that need to transpile slightly differently to a regular node application.\n\n### In tslint.json\n\nIndividual linting rules cna be overridden by specifying the updated rule in your local `tslint.json` file as such:\n\n```json\n{\n  \"extends\": \"./node_modules/@node-ts/code-standards/tslint.json\",\n  \"rules\": {\n    \"semicolon\": [true, \"always\"]\n  }\n}\n```\n\n### In tsconfig.json\n\nSimilar to linting, TypeScript configuration options can be overridden by specifying the updated values in the local `tsconfig.json` file.\n\nFor example:\n\n```json\n{\n  \"extends\": \"./node_modules/@node-ts/code-standards/tsconfig.json\",\n  \"compilerOptions\": {\n    \"target\": \"es6\",\n    \"lib\": [\"es7\"]\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-ts%2Fcode-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-ts%2Fcode-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-ts%2Fcode-standards/lists"}