{"id":14978237,"url":"https://github.com/sleavely/eslint-plugin-ts-rules","last_synced_at":"2026-01-28T16:37:51.032Z","repository":{"id":197185181,"uuid":"698161086","full_name":"Sleavely/eslint-plugin-ts-rules","owner":"Sleavely","description":"Opinionated rules for maintainable Typescript projects","archived":false,"fork":false,"pushed_at":"2023-10-01T08:36:21.000Z","size":51,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-03T03:44:10.598Z","etag":null,"topics":["code-quality","eslint","eslint-plugin","static-analysis","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sleavely/eslint-plugin-ts-rules","language":"TypeScript","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/Sleavely.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-09-29T09:44:05.000Z","updated_at":"2023-10-01T09:03:09.000Z","dependencies_parsed_at":"2024-09-18T23:07:38.823Z","dependency_job_id":"0a44a021-d20f-43ca-9210-3c9ab6088ab6","html_url":"https://github.com/Sleavely/eslint-plugin-ts-rules","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":"0.19999999999999996","last_synced_commit":"46b26ee89a36156f41fedc8ba6cc77ca0af699fd"},"previous_names":["sleavely/eslint-plugin-ts-rules"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sleavely%2Feslint-plugin-ts-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sleavely%2Feslint-plugin-ts-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sleavely%2Feslint-plugin-ts-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sleavely%2Feslint-plugin-ts-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sleavely","download_url":"https://codeload.github.com/Sleavely/eslint-plugin-ts-rules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241605738,"owners_count":19989608,"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":["code-quality","eslint","eslint-plugin","static-analysis","typescript"],"created_at":"2024-09-24T13:57:07.149Z","updated_at":"2026-01-28T16:37:50.987Z","avatar_url":"https://github.com/Sleavely.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @sleavely/eslint-plugin-ts-rules\n\nOpinionated rules for maintainable projects.\n\nThis plugin is a Typescript complement to the Javascript rules in [`@sleavely/eslint-plugin-js-rules`](https://github.com/Sleavely/eslint-plugin-js-rules).\n\n## Installing\n\n```sh\nnpm i --save-dev @sleavely/eslint-plugin-ts-rules\n```\n\n```js\n// .eslintrc.cjs\nmodule.exports = {\n  // ..\n  plugins: [\n    '@sleavely/ts-rules',\n  ],\n  rules: {\n    '@sleavely/ts-rules/prefer-inferred-const': ['error', 'always'],\n  }\n}\n```\n\n## Rules\n\n### ts-rules/prefer-inferred-const\n\nIf [`no-inferrable-types`](https://typescript-eslint.io/rules/no-inferrable-types/) had a very strict parent, this rule would be it.\n\nA `const` variable should generally never change, and even if it does it should be contained within the same type that it was originally inferred from.\n\n```ts\n\n// ⛔\nconst name: string = 'foo'\n// ✅\nconst name = 'foo'\n\n// methods _should_ already define a return type or have an inferrable one\nconst getBurger = (): string =\u003e 'Big Mac'\n// ⛔\nconst burger: string = getBurger()\n// ✅\nconst burger = getBurger()\n\n// Sometimes you may want to assign a custom type such as an enum. Use this approach in those cases:\nconst name = 'foo' as MyCustomTypeThatIsntAPrimitive\n\nconst name = 'foo' as const\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleavely%2Feslint-plugin-ts-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleavely%2Feslint-plugin-ts-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleavely%2Feslint-plugin-ts-rules/lists"}