Skip to content

Commit 4f6ce81

Browse files
committed
docs: update eslint config and document choices
- Set `func-style` to 'off' to allow developer flexibility - Document key ESLint configuration choices in `best-practices.md` - Enhance ESLint rules for better code quality and consistency
1 parent d19f76d commit 4f6ce81

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

docs/best-practices.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,15 @@ When adding new code to the project, follow these guidelines:
120120
5. Perform a self-review before submitting your code for review
121121

122122
Remember, the goal is to write code that is easy to understand, maintain, and extend. When in doubt, prioritize readability and simplicity over cleverness.
123+
124+
## ESLint Configuration
125+
126+
Key configuration choices:
127+
128+
- `func-style`: Off. Use the most appropriate function style for each situation.
129+
- `no-nested-ternary`: Removed. Use newlines for readability in nested ternaries.
130+
- `no-param-reassign`: Warn. Consider alternatives to parameter reassignment.
131+
- `object-shorthand`: Warn. Use concise object literal syntax when possible.
132+
- `require-await`: Warn. Ensure async functions use `await`.
133+
134+
These rules guide code quality and consistency. Use good judgment in their application.

eslint.config.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ export default [
1212
},
1313
rules: {
1414
'no-unused-vars': ['warn', { argsIgnorePattern: 'lazy' }],
15-
'no-extra-semi': 1,
15+
'no-extra-semi': 'warn',
16+
'max-len': ['warn', { 'code': 120 }],
17+
'complexity': ['warn', 15],
18+
'max-params': ['warn', 4],
19+
'no-param-reassign': 'warn',
20+
'prefer-const': 'warn',
21+
'no-var': 'error',
22+
'object-shorthand': 'warn',
23+
'prefer-template': 'warn',
24+
'func-style': ['off'],
25+
'no-else-return': 'warn',
26+
'prefer-arrow-callback': 'warn',
27+
'require-await': 'warn',
28+
'no-duplicate-imports': 'error',
1629
},
1730
}
18-
]
31+
]

0 commit comments

Comments
 (0)