{"id":31101536,"url":"https://github.com/3ru/eslint-plugin-baseline-js","last_synced_at":"2026-03-03T09:04:17.162Z","repository":{"id":313829423,"uuid":"1052654174","full_name":"3ru/eslint-plugin-baseline-js","owner":"3ru","description":"✅ ESLint plugin to enforce the JavaScript Baseline.","archived":false,"fork":false,"pushed_at":"2025-11-22T01:05:45.000Z","size":2113,"stargazers_count":172,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-22T02:34:49.143Z","etag":null,"topics":["baseline","browser-support","eslint","eslint-plugin","javascript"],"latest_commit_sha":null,"homepage":"https://baselinejs.vercel.app/","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/3ru.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T11:08:40.000Z","updated_at":"2025-11-22T02:14:15.000Z","dependencies_parsed_at":"2025-09-09T02:52:54.370Z","dependency_job_id":"e6c05d5c-a8b0-42a4-81ad-1b94bd70b339","html_url":"https://github.com/3ru/eslint-plugin-baseline-js","commit_stats":null,"previous_names":["3ru/eslint-plugin-baseline-js"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/3ru/eslint-plugin-baseline-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-plugin-baseline-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-plugin-baseline-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-plugin-baseline-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-plugin-baseline-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3ru","download_url":"https://codeload.github.com/3ru/eslint-plugin-baseline-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-plugin-baseline-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"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":["baseline","browser-support","eslint","eslint-plugin","javascript"],"created_at":"2025-09-17T00:01:59.774Z","updated_at":"2026-03-03T09:04:17.154Z","avatar_url":"https://github.com/3ru.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n# eslint-plugin-baseline-js\n\n![baseline](./docs/website/public/lp.png)\n\nEnforce the JavaScript Baseline (`widely` / `newly` / `year`) with a single ESLint rule powered by web‑features.\nThis plugin delegates detection to eslint-plugin-es-x and ESLint core (plus a few small gap‑filling rules) and reports with one consistent Baseline message.\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![JSDocs][jsdocs-src]][jsdocs-href]\n[![License][license-src]][license-href]\n[![CI](https://github.com/3ru/eslint-plugin-baseline-js/actions/workflows/ci.yml/badge.svg)](https://github.com/3ru/eslint-plugin-baseline-js/actions/workflows/ci.yml)\n\n\u003c/div\u003e\n\n\u003e [!NOTE]\n\u003e This project hasn’t reached a major release yet, so behavior and options may change. Please feel free to report false negatives/positives and any rough edges as [issues](https://github.com/3ru/eslint-plugin-baseline-js/issues).\n\n## Install\n\n- npm: `npm i -D eslint-plugin-baseline-js`\n- pnpm: `pnpm add -D eslint-plugin-baseline-js`\n- yarn: `yarn add -D eslint-plugin-baseline-js`\n\nRecommended\n- ESLint \u003e= 8.57 (Flat Config)\n\n## Quick Start (Flat Config)\n\n```js\n// eslint.config.js\nimport baselineJs from \"eslint-plugin-baseline-js\";\n\nexport default [\n  {\n    files: [\"**/*.{js,ts,jsx,tsx}\"],\n    plugins: { \"baseline-js\": baselineJs },\n    rules: {\n      // Allow only \"widely available\" Baseline features\n      \"baseline-js/use-baseline\": [\"error\", { available: \"widely\" }],\n    },\n  },\n];\n```\n\n## Preset Configs\n\nThis plugin ships Flat Config presets you can call from `configs`:\n\n```js\nimport baselineJs from \"eslint-plugin-baseline-js\";\n\nexport default [\n  // Register the plugin once (required for Flat Config)\n  { plugins: { \"baseline-js\": baselineJs } },\n\n  // Recommended: enables Web APIs \u0026 JS builtins detection with `preset: 'auto'`.\n  // Level defaults to 'error'; pass level to change severity\n  baselineJs.configs.recommended({ available: \"widely\", level: \"warn\" }),\n\n  // TypeScript-aware: requires type info for instance-member checks (`preset: 'type-aware'`).\n  // Works best with @typescript-eslint/parser and a proper tsconfig.\n  // baselineJs.configs[\"recommended-ts\"]({ available: \"widely\", level: \"error\" }),\n];\n```\n\nNote on plugin key\n- Presets assume the plugin is registered under the key `\"baseline-js\"`.\n\nSee more real-world configs in [`examples/`](https://github.com/3ru/eslint-plugin-baseline-js/tree/main/examples)\n\n## Common Configurations\n\n```js\n// Newly available (more permissive)\n'baseline-js/use-baseline': ['warn', { available: 'newly' }];\n\n// Year-based – allow features that became Baseline in or before 2020\n'baseline-js/use-baseline': ['error', { available: 2020 }];\n\n// Ignore knobs for pragmatic adoption\n'baseline-js/use-baseline': [\n  'error',\n  {\n    available: 2018,\n    // Skip specific web-features by ID (or regex as '/.../')\n    ignoreFeatures: ['nullish-coalescing', '/^optional-/'],\n    // Skip reports produced on certain ESTree node types\n    ignoreNodeTypes: ['WithStatement', '/Expression$/'],\n  },\n];\n\n// Turn off in tests or generated folders (ESLint standard overrides)\nexport default [\n  { /* project defaults ... */ },\n  {\n    files: ['**/*.test.*', 'coverage/**'],\n    rules: { 'baseline-js/use-baseline': 'off' },\n  },\n];\n```\n\n## What Gets Reported?\n\n\u003e Features from web‑features (group: `\"javascript\"`) that exceed your configured Baseline.\n\n| Baseline setting | Reports when...                     |\n| ---------------- | ----------------------------------- |\n| `\"widely\"`       | the feature is not in Baseline “high” |\n| `\"newly\"`        | the feature is marked as limited (`false`) |\n| `year` (number)  | the feature’s Baseline year is greater than `year` |\n\n\n### Demo\n\u003cimg width=\"963\" height=\"192\" alt=\"getYear is deprecated\" src=\"https://github.com/user-attachments/assets/e04e4a5c-c104-4945-96d6-889a47b7bcde\" /\u003e\n\n\n## How It Works\n\n1. Data → `scripts/data/build-features.mjs`\n   - Extracts the minimal JavaScript subset from [`web‑features`](https://github.com/web-platform-dx/web-features) into `src/baseline/data/features.javascript.ts`.\n2. Mapping → `src/baseline/mapping/syntax.ts`\n   - Maps web‑features IDs to underlying rules (prefer `eslint-plugin-es-x` / ESLint core; custom rules only when necessary).\n3. Resolution → `src/baseline/resolve.ts`\n   - Classifies “beyond baseline” by bucket (`high/low/false → widely/newly/limited`) or year.\n\n## Coverage\n\nWe publish a generated coverage report that lists all JavaScript features from web‑features\nand shows which ones are currently mapped by this plugin.\n\n- Report: [docs/coverage.md](docs/coverage.md)\n- Regenerate locally: `pnpm gen:coverage`\n  - Generator: `scripts/coverage/generate-coverage.mjs`\n\n## Options (rule)\n\n| Option                 | Type                      | Default    | Description |\n| ---------------------- | ------------------------- | ---------- | ----------- |\n| `baseline`             | `widely`, `newly`, `number`, `widely` | Baseline level or year (alias: `available`). |\n| `ignoreFeatures`       | `string[]`                | —          | Skip specific web‑features by ID (supports regex `/.../`) across syntax delegates and Web API/JS builtin detection. |\n| `ignoreNodeTypes`      | `string[]`                | —          | Suppress reports by ESTree `node.type` (supports regex `/.../`). |\n\n## Baseline for HTML, CSS, and React\n\nBaseline works best when HTML, CSS, JS, and React all align. For markup, styles, and React, enable the \"use-baseline\" rules from these ESLint plugins:\n\n- ESLint for CSS: https://github.com/eslint/css\n- HTML ESLint (HTML): https://github.com/yeonjuan/html-eslint\n- HTML ESLint (React): https://github.com/yeonjuan/html-eslint/tree/main/packages/eslint-plugin-react\n\n\n## Branding Note (Baseline)\n\nThe Baseline name and logos are Google trademarks. Logo assets are licensed under CC BY‑ND 4.0. If you use Baseline logos alongside this plugin, please follow the [official guidelines](https://web-platform-dx.github.io/web-features/name-and-logo-usage-guidelines/) and do not imply sponsorship, affiliation, or endorsement by Google. We embed the official Baseline icons via their published URLs (unmodified).\n\n## License\n\nMIT\n\n\n[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-baseline-js?style=flat\u0026colorA=080f12\u0026colorB=1ea446\n[npm-version-href]: https://npmjs.com/package/eslint-plugin-baseline-js\n[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-baseline-js?style=flat\u0026colorA=080f12\u0026colorB=1ea446\n[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-baseline-js\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/eslint-plugin-baseline-js?style=flat\u0026colorA=080f12\u0026colorB=1ea446\u0026label=minzip\n[bundle-href]: https://bundlephobia.com/result?p=eslint-plugin-baseline-js\n[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat\u0026colorA=080f12\u0026colorB=1ea446\n[jsdocs-href]: https://www.jsdocs.io/package/eslint-plugin-baseline-js\n[license-src]: https://img.shields.io/github/license/3ru/eslint-plugin-baseline-js.svg?style=flat\u0026colorA=080f12\u0026colorB=1ea446\n[license-href]: https://github.com/3ru/eslint-plugin-baseline-js/blob/main/LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3ru%2Feslint-plugin-baseline-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3ru%2Feslint-plugin-baseline-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3ru%2Feslint-plugin-baseline-js/lists"}