@@ -8,3 +8,63 @@ This project:
88* Provides an ` eslint-config-scality ` package that can be added as a dependency
99 in other projects. That way, coding style can automatically be checked using
1010 eslint.
11+
12+ ## Prettier baseline
13+
14+ This repository also provides a ** baseline Prettier configuration** for Scality
15+ object repositories: 4-space JavaScript/TypeScript indentation, 120-character
16+ line length, single quotes, semicolons, trailing commas, and
17+ ` quoteProps: 'as-needed' ` .
18+
19+ The configuration lives in ` prettier.config.cjs ` .
20+
21+ To use it in a project:
22+
23+ 1 . Install Prettier in the project:
24+
25+ ``` sh
26+ yarn add --dev prettier
27+ # or
28+ npm install --save-dev prettier
29+ ```
30+
31+ 2 . Copy or extend the configuration:
32+
33+ ``` js
34+ // prettier.config.cjs
35+ module .exports = require (' eslint-config-scality/prettier.config.cjs' );
36+ ```
37+
38+ 3 . Add convenience scripts:
39+
40+ ``` json
41+ {
42+ "scripts" : {
43+ "format" : " prettier --write ." ,
44+ "format:check" : " prettier --check ."
45+ }
46+ }
47+ ```
48+
49+ Projects are free to override options locally (for example ` tabWidth ` or
50+ ` printWidth ` ) if they have strong legacy constraints, but this configuration
51+ is intended to be the ** default Scality baseline** for new or reformatted
52+ Node.js codebases. YAML defaults to 2-space indentation, JSON and Markdown to
53+ 4-space indentation, and Markdown prose is left un-reflowed by default
54+ (` proseWrap: 'preserve' ` ) to avoid noisy diffs in existing documentation.
55+
56+ ## Editor configuration
57+
58+ For a consistent editor experience, you can copy or adapt the ` .editorconfig `
59+ from this repository. It aligns with the ESLint and Prettier baselines:
60+
61+ - ** JS/TS** : spaces with 4-space indentation.
62+ - ** JSON/Markdown** : spaces with 4-space indentation.
63+ - ** YAML** : spaces with 2-space indentation.
64+ - ` end_of_line = lf ` , ` insert_final_newline = true ` ,
65+ ` trim_trailing_whitespace = true ` .
66+
67+ ## Contributing
68+
69+ - See ` CONTRIBUTING.md ` for contribution guidelines and coding standards.
70+ - See ` TESTING.md ` for details on running the linters and tests in this repo.
0 commit comments