chore: replace prettier with @stylistic/eslint#1315
Conversation
|
|
||
| ...stylisticConfig.rules, | ||
| '@stylistic/quotes': ['error', 'single', { avoidEscape: true }], | ||
| '@stylistic/operator-linebreak': ['error', 'after'], |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 7e61ebb. Configure here.
36032ca to
68e8a58
Compare
| "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", |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 68e8a58. Configure here.
5b6d4f2 to
ee407aa
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ 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.
| @@ -1,9 +1,18 @@ | |||
| const stylistic = require('@stylistic/eslint-plugin'); | |||
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit ee407aa. Configure here.
|
converting back to draft mode to wait for a few more PRs to merge, before merge conflicting everyting. |
cd54cf6 to
5fad811
Compare
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
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>
5fad811 to
e448dfc
Compare
25b51de to
91c8690
Compare
|
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. |


This PR replacees
prettierwith@stylistic/eslint-pluginwhich seems to pull in less deps and is more flexible (less opinionated). This PR is mostly done for security reasons asprettierhas 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,
@stylisticfeels like a more secure choice:prettierNOTE 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
prettieractually hid some actual potential bugs in the code.Note
Medium Risk
Medium risk because it changes lint/style tooling and
checkscripts 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 addseslint-plugin-simple-import-sortfor deterministic import ordering.Removes Prettier config files (
.prettierrc,.prettierignore) and dropsprettier/eslint-plugin-prettier/eslint-config-prettier/prettier-plugin-sort-importsdependencies from the root and many package workspaces, updating package scripts to rely oneslint --fix(new/standardizedlint:fix) and adjustingcheckpipelines accordingly.Updates
.eslintrc.jsto 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.