From 8d04c2f62b90ac68241a5960fbac5d2a0fead7ad Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Mon, 9 Mar 2026 16:44:16 +0100 Subject: [PATCH 1/4] Add shared Prettier baseline config. Issue: GDL-12 --- prettier.config.cjs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 prettier.config.cjs diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 index 0000000..bcf3695 --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,26 @@ +module.exports = { + tabWidth: 4, + useTabs: false, + printWidth: 120, + singleQuote: true, + quoteProps: 'as-needed', + semi: true, + trailingComma: 'all', + arrowParens: 'avoid', + bracketSpacing: true, + endOfLine: 'lf', + overrides: [ + { + files: ['*.yml', '*.yaml'], + options: { + tabWidth: 2, + }, + }, + { + files: ['*.md'], + options: { + proseWrap: 'preserve', + }, + }, + ], +}; From 42e7c530c4516de050553c30ac9a755627a355f1 Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Mon, 9 Mar 2026 16:44:17 +0100 Subject: [PATCH 2/4] Add editorconfig aligned with shared formatting baseline. This commit defines line ending/newline defaults and per-file indentation rules so local editors match the shared Prettier policy across JS/TS, JSON, YAML, Markdown, and Makefiles. Issue: GDL-12 --- .editorconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d39a796 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.{js,jsx,cjs,mjs,ts,tsx}] +max_line_length = 120 + +[*.{yml,yaml}] +indent_size = 2 + +[{Makefile,*.go,go.*}] +indent_style = tab + From b837e22bbf4565561778e8a200a9632d917639bc Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Mon, 9 Mar 2026 16:44:17 +0100 Subject: [PATCH 3/4] Document how to consume the shared formatting baseline. This commit upldate the documentation to explain the new Prettier baseline, recommended adoption steps, and editor alignment so downstream repositories can import and apply the config consistently. Issue: GDL-12 --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/README.md b/README.md index a047e81..5a0bb48 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,52 @@ This project: * Provides an `eslint-config-scality` package that can be added as a dependency in other projects. That way, coding style can automatically be checked using eslint. + +## Prettier baseline + +This repository also provides a **baseline Prettier configuration** for Scality +object repositories: 4-space JavaScript/TypeScript indentation, 120-character +line length, single quotes, semicolons, trailing commas, and +`quoteProps: 'as-needed'`. + +The configuration lives in `prettier.config.cjs`. + +To use it in a project: + +1. Install Prettier in the project: + + ```sh + yarn add --dev prettier + # or + npm install --save-dev prettier + ``` + +2. Copy or extend the configuration: + + ```js + // prettier.config.cjs + module.exports = require('eslint-config-scality/prettier.config.cjs'); + ``` + +3. Add convenience scripts: + + ```json + { + "scripts": { + "format": "prettier --write .", + "format:check": "prettier --check ." + } + } + ``` + +Projects may override options locally (for example `tabWidth` or +`printWidth`) if they have strong legacy constraints, but this configuration +is intended to be the **default Scality baseline** for new or reformatted +Node.js codebases. YAML/JSON/Markdown files default to a 2-space indentation +and Markdown prose is left un-reflowed by default (`proseWrap: 'preserve'`), +to avoid noisy diffs in existing documentation. + +## Contributing + +- See `CONTRIBUTING.md` for contribution guidelines and coding standards. +- See `TESTING.md` for details on running the linters and tests in this repo. From 84380fdd3e525762ab218d6a096b8ddc1ab54d25 Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Mon, 16 Mar 2026 09:18:36 +0100 Subject: [PATCH 4/4] Bump to 8.2.2 Issue: GDL-12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0fa47d9..ee33d25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-scality", - "version": "8.2.1", + "version": "8.2.2", "description": "ESLint config for Scality's Node.js coding guidelines", "bin": { "mdlint": "./bin/mdlint.js"