Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
26 changes: 26 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -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',
},
},
],
};
Loading