{"id":22367355,"url":"https://github.com/shian15810/eslint-plugin-typescript-enum","last_synced_at":"2026-03-09T15:03:56.120Z","repository":{"id":36965054,"uuid":"322843277","full_name":"shian15810/eslint-plugin-typescript-enum","owner":"shian15810","description":"ESLint rules for TypeScript enums.","archived":false,"fork":false,"pushed_at":"2023-09-18T21:21:30.000Z","size":156,"stargazers_count":21,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-11T01:50:24.460Z","etag":null,"topics":["enum","eslint","eslint-plugin","eslint-rules","plugin","rules","typescript","typescript-enum","typescript-eslint"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-plugin-typescript-enum","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/shian15810.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-12-19T12:30:56.000Z","updated_at":"2025-07-07T03:23:37.000Z","dependencies_parsed_at":"2024-06-18T16:51:52.370Z","dependency_job_id":"dee9b911-70ab-4e66-b4a0-8a54d3bb273d","html_url":"https://github.com/shian15810/eslint-plugin-typescript-enum","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"284e6c4c5c6a085b80ee146cc0b0d8d0c32c048a"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/shian15810/eslint-plugin-typescript-enum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shian15810%2Feslint-plugin-typescript-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shian15810%2Feslint-plugin-typescript-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shian15810%2Feslint-plugin-typescript-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shian15810%2Feslint-plugin-typescript-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shian15810","download_url":"https://codeload.github.com/shian15810/eslint-plugin-typescript-enum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shian15810%2Feslint-plugin-typescript-enum/sbom","scorecard":{"id":818128,"data":{"date":"2025-08-11","repo":{"name":"github.com/shian15810/eslint-plugin-typescript-enum","commit":"284e6c4c5c6a085b80ee146cc0b0d8d0c32c048a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T14:41:45.070Z","repository_id":36965054,"created_at":"2025-08-23T14:41:45.070Z","updated_at":"2025-08-23T14:41:45.070Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30299882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: 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":["enum","eslint","eslint-plugin","eslint-rules","plugin","rules","typescript","typescript-enum","typescript-eslint"],"created_at":"2024-12-04T18:17:13.199Z","updated_at":"2026-03-09T15:03:56.097Z","avatar_url":"https://github.com/shian15810.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-typescript-enum\n\nESLint rules for TypeScript enums.\n\n## Motivations\n\nFrom [TypeScript Handbook on Enums](https://www.typescriptlang.org/docs/handbook/enums.html):\n\n\u003e Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript.\n\nIn other words, TypeScript enums have their corresponsing runtime representations, they are not erased from your emitted JavaScript files after being compiled. This conflicts with one of the [TypeScript Design Non-goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals#non-goals):\n\n\u003e Provide additional runtime functionality or libraries. Instead, use TypeScript to describe existing libraries.\n\nHaving this TypeScript feature extending into your compiled JavaScript also conflicts with the TypeScript slogan of being a **typed superset of JavaScript**, which further introduces vendor lock-in.\n\n[Orta Therox](https://github.com/orta) from Typescript team mentioned in one of his [YouTube video](https://www.youtube.com/watch?v=8qm49TyMUPI\u0026t=1240)s that the TypeScript team actually regrets some of the changes it made in the beginning, including introducing enums which basically add features to JavaScript.\n\nMoreover, using enums in TypeScript has a lot of caveats and edge cases to keep in mind. Some aspects of it are even considered **not type safe**!!! Head over to these wonderful articles for more details on these issues:\n\n- https://maxheiber.medium.com/alternatives-to-typescript-enums-50e4c16600b1\n- https://stackoverflow.com/questions/40275832/typescript-has-unions-so-are-enums-redundant/60041791#60041791\n\nAdditionally, if you have been using [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript.html), you might have already noticed that one of the [important caveat](https://babeljs.io/docs/en/babel-plugin-transform-typescript.html#caveats)s is to avoid using `const` enums, as those require type information to compile.\n\nNonetheless, TypeScript is undoubtedly a very fantastic programming language with an extremely powerful type system. Enums may have been a very good feature to have back in the early days (2011) when good alternatives did not yet exist.\n\nWe now already have much better alternatives than enums, such as **const assertions**, **string unions**, **discriminated union**, etc. Which is why I created this ESLint plugin to provide you with some handy configs and rules to disallow the use of TypeScript enums.\n\nThis article provides a very in-depth exploration on the alternatives to TypeScript enums:\n\n- https://2ality.com/2020/02/enum-alternatives-typescript.html\n\nLast but not least, as stated in [Objects vs Enums section of TypeScript Handbook on Enums](https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums):\n\n\u003e In modern TypeScript, you may not need an enum when an object with as const could suffice.\n\u003e\n\u003e The biggest argument in favour of this format over TypeScript’s enum is that it keeps your codebase aligned with the state of JavaScript, and when/if enums are added to JavaScript then you can move to the additional syntax.\n\n## Installation\n\nFirst, install the peer dependencies:\n\n```sh\nnpm install --save-dev eslint typescript @typescript-eslint/parser\n```\n\nNext, install this package:\n\n```sh\nnpm install --save-dev eslint-plugin-typescript-enum\n```\n\n## Usage\n\n### Recommended Config\n\nConfigure this plugin in your ESLint configuration file (`.eslintrc.js`), this will disallow the use of enums altogether:\n\n```js\nmodule.exports = {\n  parser: \"@typescript-eslint/parser\",\n  plugins: [\"typescript-enum\"],\n  extends: [\"plugin:typescript-enum/recommended\"],\n};\n```\n\n### Babel Config (Not Recommended)\n\nIf you are using [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript.html) and want to allow the general use of enums except `const` enums:\n\n```js\nmodule.exports = {\n  parser: \"@typescript-eslint/parser\",\n  plugins: [\"typescript-enum\"],\n  extends: [\"plugin:typescript-enum/babel\"],\n};\n```\n\n## Rules\n\n**Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information\n\n| Name                                                           | Description                            | :heavy_check_mark: | :wrench: | :thought_balloon: |\n| -------------------------------------------------------------- | -------------------------------------- | ------------------ | -------- | ----------------- |\n| [`typescript-enum/no-const-enum`](docs/rules/no-const-enum.md) | Disallow TypeScript `const` enums      |                    |          |                   |\n| [`typescript-enum/no-enum`](docs/rules/no-enum.md)             | Disallow all types of TypeScript enums | :heavy_check_mark: |          |                   |\n\n## Contributing\n\nFeel free to suggest new configs and rules, PRs are also welcomed!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshian15810%2Feslint-plugin-typescript-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshian15810%2Feslint-plugin-typescript-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshian15810%2Feslint-plugin-typescript-enum/lists"}