Skip to content

Commit 1b6f06f

Browse files
committed
feat: add Prettier for consistent code formatting
- Add Prettier and eslint-config-prettier dependencies - Configure Prettier with single quotes and 120-char line width - Add format and check-format npm scripts - Create .prettierignore to exclude build outputs and binaries - Add .editorconfig for consistent IDE settings across team Issue: CLDSRV-723
1 parent 0048de2 commit 1b6f06f

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{js,mjs,json}]
12+
indent_size = 4
13+
14+
[*.{md,yml,yaml}]
15+
indent_size = 2
16+
trim_trailing_whitespace = false
17+
18+
[package.json]
19+
indent_size = 2

.prettierignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Build outputs
2+
node_modules/
3+
dist/
4+
build/
5+
coverage/
6+
7+
# Configuration files that should maintain their format
8+
package-lock.json
9+
yarn.lock
10+
*.log
11+
12+
# Data directories
13+
localData/
14+
localMetadata/
15+
16+
# Test artifacts
17+
artifacts/
18+
**/junit/
19+
20+
# Binary files
21+
*.png
22+
*.jpg
23+
*.jpeg
24+
*.gif
25+
*.ico
26+
*.svg
27+
*.pdf
28+
29+
# Generated or vendor files
30+
*.min.js
31+
*.min.css
32+
*.map

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"trailingComma": "es5",
7+
"bracketSpacing": true,
8+
"arrowParens": "avoid",
9+
"printWidth": 120,
10+
"endOfLine": "lf",
11+
"bracketSameLine": false,
12+
"singleAttributePerLine": false
13+
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
"@eslint/compat": "^1.2.2",
5757
"@scality/eslint-config-scality": "scality/Guidelines#8.3.0",
5858
"eslint": "^9.14.0",
59+
"eslint-config-prettier": "^9.1.0",
5960
"eslint-plugin-import": "^2.31.0",
6061
"eslint-plugin-mocha": "^10.5.0",
62+
"prettier": "^3.3.3",
6163
"express": "^4.21.1",
6264
"ioredis": "^5.4.1",
6365
"istanbul": "^0.4.5",
@@ -106,6 +108,8 @@
106108
107109
"lint": "eslint $(git ls-files '*.js')",
108110
"lint_md": "mdlint $(git ls-files '*.md')",
111+
"format": "prettier --write $(git ls-files '*.js' '*.mjs' '*.json' '*.md' '*.yml' '*.yaml')",
112+
"check-format": "prettier --check $(git ls-files '*.js' '*.mjs' '*.json' '*.md' '*.yml' '*.yaml')",
109113
"mem_backend": "S3BACKEND=mem node index.js",
110114
"start": "npm-run-all --parallel start_dmd start_s3server",
111115
"start_mongo": "yarn run cloudserver",

0 commit comments

Comments
 (0)