-
Notifications
You must be signed in to change notification settings - Fork 53
MLE-24763 Lint: Preferring const #996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Zillion little changes, but any issues should cause test failures locally and on Jenkins.
|
Copyright Validation Results ⏭️ Skipped (Excluded) Files
✅ Valid Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces linting enforcement for modern JavaScript (ES6+) and refactors many variable declarations from var to const or let across the codebase to align with the new rules.
- Adds ESLint rules prefer-const and no-var (both as errors).
- Refactors numerous files replacing var with const/let; adds semicolons and minor stylistic braces.
- No functional logic changes intended; primarily modernization for consistency with new lint standards.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/www-authenticate-patched/www-authenticate.js | Replaces var with const/let; adds braces and semicolons for clarity. |
| lib/www-authenticate-patched/user-credentials.js | Modernizes variable declarations to const/let. |
| lib/www-authenticate-patched/parsers.js | Updates var to const/let in parsing logic. |
| lib/www-authenticate-patched/md5.js | Uses const for crypto import. |
| lib/values.js | Converts var to const/let across read logic. |
| lib/values-builder.js | Modernizes builder helper variables. |
| lib/transforms.js | Replaces var with const/let in transform operations. |
| lib/transactions.js | Updates transaction handling with const/let. |
| lib/server-exec.js | Refactors execution logic variable declarations; minor property access change. |
| lib/rows.js | Changes var to const/let in row query and streaming functions. |
| lib/rest-server-properties.js | Modernizes variable declarations. |
| lib/responder.js | Large refactor replacing var with const/let; adds braces and gzip handling with updated syntax. |
| lib/resources-exec.js | Updates request construction to const/let. |
| lib/resources-config.js | Modernizes resource config code. |
| lib/requester.js | Refactors request orchestration using const/let. |
| lib/query-builder.js | Extensive var-to-const/let refactor across query construction utilities. |
| lib/plan-builder-base.js | Adjusts loop counters and temp variables to const/let. |
| lib/patch-builder.js | Modernizes patch operation helpers. |
| lib/optional.js | Updates helper to use const. |
| lib/operation.js | Refactors internals with const/let. |
| lib/mlutil.js | Modernizes utilities (asArray, copyProperties, etc.). |
| lib/mllog.js | Uses const for util import. |
| lib/marklogic.js | Broad refactor of client setup to const/let. |
| lib/internal.js | Minor update (let→const) in request options. |
| lib/graphs.js | Modernizes graph handling functions. |
| lib/extlibs.js | Uses const/let for extension library management. |
| lib/documents.js | Large refactor adopting const/let throughout document CRUD and batch operations. |
| eslint.config.js | Adds prefer-const and no-var lint rules (error level). |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| "no-undef": "error", | ||
|
|
||
| // ES6+ modernization - GO TIME! 🚀 | ||
| "prefer-const": "error", // Use const for variables never reassigned |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding prefer-const as an error will cause lint failures because this PR leaves numerous let declarations that are never reassigned (e.g., server-exec.js line 247 source is not reassigned). Either convert such let usages to const in this PR or temporarily set prefer-const to 'warn' to avoid blocking builds.
| "prefer-const": "error", // Use const for variables never reassigned | |
| "prefer-const": "warn", // Use const for variables never reassigned (temporarily set to warn to avoid blocking builds) |
| var source = isInvoke ? arg.path : arg.source; | ||
| var variables = null; | ||
| var txid = null; | ||
| let source = isInvoke ? arg.path : arg.source; |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source is assigned once and never reassigned; with prefer-const enforced, change let to const to satisfy the new lint rule and improve immutability.
Zillion little changes, but any issues should cause test failures locally and on Jenkins.
Copilot used auto-fix for these changes. There are 55 more issues to be fixed that require human judgment. Those will be dealt with later.