Skip to content

chore: replace eslint-config-airbnb with eslint:recommended#1299

Merged
joker23 merged 3 commits into
mainfrom
skz/sdk-2219/eslint-config
Apr 21, 2026
Merged

chore: replace eslint-config-airbnb with eslint:recommended#1299
joker23 merged 3 commits into
mainfrom
skz/sdk-2219/eslint-config

Conversation

@joker23

@joker23 joker23 commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace unmaintained eslint-config-airbnb-base (v15, last published 2022) and eslint-config-airbnb-typescript (archived May 2025) with eslint:recommended + @typescript-eslint/recommended
  • Add explicit rules for eqeqeq, prefer-const, no-var, and no-restricted-syntax (drops ForOfStatement ban since ES2020 target makes it irrelevant)
  • Remove airbnb deps from all 36 package.json devDependencies
  • Fix pre-existing parsing errors via ignorePatterns, tsconfigRootDir, and standalone svelte tsconfig.eslint.json

What changed in .eslintrc.js

  • extends: airbnb-base + airbnb-typescript/base -> eslint:recommended + @typescript-eslint/recommended
  • plugins: Added import (was loaded implicitly by airbnb)
  • Disabled noisy rules: no-explicit-any, ban-ts-comment, ban-types, no-var-requires, no-this-alias, no-non-null-asserted-optional-chain
  • import/extensions: Turned off (was masked by airbnb-typescript override for TS files)
  • valid-typeof: Turned off for now (re-enabled in a follow-up PR with bug fixes)
  • ignorePatterns: Added electron/example, svelte/.svelte-kit, server-ai/examples
  • parserOptions: Added tsconfigRootDir: __dirname and svelte tsconfig to project array

Test plan

  • yarn workspaces foreach -p run lint passes with 0 errors
  • No functional code changes (config and dependency removal only)
  • Existing stale eslint-disable comments are harmless (cleaned up in follow-up PR)

🤖 Generated with Claude Code


Note

Medium Risk
Touches repo-wide lint/TS parsing configuration and removes shared ESLint presets across many workspaces, which may cause new/changed lint failures in CI even though runtime code is unchanged.

Overview
Swaps the root ESLint baseline from Airbnb TypeScript presets to eslint:recommended + @typescript-eslint/recommended, adds the missing import plugin explicitly, and tweaks/overrides several rules (e.g., enforcing eqeqeq/no-var, relaxing several TypeScript strictness rules, and disabling import/extensions and import/export).

Updates ESLint parsing inputs by expanding parserOptions.project (including a dedicated Svelte tsconfig.eslint.json and setting tsconfigRootDir), broadens tsconfig.eslint.json to include *.tsx, and adds new ignorePatterns for additional generated/example directories. Removes eslint-config-airbnb-base and eslint-config-airbnb-typescript from devDependencies across the monorepo.

Reviewed by Cursor Bugbot for commit 3ee1a8f. Bugbot is set up for automated code reviews on this repo. Configure here.

Replace unmaintained eslint-config-airbnb-base (last published 2022) and
eslint-config-airbnb-typescript (archived May 2025) with eslint:recommended
+ @typescript-eslint/recommended + explicit rules for eqeqeq, prefer-const,
no-var, and no-restricted-syntax (minus ForOfStatement).

- Remove eslint-config-airbnb-base and eslint-config-airbnb-typescript from
  all 36 package.json devDependencies
- Add 'import' to plugins (was loaded implicitly by airbnb)
- Disable noisy @typescript-eslint/recommended rules the codebase is not
  ready for (no-explicit-any, ban-ts-comment, ban-types, etc.)
- Turn off import/extensions (was masked by airbnb-typescript override)
- Fix ESLint parsing errors by adding ignorePatterns for example dirs,
  setting tsconfigRootDir, and making svelte tsconfig.eslint.json standalone
- Add .tsx to tsconfig.eslint.json include pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25623 bytes
Compressed size limit: 29000
Uncompressed size: 125843 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31722 bytes
Compressed size limit: 34000
Uncompressed size: 113100 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 37607 bytes
Compressed size limit: 38000
Uncompressed size: 207149 bytes

- Turn off import/export rule (doesn't understand TypeScript re-export
  shadowing in combined-browser and react SDKs)
- Remove broad **/server-ai/examples/** ignorePattern that prevented CI
  from linting examples
- Create tsconfig.eslint.json for 6 server-ai examples that were missing
  them (chat-judge, direct-judge, agent-graph-traversal, chat-observability,
  openai-observability, tracked-chat)
- Add server-ai example tsconfigs to parserOptions.project glob

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179269 bytes
Compressed size limit: 200000
Uncompressed size: 830289 bytes

Revert the tsconfig.eslint.json additions for server-ai examples. Instead,
ignore the two examples (chat-judge, direct-judge) that were already broken
on main due to missing tsconfig.eslint.json files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -1,5 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for an existing issue

Comment thread .eslintrc.js
'import/default': 'error',
'import/export': 'error',
'import/extensions': ['error', 'never', { json: 'always' }],
'import/export': 'off',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were more or less the overrides that the eslint-config-airbnb-typescript applied. So the original rules were not doing anything anyway.

They were turned off because typescript already does validation and these issues would manifest in compilation issues

Comment thread .eslintrc.js
parserOptions: {
project: './tsconfig.eslint.json',
project: [
'./packages/sdk/svelte/tsconfig.eslint.json',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, svelte has a generated tsconfig that breaks the base eslint config (this was an existing issue that got masked) so we have a standalone config that does not rely on the generated files

Comment thread .eslintrc.js
],
rules: {
'@typescript-eslint/lines-between-class-members': 'off',
'eqeqeq': ['error', 'always', { null: 'ignore' }],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of these rules are the same ones that are preconfigured by the airbnb package base

Comment thread .eslintrc.js
'eqeqeq': ['error', 'always', { null: 'ignore' }],
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'no-var': 'error',
'valid-typeof': 'off',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be re-enabled in #1301 ... this was somehow missed for a while

Comment thread .eslintrc.js
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'no-var': 'error',
'valid-typeof': 'off',
'no-restricted-syntax': [

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same as the airbnb base, but without the ban on for...of, the other syntax bans seem reasonable

Comment thread .eslintrc.js
Comment on lines +37 to +42
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/no-this-alias': 'off',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rules are "new" rules that the old airbnb rules did not capture... turning them off for now since we have too many violations (and I have not assess them yet, but some of them definitely seem like rules we should have)

@joker23 joker23 marked this pull request as ready for review April 21, 2026 16:13
@joker23 joker23 requested a review from a team as a code owner April 21, 2026 16:13

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@joker23 joker23 merged commit be5cd04 into main Apr 21, 2026
47 checks passed
@joker23 joker23 deleted the skz/sdk-2219/eslint-config branch April 21, 2026 16:52
joker23 added a commit that referenced this pull request Apr 21, 2026
## Summary
- Remove ~65 stale `eslint-disable` comments for rules that no longer
exist after replacing airbnb config
- Rules removed: `no-param-reassign` (43), `no-bitwise` (10),
`no-restricted-syntax` for ForOfStatement (11), `no-plusplus` (4),
`no-continue` (1)
- Retains a targeted `no-restricted-syntax` disable in vendor
`TraceKit.ts` for a legitimate `for...in` loop

## Test plan
- [ ] `yarn workspaces foreach -p run lint` passes with 0 errors
- [ ] No functional code changes (comment removal only)
- [ ] `grep -rn
"eslint-disable.*no-(param-reassign|bitwise|plusplus|continue)"
packages/` returns zero results

Depends on #1299.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Primarily removes lint suppression comments with no runtime behavior
changes; minor risk is limited to new `no-param-reassign` enforcement
surfacing previously ignored lint violations.
> 
> **Overview**
> Cleans up stale `eslint-disable` directives across SDKs/tests
(bitwise, plusplus, restricted-syntax, etc.) after the eslint config
change, leaving code behavior unchanged.
> 
> Updates `.eslintrc.js` to explicitly enforce `no-param-reassign`, and
keeps a single targeted `no-restricted-syntax` suppression in vendor
`TraceKit.ts` for a necessary `for...in` loop.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7695809. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
joker23 added a commit that referenced this pull request Apr 21, 2026
## Summary
- Fix `typeof x !== undefined` (always true) to `typeof x !==
'undefined'` (correct) in 5 locations
- `isDocument()` and `isWindow()` now correctly return `false` in
service worker contexts
- `getCrypto()` now correctly throws when crypto API is unavailable
- `randomUuidV4()` now correctly falls back when `crypto.randomUUID` is
missing
- Re-enables the `valid-typeof` ESLint rule to prevent this class of bug

## Context
These bugs were introduced in Sept-Oct 2024. Since `typeof` always
returns a string, comparing against the value `undefined` (not the
string `'undefined'`) made these checks always truthy. The bug was
masked because the previous ESLint config did not flag this pattern.

## Affected files
- `packages/sdk/browser/src/BrowserApi.ts` (3 locations)
- `packages/sdk/browser/src/platform/randomUuidV4.ts` (1 location)
- `packages/telemetry/browser-telemetry/src/randomUuidV4.ts` (1
location)

## Test plan
- [ ] `yarn workspaces foreach -p run lint` passes with 0 errors
- [ ] `yarn workspace @launchdarkly/js-client-sdk test` passes
- [ ] `yarn workspace @launchdarkly/browser-telemetry test` passes

Depends on #1299.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Fixes environment/crypto detection and UUID generation fallback logic
in browser-facing SDK code; while small, it can change behavior in
non-browser contexts (service workers/SSR) and affects ID generation
paths.
> 
> **Overview**
> Corrects several invalid `typeof x !== undefined` checks to `typeof x
!== 'undefined'` in the browser SDK and browser telemetry UUID helper,
so non-browser contexts no longer incorrectly treat `document`,
`window`, or `crypto` as available.
> 
> Re-enables ESLint `valid-typeof` to prevent regressions, and adds Jest
coverage to ensure `isDocument`/`isWindow` return `false` when globals
are missing and `randomUuidV4` properly falls back when
`crypto.randomUUID` is unavailable.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
074d3f3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants