このコミットが含まれているのは:
@@ -124,7 +124,7 @@ npm run preview
|
||||
- For arrays, never put whitespace or a line break immediately before `]`.
|
||||
- Keep the first element on the same line as `[` by default.
|
||||
- If an array would exceed the line limit, break after `[` and indent
|
||||
elements by 4 spaces.
|
||||
elements 4 spaces deeper than the statement's base indentation.
|
||||
|
||||
### Ruby delimiter and wrapping rules
|
||||
|
||||
@@ -140,6 +140,12 @@ npm run preview
|
||||
99 文字を超えるなら block 形式へ切り替へるか、message 定数化などで縮める。
|
||||
- Ruby の method chain や call argument を折り返す際、call-site の `)` を
|
||||
block close のやうに独立させない。
|
||||
- Ruby の block body は、その基準位置から 2 空白深くする。
|
||||
- Ruby の wrapped expression、method argument、array element、hash pair などの
|
||||
continuation indentation は、その statement の基準位置から 4 空白深くする。
|
||||
- Ruby の continuation indentation を、行頭からの絶対空白数として扱はない。
|
||||
- 例へば class body 内の array は、class body の 2 空白を基準に、更に 4 空白
|
||||
深くするため、結果として行頭から 6 空白になる。
|
||||
|
||||
Bad:
|
||||
|
||||
@@ -225,20 +231,37 @@ records.each {
|
||||
formatting as the local reference shape: component and callback bodies use
|
||||
2-space block indentation, single-line bodies do not gain unnecessary
|
||||
braces, wrapped expressions use 4-space continuation indentation, multi-
|
||||
stage ternaries use explicit parentheses, and only complete leading runs
|
||||
of 8 spaces are compressed to tabs.
|
||||
- In TypeScript and TSX only, tabs are for leading 8-column compression only.
|
||||
stage ternaries use explicit parentheses, and TypeScript / TSX indentation
|
||||
and alignment whitespace compress every complete run of 8 spaces to tabs.
|
||||
- A tab does not represent one indentation level.
|
||||
- Do not replace 2-space or 4-space indentation with tabs.
|
||||
- First determine visible indentation using 2-space block indentation and
|
||||
4-space continuation indentation, then compress only complete leading runs
|
||||
of 8 spaces into tabs.
|
||||
- Tabs are only for leading indentation, never for spaces after non-space
|
||||
text.
|
||||
- Keep residual leading 2, 4, or 6 spaces after any tab compression.
|
||||
- In TypeScript and TSX, first determine visible indentation using 2-space
|
||||
block indentation and 4-space continuation indentation, then compress every
|
||||
complete run of 8 spaces used for indentation or column alignment to tabs.
|
||||
- In TypeScript and TSX, 8-space compression is mandatory, not optional.
|
||||
- In TypeScript and TSX, this applies both to leading indentation and to
|
||||
alignment whitespace after non-space text, such as aligned inline type
|
||||
columns.
|
||||
- In TypeScript and TSX, keep residual 2, 4, or 6 spaces after each tab
|
||||
compression.
|
||||
- In TypeScript and TSX, do not treat a tab as one logical indentation level.
|
||||
- In TypeScript and TSX, do not alter string literals, template-literal
|
||||
contents, regular expressions, or user-facing text merely to apply tab
|
||||
compression.
|
||||
- Examples: 2 columns = 2 spaces, 4 columns = 4 spaces, 6 columns = 6
|
||||
spaces, 8 columns = 1 tab, 10 columns = 1 tab + 2 spaces, 12 columns = 1
|
||||
tab + 4 spaces, 16 columns = 2 tabs.
|
||||
tab + 4 spaces, 14 columns = 1 tab + 6 spaces, 16 columns = 2 tabs.
|
||||
- When TypeScript or TSX code already uses column alignment, apply the same
|
||||
8-space compression rule to that alignment whitespace.
|
||||
- Example:
|
||||
|
||||
```ts
|
||||
type Props = {
|
||||
row: PostImportRow
|
||||
displayNumber?: number
|
||||
onEdit?: () => void
|
||||
onRetry?: () => void
|
||||
onToggleSkip?: (checked: boolean) => void }
|
||||
```
|
||||
- TypeScript and TSX imports may stay on one line if they remain within the
|
||||
line limit; do not expand short type-only imports mechanically.
|
||||
- Keep runtime value imports and type imports in separate declarations.
|
||||
@@ -598,10 +621,10 @@ and layout reuse, follow `frontend/AGENTS.md`.
|
||||
beginning of a line.
|
||||
- The TSX-specific self-review must confirm JSX closing markers and closing
|
||||
parentheses keep the surrounding compact style.
|
||||
- The TypeScript/TSX self-review must confirm leading block indentation uses
|
||||
2 spaces per level, wrapped continuations use the repository's 4-space
|
||||
continuation alignment, and complete leading runs of 8 spaces may be
|
||||
compressed to tabs.
|
||||
- The TypeScript/TSX self-review must confirm block indentation uses 2 spaces
|
||||
per level, wrapped continuations use the repository's 4-space continuation
|
||||
alignment, and every complete run of 8 spaces used for indentation or
|
||||
alignment has been compressed to tabs.
|
||||
- Prefer `const` arrow functions for TypeScript/TSX component and helper declarations.
|
||||
- Put two blank lines before and after top-level `const` function
|
||||
declarations, unless imports, exports, or file boundaries make that awkward.
|
||||
@@ -614,9 +637,18 @@ and layout reuse, follow `frontend/AGENTS.md`.
|
||||
- Indent the block body 2 spaces deeper than the keyword and opening brace.
|
||||
- Put the closing `}` on its own line at the same indentation as the keyword.
|
||||
- Do not write `try {`, `catch {`, or `finally {`.
|
||||
- In TypeScript and TSX, convert every complete leading run of 8 spaces to a
|
||||
tab character.
|
||||
- A leading tab is exactly equivalent to 8 leading spaces.
|
||||
- In TypeScript and TSX, convert every complete run of 8 spaces used for
|
||||
indentation or alignment to a tab character.
|
||||
- In TypeScript and TSX, a tab is exactly equivalent to 8 columns, whether it
|
||||
appears at the beginning of a line or in alignment whitespace after
|
||||
non-space text.
|
||||
- In TSX, JSX nesting uses 2-space block indentation and wrapped JSX
|
||||
attributes use 4-space continuation indentation; after visible columns are
|
||||
determined, compress every complete run of 8 spaces in the resulting
|
||||
indentation or alignment to tabs.
|
||||
- In TSX, do not leave JSX subtree indentation at 8, 10, 12, 14, or 16
|
||||
columns as spaces alone; convert each complete run of 8 spaces to tabs and
|
||||
keep only the residual 2, 4, or 6 spaces.
|
||||
- In TypeScript and TSX function declarations, including `const` arrow
|
||||
function declarations, classify the parameter list before placing the closing
|
||||
`)`.
|
||||
@@ -1259,9 +1291,9 @@ to `.ts` and `.tsx`:
|
||||
7. JSX `>` and `/>` stay with the final prop unless nearby code proves
|
||||
otherwise.
|
||||
8. JSX closing parentheses keep the compact local style.
|
||||
9. Leading block indentation uses 2 spaces per level, wrapped continuations
|
||||
use the repository's 4-space continuation alignment, and complete leading
|
||||
runs of 8 spaces may be compressed to tabs.
|
||||
9. Block indentation uses 2 spaces per level, wrapped continuations use the
|
||||
repository's 4-space continuation alignment, and every complete run of 8
|
||||
spaces used for indentation or alignment has been compressed to tabs.
|
||||
10. No line has trailing whitespace.
|
||||
|
||||
Preferred:
|
||||
|
||||
新しい課題から参照
ユーザをブロックする