Skip to content

Adopt the Guidelines 8.4 ESLint config and finish the Prettier cleanup - #6377

Open
delthas wants to merge 29 commits into
development/9.6from
improvement/CLDSRV-1076/prettier-reformat
Open

delthas wants to merge 29 commits into
development/9.6from
improvement/CLDSRV-1076/prettier-reformat

Conversation

@delthas

@delthas delthas commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

So far, cloudserver was already Prettier-formatted (the whole-repo reformat of CLDSRV-1002), but it still used the Guidelines 8.3 ESLint config through FlatCompat, with most of its rules turned off, and its lint script only covered the .js files.

It was decided to do a one-shot big bang PR to switch every repository to the same config. Here it is.

This switches to the Guidelines 8.4.0 ESLint config, which assumes Prettier and lints the tests through its mocha() helper, upgrades to ESLint 10, and fixes/reformats code until everything passes.

Please review commit by commit.

  • Some commits are just "Run eslint/prettier" generated commits, where it is exactly only that
  • The first two commits delete duplicated tests (5, one of them a whole suite left twice by a backport merge) and rename duplicate test titles (34), which the helper's no-identical-title now reports. 5 of those are tests in sibling suites declared through skip wrappers (describeSkipIfNotMultiple), which the rule can't tell apart
  • Some (a lot! of) ESLint rule overrides were unused, so this drops them without behavior changes. .js files are now linted as CommonJS (no more no-redeclare override), and the .mjs scripts, which were never linted, are linted too
  • The rules 8.4 enables are fixed one per commit. Most hits were in a hand-encoded JSON fixture (340 useless escapes in the metadata mock's raft logs), now built with JSON.stringify: the mocked response is the same
  • Some commits are string reformat / cleanup / wrapping / folding, that CLDSRV-1002 didn't finish. This could not be done by eslint/prettier, and it was checked that all strings are the same afterwards.
  • Some string reformatting showed that some spaces were missing eg "Foo." + "Bar." -> "Foo.Bar." -> oops, a space was missing all along -> fixed into "Foo. Bar." (in test titles, and in chained search queries of validateSearch.js; I also had to shorten many test titles to make them pass 120-length nicely, and two regexes and a permalink keep a max-len disable comment)
  • Broad eslint-disable-next-line comments now name their rule, or are gone when the line could just be fixed
  • The blame ignore file also lists the earlier formatting-only commits (the quoteProps reformat and the per-PR Prettier reformats)

This targets 9.6 because we have a lot of open PRs on this branch (and not so much on 9.5), so it's easier for developers to rebase on 9.6 and have a conflict there, then have them fix conflicts in their 9.7- integration branch if we merged in 9.7.

The Arsenal and backbeat PRs are at scality/Arsenal#2751 and scality/backbeat#2925

Issue: CLDSRV-1076

Each repeats a test of the same file: the 2KB user metadata MPU test, the
copy of a nonexistent object, the multiObjectDelete authorization suite
(left twice by a backport merge), a tag delete test copied into the put/get
file with a put/get title, and the NoSuchQuota test.
mocha/no-identical-title, enabled by the Guidelines 8.4 test helper, reports
them.

Issue: CLDSRV-1076
mocha/no-identical-title, enabled by the Guidelines 8.4 test helper, reports
titles repeated in the same suite. Name each test after what it checks: the
sequential versioning steps, the ON and OFF legal hold cases, the lifecycle
date formats. Tests in sibling suites declared through skip wrappers
(describeSkipIfNotMultiple) count as one suite for the rule, which cannot
follow a wrapper chosen at run time.

Issue: CLDSRV-1076
@bert-e

bert-e commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Hello delthas,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@scality scality deleted a comment from bert-e Nov 16, 2026
@bert-e

bert-e commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.36364% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.77%. Comparing base (2f64b8c) to head (e078608).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/Config.js 62.50% 6 Missing ⚠️
lib/api/apiUtils/bucket/bucketWebsite.js 50.00% 2 Missing ⚠️
lib/api/apiUtils/bucket/checkPreferredLocations.js 0.00% 2 Missing ⚠️
lib/kms/wrapper.js 0.00% 2 Missing ⚠️
lib/api/apiUtils/object/setUpCopyLocator.js 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/api/apiUtils/authorization/permissionChecks.js 98.23% <100.00%> (ø)
lib/api/apiUtils/object/coldStorage.js 100.00% <100.00%> (ø)
lib/api/apiUtils/object/locationConstraintCheck.js 100.00% <100.00%> (ø)
lib/api/apiUtils/rateLimit/config.js 100.00% <100.00%> (ø)
lib/api/bucketDeleteEncryption.js 96.25% <100.00%> (+0.04%) ⬆️
lib/api/bucketGetEncryption.js 100.00% <100.00%> (ø)
lib/api/bucketPut.js 100.00% <100.00%> (ø)
lib/api/bucketPutRateLimit.js 100.00% <100.00%> (ø)
lib/api/completeMultipartUpload.js 93.95% <100.00%> (-0.02%) ⬇️
lib/api/corsPreflight.js 93.97% <100.00%> (-0.08%) ⬇️
... and 10 more

... and 2 files with indirect coverage changes

@@                 Coverage Diff                 @@
##           development/9.6    #6377      +/-   ##
===================================================
- Coverage            90.80%   90.77%   -0.04%     
===================================================
  Files                  207      207              
  Lines                39047    39021      -26     
===================================================
- Hits                 35456    35420      -36     
- Misses                3591     3601      +10     
Flag Coverage Δ
checksums-disabled-tests 46.21% <20.00%> (-0.03%) ⬇️
file-ft-tests 75.90% <50.90%> (+0.02%) ⬆️
file-ft-tests-null-compat 76.36% <50.90%> (-0.01%) ⬇️
kmip-ft-tests 43.80% <23.63%> (+0.01%) ⬆️
mongo-v0-ft-tests 76.92% <50.90%> (+<0.01%) ⬆️
mongo-v1-ft-tests 76.93% <50.90%> (+0.01%) ⬆️
multiple-backend 44.57% <16.36%> (+0.02%) ⬆️
s3c-ft-tests-v0 71.70% <47.27%> (+<0.01%) ⬆️
s3c-ft-tests-v0-null-compat 71.76% <47.27%> (+<0.01%) ⬆️
s3c-ft-tests-v1 71.67% <47.27%> (+<0.01%) ⬆️
sur-tests 45.09% <16.36%> (+<0.01%) ⬆️
sur-tests-inflights 48.49% <16.36%> (+0.02%) ⬆️
unit 80.53% <67.27%> (+<0.01%) ⬆️
utapi-v2-tests 45.12% <20.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@delthas
delthas force-pushed the improvement/CLDSRV-1076/prettier-reformat branch from 39a925c to 7fa4cec Compare November 17, 2026 15:32
Comment thread eslint.config.mjs Resolved
@delthas
delthas force-pushed the improvement/CLDSRV-1076/prettier-reformat branch from 7fa4cec to 0c858fd Compare November 17, 2026 15:48
@delthas
delthas force-pushed the improvement/CLDSRV-1076/prettier-reformat branch from 0c858fd to f68dfb7 Compare November 17, 2026 16:01
@delthas
delthas marked this pull request as ready for review November 17, 2026 16:05
@delthas
delthas requested review from a team, benzekrimaha and francoisferrand November 17, 2026 16:07
Comment thread yarn.lock Resolved
Guidelines 8.4 exports a flat config that assumes Prettier, so spread it
instead of loading the eslintrc one through FlatCompat. The overrides of
rules that Guidelines no longer enables, or that Prettier already turns
off, are gone.

Its mocha() helper replaces the local Mocha setup for the test files: the
Mocha globals, which Guidelines no longer declares for every file, and the
exclusive and identical title checks. It needs eslint-plugin-mocha 11 or
later.

The rules 8.4 enables that still report problems here stay off for now
(no-useless-escape, max-len, no-useless-assignment, no-unassigned-vars,
preserve-caught-error): the next commits fix them one by one.

Issue: CLDSRV-1076
Nothing loads @eslint/compat or eslint-plugin-import.

Issue: CLDSRV-1076
Parsed as scripts, every top-level require of a module named like a Node
global (crypto, URL...) redeclared it, which is why no-redeclare had
builtinGlobals off. ESLint config files and the .mjs scripts stay ES
modules.

Issue: CLDSRV-1076
ecmaVersion 2021 came from the eslintrc config. In a flat config it also
limits the globals, and it rejects syntax Node supports (??=, private
fields).

Issue: CLDSRV-1076
Guidelines 8.4 supports it. The flat config needs no change; the mocha,
n and promise plugins still report under ESLint 10.

Issue: CLDSRV-1076
jsonGrants and aclOwnerID were declared only to pass undefined to the
next step, which no-unassigned-vars reports.

Issue: CLDSRV-1076
Reported by no-useless-assignment, new in ESLint 10's recommended rules.

Issue: CLDSRV-1076
Reported by preserve-caught-error, new in ESLint 10's recommended rules.

Issue: CLDSRV-1076
The template literal carried a newline and the source indentation into
the message.

Issue: CLDSRV-1076
Guidelines 8.4 enables no-useless-escape, which this repository had turned
off: 340 of its 343 reports are in this mock. Its raft logs held bucket
attributes and object metadata as JSON encoded twice by hand, inside
single-quoted strings split for the old 80-column limit, so every \" in
them is a useless escape.

Dropping the backslashes would have fixed the lint but kept a fixture
nobody can read or edit. Build the same values with JSON.stringify from
plain objects instead. The mocked response is byte-identical.

Issue: CLDSRV-1076
no-useless-escape had been off since the eslintrc config; Guidelines
enables it.

Issue: CLDSRV-1076
The rewrap of CLDSRV-1002 only covered part of the chains still wrapped for
the old 80-column limit. String values are unchanged.

Issue: CLDSRV-1076
Lay out the code around the rewrapped strings: calls whose title or
message now fits are joined, and their bodies reindented.

Issue: CLDSRV-1076
The rewrap left these pieces on the same line once Prettier joined the
calls. String values are unchanged.

Issue: CLDSRV-1076
Lay out the code around the rewrapped messages.

Issue: CLDSRV-1076
Test titles and chained search queries in tests lost a space where they
had been split for the old 80-column limit. This is the only string commit
that changes values.

Issue: CLDSRV-1076
Prettier keeps a test call on one line when its title is a single literal,
so these titles were the only way past the line limit. Most were a few
characters over: drop filler words. The permission check cases now say
"same account" / "different accounts" for the bucket owner and requester.

Issue: CLDSRV-1076
Guidelines lints max-len again. Split or extract the long strings, templates
and comments Prettier can't wrap. A permalink comment and the rateLimit test
regexes can't be split without changing where they lead or what they match:
they keep a max-len disable comment.

Issue: CLDSRV-1076
Name the migration trend once instead of building it twice.

Issue: CLDSRV-1076
The lint script only listed .js files, so the GitHub scripts and the ESLint
config were never linted (and could not be parsed as scripts). The GitHub
scripts are command-line tools: let them print.

Issue: CLDSRV-1076
Fix what the lint of the .mjs scripts reports: braces, quotes, a template
literal, and a no-console disable comment that the new override makes
unused.

Issue: CLDSRV-1076
Lay out the code eslint --fix changed.

Issue: CLDSRV-1076
yarn run prettier finds the binary without a script, and Prettier already
skips the coverage and junit directories listed in .gitignore.

Issue: CLDSRV-1076
A bare eslint-disable-next-line turns off every rule on the next line.
Fix the three lines that only hid style rules (quotes, arrow-body-style,
prefer-template), and name the rule on the others: no-param-reassign for
the metadata updates, no-sparse-arrays for a deliberately sparse array in
a test.

Issue: CLDSRV-1076
CONTRIBUTING said Prettier was only checked on changed files, and that yarn
may rewrite package.json with 2-space indentation, which yarn 1.22 doesn't.
CLAUDE.md still described the ECMAScript 2021, script-mode config with
formatting rules turned off.

Issue: CLDSRV-1076
Add the generated commits of this series, the quoteProps reformat of
Guidelines 8.3.3 and the earlier per-change Prettier reformats, all
formatting only.

Issue: CLDSRV-1076
@delthas
delthas force-pushed the improvement/CLDSRV-1076/prettier-reformat branch from f68dfb7 to e078608 Compare November 17, 2026 18:55

This branch has not been deployed

No deployments
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.

3 participants