{"id":31714742,"url":"https://github.com/3ru/eslint-baseline-compat-contrast","last_synced_at":"2026-08-03T06:30:59.855Z","repository":{"id":315743045,"uuid":"1060679267","full_name":"3ru/eslint-baseline-compat-contrast","owner":"3ru","description":"Type‑aware Baseline linting demo","archived":false,"fork":false,"pushed_at":"2025-09-20T11:24:31.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-24T15:56:13.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/3ru.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,"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-20T11:21:47.000Z","updated_at":"2025-09-20T11:25:46.000Z","dependencies_parsed_at":"2025-09-20T13:16:52.930Z","dependency_job_id":"362ccb78-ab9f-41b5-baae-10b120086633","html_url":"https://github.com/3ru/eslint-baseline-compat-contrast","commit_stats":null,"previous_names":["3ru/eslint-baseline-compat-contrast"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/3ru/eslint-baseline-compat-contrast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-baseline-compat-contrast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-baseline-compat-contrast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-baseline-compat-contrast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-baseline-compat-contrast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3ru","download_url":"https://codeload.github.com/3ru/eslint-baseline-compat-contrast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3ru%2Feslint-baseline-compat-contrast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36223792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-08-03T02:00:06.975Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-10-09T01:47:59.321Z","updated_at":"2026-08-03T06:30:59.850Z","avatar_url":"https://github.com/3ru.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Baseline vs compat — Type-aware contrast\n\nThis repo now contains two contrast scenarios that highlight where `eslint-plugin-baseline-js` outperforms the compat plugins:\n\n1. **Typed Array by copy (`src/sort.ts`)**: `arr.toSorted()` where `arr: number[]`.\n   - `eslint-plugin-baseline-js` uses TypeScript types and flags Array by copy when Baseline availability is pinned to 2022.\n   - `eslint-plugin-compat` can detect `[].toSorted()` (array literal) but generally can’t infer that an arbitrary identifier `arr` is an Array.\n2. **Pure syntax features (`src/syntax.ts`)**: optional catch binding and logical assignment.\n   - Baseline delegates to `eslint-plugin-es-x` rules (`no-optional-catch-binding`, `no-logical-assignment-operators`) and we intentionally tighten the Baseline for that one file to 2019 so these ES2020 features exceed policy.\n   - Neither compat plugin inspects syntax nodes (`CatchClause`, assignment operators, etc.), so these cases stay silent there.\n\n## Install\n```bash\nnpm i\n```\n\n## Run (baseline, type‑aware)\n```bash\nnpm run lint:baseline\n```\nExpected: errors for `src/sort.ts` (Array by copy exceeds Baseline 2022) **and** `src/syntax.ts` (ES2020 syntax exceeds the stricter per-file Baseline 2019).\n\nExample output:\n```sh\neslint-baseline-compat-contrast/src/sort.ts\n  2:5  error  Feature 'Array by copy' (array-by-copy) became Baseline in 2023 and exceeds 2022  baseline-js/use-baseline\n\neslint-baseline-compat-contrast/src/syntax.ts\n  4:5  error  Feature 'Optional catch binding' (optional-catch-binding) became Baseline in 2020 and exceeds 2019  baseline-js/use-baseline\n 13:8  error  Feature 'Logical assignments' (logical-assignments) became Baseline in 2020 and exceeds 2019  baseline-js/use-baseline\n\n✖ 3 problems (3 errors, 0 warnings)\n```\n\nIf you uncomment the literal case (`[3, 1, 2].toSorted()`), it will also be flagged under the same Baseline policy.\n\n## Run (compat)\n```bash\nnpm run lint:compat\n```\nExpected: no error for `arr.toSorted()` (identifier receiver). If you uncomment the literal case `[3, 1, 2].toSorted()`, `eslint-plugin-compat` flags that line only (the identifier case remains unflagged).\n\n- `src/syntax.ts` also passes here because `eslint-plugin-compat` does not hook into syntax delegates such as `es-x/no-optional-catch-binding`.\n\n## Run (tscompat)\n```bash\nnpm run lint:tscompat\n```\nExpected: `@koddsson/eslint-plugin-tscompat` flags `arr.toSorted()` as long as your `browserslist` targets include a browser version that predates Array by copy (for example Chrome 105 with the defaults in this repo). There is still **no report for `src/syntax.ts`**, because the published rule never inspects syntax nodes beyond member access / `new Foo()` / global `Foo()` calls.\n\nNotes after testing `tscompat` 0.2.0:\n\n- It is TypeScript-aware and can catch typed receivers (e.g. `arr.toSorted()` in this sample), but it reports concrete browser versions (`Chrome 105`) instead of Baseline “widely/newly/year” buckets.\n- Browsers to check must be configured manually via `browserslist` options; there is no Baseline threshold or “allow everything before 2023” concept.\n- The published rule only inspects property/member access, `new Foo()` and global `Foo()` calls; syntax-only features (class features, optional catch binding, logical assignment, etc.) or anything delegated to existing OSS rules in `eslint-plugin-baseline-js` stay out of scope for `tscompat`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3ru%2Feslint-baseline-compat-contrast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3ru%2Feslint-baseline-compat-contrast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3ru%2Feslint-baseline-compat-contrast/lists"}