Skip to content

chore: replace prettier with @stylistic/eslint#1315

Draft
joker23 wants to merge 7 commits intomainfrom
skz/sdk-2234/remove-prettier
Draft

chore: replace prettier with @stylistic/eslint#1315
joker23 wants to merge 7 commits intomainfrom
skz/sdk-2234/remove-prettier

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Apr 23, 2026

This PR replacees prettier with @stylistic/eslint-plugin which seems to pull in less deps and is more flexible (less opinionated). This PR is mostly done for security reasons as prettier has history of supply chain attacks.

We went with this alternative because it consolidates styling back to linting (old school eslint) and we can configure the style in the same eslint configurations which is nice. More importantly, @stylistic feels like a more secure choice:

  1. They provide provenance with their npm package (which is not the case with prettier
  2. They do not have as many downstream dependencies

NOTE There will be a separate PR stacked on this one that will address all of the style violations that are caused by the change in configuration. We are also seeing that prettier actually hid some actual potential bugs in the code.


Note

Medium Risk
Medium risk because it changes lint/style tooling and check scripts across many workspaces, which can introduce new CI failures or formatting diffs even though it does not affect runtime code paths.

Overview
Replaces the repo’s Prettier-based formatting workflow with ESLint-driven styling via @stylistic/eslint-plugin, and adds eslint-plugin-simple-import-sort for deterministic import ordering.

Removes Prettier config files (.prettierrc, .prettierignore) and drops prettier/eslint-plugin-prettier/eslint-config-prettier/prettier-plugin-sort-imports dependencies from the root and many package workspaces, updating package scripts to rely on eslint --fix (new/standardized lint:fix) and adjusting check pipelines accordingly.

Updates .eslintrc.js to include stylistic rule configuration, import-sort rules, and expanded ignore patterns (e.g. node_modules, next-env.d.ts).

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

@joker23 joker23 marked this pull request as ready for review April 23, 2026 23:02
@joker23 joker23 requested a review from a team as a code owner April 23, 2026 23:02
Comment thread .eslintrc.js

...stylisticConfig.rules,
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/operator-linebreak': ['error', 'after'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ESLint operator-linebreak rule contradicts all code changes

High Severity

The @stylistic/operator-linebreak rule is set to 'after' (operator at end of line), but every source code change in this PR moves operators to the beginning of the next line ('before' style). The stylistic.configs.customize() default for this rule is 'before', which matches the code changes — but the explicit override on this line reverses it to 'after'. This will cause lint errors across all modified files (AttributeReference.ts, ContextFilter.ts, ClientMessages.ts, EventProcessor.ts, Backoff.ts, etc.) when yarn lint is run.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7e61ebb. Configure here.

devin-ai-integration[bot]

This comment was marked as resolved.

@joker23 joker23 force-pushed the skz/sdk-2234/remove-prettier branch 2 times, most recently from 36032ca to 68e8a58 Compare April 24, 2026 15:45
"lint:fix": "yarn run lint --fix",
"check": "yarn prettier && yarn lint && yarn build && yarn test",
"lint:fix": "npx eslint . --ext .ts --fix",
"check": "yarn lint:fix && yarn lint && yarn build && yarn test",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant lint after lint:fix in check scripts

Low Severity

The check scripts across ~18 packages use the pattern yarn lint:fix && yarn lint && ..., where yarn lint is always redundant. Since eslint --fix already exits non-zero when unfixable errors remain, the && chain stops before lint ever runs. If lint:fix succeeds (exit 0), all issues were fixed and lint will trivially pass. This wastes CI time running the linter twice and obscures intent.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 68e8a58. Configure here.

@joker23 joker23 force-pushed the skz/sdk-2234/remove-prettier branch from 5b6d4f2 to ee407aa Compare April 24, 2026 17:47
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ee407aa. Configure here.

Comment thread .eslintrc.js Outdated
@@ -1,9 +1,18 @@
const stylistic = require('@stylistic/eslint-plugin');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ESM-only package used with CommonJS require() call

Medium Severity

@stylistic/eslint-plugin v4+ is ESM-only, but .eslintrc.js loads it via require('@stylistic/eslint-plugin') (CommonJS). This works on Node.js 22+ (which supports require(esm)), and CI uses Node 24, but will fail with ERR_REQUIRE_ESM for developers on Node.js 20 LTS. The Node.js project itself reverted from v4 back to v3 of this plugin due to this exact incompatibility. The project also uses ESLint v8 (^8.56.0), whereas v4 of the plugin recommends ESLint v9+ with flat config.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ee407aa. Configure here.

@joker23 joker23 marked this pull request as draft April 24, 2026 17:58
@joker23 joker23 marked this pull request as draft April 24, 2026 17:58
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 24, 2026

converting back to draft mode to wait for a few more PRs to merge, before merge conflicting everyting.

@joker23 joker23 force-pushed the skz/sdk-2234/remove-prettier branch from cd54cf6 to 5fad811 Compare April 24, 2026 19:30
@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: 25644 bytes
Compressed size limit: 29000
Uncompressed size: 125843 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: 38484 bytes
Compressed size limit: 39000
Uncompressed size: 211104 bytes

joker23 and others added 6 commits April 24, 2026 14:41
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…encies

CI uses `yarn workspaces focus` which only installs deps for the target
workspace, not root devDependencies. The new ESLint plugins must be in
each package's devDependencies for lint to resolve them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…emove stale prettier comment)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joker23 joker23 force-pushed the skz/sdk-2234/remove-prettier branch from 5fad811 to e448dfc Compare April 24, 2026 19:42
@joker23 joker23 force-pushed the skz/sdk-2234/remove-prettier branch from 25b51de to 91c8690 Compare April 24, 2026 19:51
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 24, 2026

It looks like we should wait for an upgrade to eslint 9 (which has support for esm config modules). This will be folded into typescript 6 upgrade.

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.

1 participant