{"id":13596311,"url":"https://github.com/keithamus/eslint-plugin-escompat","last_synced_at":"2025-04-04T14:10:11.004Z","repository":{"id":41087128,"uuid":"172960231","full_name":"keithamus/eslint-plugin-escompat","owner":"keithamus","description":"Report errors for code which wont work in browsers without transpiling","archived":false,"fork":false,"pushed_at":"2025-02-11T01:19:08.000Z","size":411,"stargazers_count":40,"open_issues_count":5,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T12:15:24.656Z","etag":null,"topics":["babel","browsers","browserslist","ecmascript2018","es6","eslint","eslint-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/keithamus.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":"2019-02-27T17:33:13.000Z","updated_at":"2025-02-11T01:16:15.000Z","dependencies_parsed_at":"2024-01-15T15:47:48.705Z","dependency_job_id":"74b81018-f9bd-40ae-ae3f-9b5931f6e345","html_url":"https://github.com/keithamus/eslint-plugin-escompat","commit_stats":{"total_commits":94,"total_committers":11,"mean_commits":8.545454545454545,"dds":"0.23404255319148937","last_synced_commit":"f2a25b1492c0be8a26998a8e8eb3328f42daa3d9"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithamus%2Feslint-plugin-escompat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithamus%2Feslint-plugin-escompat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithamus%2Feslint-plugin-escompat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithamus%2Feslint-plugin-escompat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keithamus","download_url":"https://codeload.github.com/keithamus/eslint-plugin-escompat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190255,"owners_count":20898702,"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":["babel","browsers","browserslist","ecmascript2018","es6","eslint","eslint-plugin"],"created_at":"2024-08-01T16:02:17.366Z","updated_at":"2025-04-04T14:10:10.971Z","avatar_url":"https://github.com/keithamus.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eslint-plugin-escompat\n\nThis plugin will report eslint errors for code which - if left untranspiled -\nwill not work in some browsers.\n\nThis is useful if you intend to ship code without first using a transpiler, such\nas [Babel](https://babeljs.io).\n\nThis _won't_ lint for features that can be polyfilled. For that you can use\n[eslint-plugin-compat][epc].\n\n## Installation\n\n```bash\nnpm install --save-dev eslint-plugin-escompat\n```\n\n## Usage for Flat Configs (eslint.config.js) - ESLint \u003e= 8\n\n```js\n// eslint.config.js\n\nimport globals from 'globals';\nimport escompat from 'eslint-plugin-escompat';\n\nexport default [\n    {\n        plugins: {\n            escompat\n        },\n        languageOptions: {\n            globals: globals.browser\n        },\n        rules: {\n            // Configure the individual `\"escompat/*\"` rules, e.g.:\n            'escompat/no-async-generator': ['error'],\n            'escompat/no-numeric-separators': ['error']\n        }\n    }\n];\n```\n\nAlternatively, you can use the `recommended` configuration which will do the\nplugins for you, with all recommended `\"escompat/*\"` rules reporting errors.\n\n```js\nimport globals from 'globals';\nimport escompat from 'eslint-plugin-escompat';\n\nexport default [\n    {\n        languageOptions: {\n            globals: globals.browser\n        }\n    },\n    escompat.configs['flat/recommended']\n];\n```\n\n\n## Usage for .eslintrc configs - ESLint \u003c 9\n\nAdd `\"escompat\"` to `.eslintrc` `\"plugins\"` section, add `\"browser\": true` to\n`\"env\"`, then configure the individual `\"escompat/*\"` rules.\n\nAlternatively, you can use the `recommended` configuration which will do this\nfor you, with the `\"escompat/*\"` rules reporting errors (as in the snippet\nabove).\n\n```js\n// .eslintrc\n{\n  \"extends\": [\"plugin:escompat/recommended\"]\n}\n```\n\n### TypeScript Users\n\nAside from the `recommended` config, there are also multiple `typescript`\nconfigs which can be used if you're using TypeScript. The TypeScript configs\nonly enable some of the rules, avoiding enabling rules for which `typescript`\nsafely transpiles down to a more compatible syntax. Extend the typescript config\nthat matches your `tsconfig.json` `target` value.\n\nFor flat configs:\n\n```js\nimport globals from 'globals';\nimport escompat from 'eslint-plugin-escompat';\n\nexport default [\n    {\n        languageOptions: {\n            globals: globals.browser\n        }\n    },\n\n    // The TypeScript configs are in array form, so we need to\n    //   spread them out here\n    ...escompat.configs['flat/typescript-2016']\n];\n```\n\nor for `.eslintrc`:\n\n```js\n{\n  \"extends\": [\"plugin:escompat/typescript-2016\"]\n}\n```\n\n## Targeting Browsers\n\n`eslint-plugin-escompat` uses the `browserslist` configuration in `package.json`\n\nIf you have a browserslist, it is safe to enable all of these rules - as any that\ndo not coincide with your chosen browsers will be turned off automatically.\n\nSee [browserslist/browserslist](https://github.com/browserslist/browserslist)\nfor configuration. Here's some examples:\n\n```js\n// Simple configuration (package.json)\n{\n  // ...\n  \"browserslist\": [\"last 1 versions\", \"not ie \u003c= 8\"],\n}\n```\n\n```js\n// Use development and production configurations (package.json)\n{\n  // ...\n  \"browserslist\": {\n    \"development\": [\"last 2 versions\"],\n    \"production\": [\"last 4 versions\"]\n  }\n}\n```\n\n:bulb: You can also define browsers in a\n[separate browserslist file](https://github.com/browserslist/browserslist#config-file)\n\n## Rules\n\n- [no-async-generator](./docs/no-async-generator.md)\n- [no-async-iteration](./docs/no-async-iteration.md)\n- [no-bigint](./docs/no-bigint.md)\n- [no-bind-operator](./docs/no-bind-operator.md)\n- [no-class-static-blocks](./docs/no-class-static-blocks.md)\n- [no-computed-public-class-fields](./docs/no-computed-public-class-fields.md)\n- [no-do-expression](./docs/no-do-expression.md)\n- [no-dynamic-imports](./docs/no-dynamic-imports.md)\n- [no-edge-destructure-bug](./docs/no-edge-destructure-bug.md)\n- [no-exponentiation-operator](./docs/no-exponentiation-operator.md)\n- [no-hashbang-comment](./docs/no-hashbang-comment.md)\n- [no-logical-assignment-operator](./docs/no-logical-assignment-operator.md)\n- [no-nullish-coalescing](./docs/no-nullish-coalescing.md)\n- [no-numeric-separators](./docs/no-numeric-separators.md)\n- [no-object-rest-spread](./docs/no-object-rest-spread.md)\n- [no-optional-catch](./docs/no-optional-catch.md)\n- [no-optional-chaining](./docs/no-optional-chaining.md)\n- [no-pipeline-operator](./docs/no-pipeline-operator.md)\n- [no-private-class-fields](./docs/no-private-class-fields.md)\n- [no-public-instance-class-fields](./docs/no-public-instance-class-fields.md)\n- [no-public-static-class-fields](./docs/no-public-static-class-fields.md)\n- [no-regexp-duplicate-named-groups](./docs/no-regexp-duplicate-named-groups.md)\n- [no-regexp-lookbehind](./docs/no-regexp-lookbehind.md)\n- [no-regexp-named-group](./docs/no-regexp-named-group.md)\n- [no-regexp-s-flag](./docs/no-regexp-s-flag.md)\n- [no-regexp-v-flag](./docs/no-regexp-v-flag.md)\n- [no-top-level-await](./docs/no-top-level-await.md)\n\n## Inspiration\n\nThis project was largely inspired by the great [eslint-plugin-compat][epc]\nlibrary.\n\n[epc]: https://github.com/amilajack/eslint-plugin-compat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithamus%2Feslint-plugin-escompat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeithamus%2Feslint-plugin-escompat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithamus%2Feslint-plugin-escompat/lists"}