Skip to content

Enforce strict ESLint block formatting - #185

Open
niemyjski wants to merge 3 commits into
mainfrom
feature/eslint-block-formatting
Open

niemyjski wants to merge 3 commits into
mainfrom
feature/eslint-block-formatting

Conversation

@niemyjski

@niemyjski niemyjski commented Aug 15, 2026

Copy link
Copy Markdown
Member

Enforces braces around control-flow bodies, multiline non-empty object literals and blocks, and a blank line before control statements following a block. npm run format now runs ESLint fixes before Prettier so it produces compliant code. Existing SDK behavior and public APIs are preserved; unnecessary type-formatting churn was removed.

Validation: build, lint and all 363 tests pass locally, including 17 formatting tests. All 10 GitHub checks pass on 38e1b363, including Linux/macOS/Windows builds and CodeQL. Reviewer approval is required.

Existing dependency audit findings remain: 37 total, including two critical. None affect the newly added formatter dependencies; dependency remediation is outside this formatting change.

Verification and implementation details
  • All 30 changed SDK source/test files match main structurally, including types, expressions, literals, JSX content and comments, after normalizing positions and safe single-statement control braces. No runtime dependencies or public APIs changed.
  • Object newline enforcement targets non-empty object expressions. Imports, destructuring, type literals and empty objects retain existing Prettier-compatible formatting. The original { always: true } option is not a supported rule schema.
  • Tests cover if, while, all three for forms and do, required spacing, and ESLint autofix → Prettier → ESLint stability using the repository configuration. 1tbs intentionally keeps else on the closing-brace line.
  • A regression test confirms the documented formatting command includes ESLint fixes. The actual npm run format command also corrected a fresh inline-object fixture, and the result passed ESLint.
  • The existing dependency graph is unchanged; only the Stylistic development plugin and two nested development dependencies were added.
  • Utils.test.ts grows from 855 to 1,240 lines because existing object fixtures expand. Its grouped test structure and assertions are unchanged; splitting it would add unrelated refactoring to this formatting-only migration.
  • Reproduce: npm ci, npm run build, npm run lint, npm test. Run just the policy tests with npx vitest run --project scripts.

@niemyjski
niemyjski marked this pull request as ready for review September 3, 2026 02:57
Copilot AI lite review requested due to automatic review settings September 3, 2026 02:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-22T03:09:25.813994Z 38e1b36 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The newly introduced ESLint stylistic formatting rules are incompatible with the repo’s enforced Prettier configuration/workflow, which will cause non-idempotent formatting and likely CI lint failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces stricter, ESLint-enforced formatting rules (mandatory control-flow braces, multiline block bodies, multiline non-empty object literals, and padding between consecutive block-like statements) across the Exceptionless JavaScript SDK monorepo, and reformats existing source/tests accordingly without intended behavioral or public API changes.

Changes:

  • Add @stylistic/eslint-plugin and new ESLint rules to enforce consistent block/object formatting.
  • Add a new Vitest project plus a scripts/ test that validates the ESLint rule behavior.
  • Reformat SDK source and test files across packages (core/browser/node/react/react-native/angularjs) to comply with the new rules.
File summaries
File Description
vitest.config.ts Adds a dedicated Vitest “scripts” project to discover .mjs tests under scripts/.
scripts/eslint-rules.test.mjs Adds rule-level tests that lint fixture snippets and assert expected ESLint rule IDs.
eslint.config.mjs Adds @stylistic plugin plus formatting rules; adds a scripts/**/*.mjs config block.
package.json Adds @stylistic/eslint-plugin devDependency.
package-lock.json Locks @stylistic/eslint-plugin and its transitive dev dependencies.
packages/react/src/ExceptionlessErrorBoundary.tsx Formatting-only updates to object literals.
packages/react-native/src/ExceptionlessErrorBoundary.tsx Formatting-only updates to object literals.
packages/react-native/src/logging/CallbackLog.ts Formatting-only updates to object literal construction.
packages/node/src/storage/NodeDirectoryStorage.ts Formatting-only updates to mkdirSync options object literal.
packages/core/src/ExceptionlessClient.ts Formatting-only updates to object literal construction/arguments.
packages/core/src/EventBuilder.ts Formatting-only updates to inline object literal creation.
packages/core/src/Utils.ts Formatting-only updates to type guards, casts, and wrapped expressions.
packages/core/src/storage/InMemoryStorage.ts Formatting-only updates to control-flow braces.
packages/core/src/queue/DefaultEventQueue.ts Formatting-only updates to block braces and object literal construction.
packages/core/src/plugins/EventPluginContext.ts Formatting-only updates to control-flow braces.
packages/core/src/plugins/default/DuplicateCheckerPlugin.ts Formatting-only updates (including padding line insertion).
packages/browser/src/plugins/BrowserGlobalHandlerPlugin.ts Formatting-only updates to function/type formatting and callback shape.
packages/browser/src/plugins/BrowserErrorPlugin.ts Formatting-only updates to object literal push.
packages/angularjs/src/index.ts Formatting-only updates to function signature wrapping and casts.
packages/react-native/test/storage/AsyncStorageProvider.test.ts Formatting-only updates to inline type/object formatting.
packages/react-native/test/ReactNativeExceptionlessClient.test.ts Formatting-only updates to defineProperty options objects.
packages/react-native/test/plugins/ReactNativeLifeCyclePlugin.test.ts Formatting-only updates to startup call objects and defineProperty options.
packages/react-native/test/plugins/ReactNativeGlobalHandlerPlugin.test.ts Formatting-only updates to startup call objects, errors, and defineProperty options.
packages/react-native/test/plugins/ReactNativeErrorPlugin.test.ts Formatting-only updates to EventPluginContext construction formatting.
packages/react-native/test/plugins/ReactNativeEnvironmentInfoPlugin.test.ts Formatting-only updates to defineProperty options and object literals.
packages/react-native/test/plugins/NativeCrashPlugin.test.ts Formatting-only updates to startup call objects and defineProperty options.
packages/react-native/test/logging/CallbackLog.test.ts Formatting-only updates to inline mocked logger object literals.
packages/node/test/storage/NodeDirectoryStorage.test.ts Formatting-only updates to fs call options objects.
packages/core/test/Utils.test.ts Formatting-only updates to many test literals/arrays/maps and wrapped calls.
packages/core/test/submission/TestSubmissionClient.test.ts Formatting-only updates to event arrays and request option objects.
packages/core/test/queue/DefaultEventQueue.test.ts Formatting-only updates to event object literals and wrapped assertions.
packages/core/test/plugins/default/EventExclusionPlugin.test.ts Formatting-only updates to event/context object construction and settings objects.
packages/core/test/plugins/default/ConfigurationDefaultsPlugin.test.ts Formatting-only updates to event and expected object literals.
packages/core/test/DocumentationExamples.test.ts Formatting-only updates to expected object literals.
packages/core/test/configuration/Configuration.test.ts Formatting-only updates to server settings object literal.
packages/browser/test/plugins/BrowserIgnoreExtensionErrorsPlugin.test.ts Formatting-only updates to EventPluginContext construction formatting.
packages/browser/test/plugins/BrowserErrorPlugin.test.ts Formatting-only updates to Error options object literal.
Review details
  • Files reviewed: 37/38 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread eslint.config.mjs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6d9e8db23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread eslint.config.mjs
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