このコミットが含まれているのは:
@@ -376,6 +376,23 @@ const value =
|
|||||||
short object literals, or short callback bodies that already fit the local
|
short object literals, or short callback bodies that already fit the local
|
||||||
line-length and delimiter rules. Expanding compact local code without a
|
line-length and delimiter rules. Expanding compact local code without a
|
||||||
readability need is a minor style violation.
|
readability need is a minor style violation.
|
||||||
|
- In TypeScript and TSX, treat short object literals, short returned objects,
|
||||||
|
short typed object shapes, and short function-call object arguments as
|
||||||
|
compact associative syntax by default. If they fit locally, keep the opening
|
||||||
|
`{` on the same line as the first property and keep the closing `}` on the
|
||||||
|
same line as the final property. Do not explode them into vertical
|
||||||
|
Prettier-style blocks without a concrete readability or line-length reason.
|
||||||
|
- In TypeScript and TSX, when a compact associative form is broken across two
|
||||||
|
lines, keep the opening `{` with the first property and the closing `}` with
|
||||||
|
the final property. A shape like `{\n key: value,\n}` is wrong even when
|
||||||
|
line length would permit it.
|
||||||
|
- In TypeScript and TSX, when a short call such as `apiGet<...> (...)`,
|
||||||
|
`apiPatch<...> (...)`, `setState (...)`, `updateClientSettings (...)`, or
|
||||||
|
`window.dispatchEvent (...)` already fits within the local style, do not
|
||||||
|
add extra vertical layers around the object argument or callback body.
|
||||||
|
- In TypeScript and TSX, after editing a file, inspect the file tail and
|
||||||
|
remove meaningless blank lines before `export default` or the end of file.
|
||||||
|
A stray empty line before `export default` is a minor style offence.
|
||||||
- Use correct British English spelling for new identifiers, filenames,
|
- Use correct British English spelling for new identifiers, filenames,
|
||||||
component names, helper names, comments, and developer-facing prose unless
|
component names, helper names, comments, and developer-facing prose unless
|
||||||
editing an already established American-English API that must keep its
|
editing an already established American-English API that must keep its
|
||||||
@@ -470,6 +487,92 @@ setDirtyStates (
|
|||||||
Penalty: minor offence when semantics stay intact. It is not necessarily
|
Penalty: minor offence when semantics stay intact. It is not necessarily
|
||||||
broken, but it ignores the repository's compact associative style.
|
broken, but it ignores the repository's compact associative style.
|
||||||
|
|
||||||
|
#### Prettier-style exploded object literals that should stay compact
|
||||||
|
|
||||||
|
Bad:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const next = {
|
||||||
|
enabled: keyboard?.enabled !== false,
|
||||||
|
bindings: normaliseKeyboardBindings (keyboard?.bindings),
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Good:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const next = {
|
||||||
|
enabled: keyboard?.enabled !== false,
|
||||||
|
bindings: normaliseKeyboardBindings (keyboard?.bindings) }
|
||||||
|
```
|
||||||
|
|
||||||
|
Also good when short enough:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const next = { enabled: keyboard?.enabled !== false,
|
||||||
|
bindings: normaliseKeyboardBindings (keyboard?.bindings) }
|
||||||
|
```
|
||||||
|
|
||||||
|
Rule: for compact associative syntax, keep `{` with the first property and `}`
|
||||||
|
with the final property unless line length truly forces a different shape.
|
||||||
|
Do not mechanically apply the common Prettier block form.
|
||||||
|
Penalty: medium-severity offence. The code still runs, but it violates a core
|
||||||
|
repository formatting habit that must be preserved consistently.
|
||||||
|
|
||||||
|
#### Exploded object arguments inside short calls
|
||||||
|
|
||||||
|
Bad:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
updateClientSettings (settings => ({
|
||||||
|
...settings,
|
||||||
|
keyboard: next,
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Good:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
updateClientSettings (settings => ({
|
||||||
|
...settings,
|
||||||
|
keyboard: next }))
|
||||||
|
```
|
||||||
|
|
||||||
|
Rule: a call-expression closing `)` must not drift onto its own line, and a
|
||||||
|
short object argument should not be exploded more than necessary. Keep the
|
||||||
|
callback's returned object compact when it fits.
|
||||||
|
Penalty: medium-severity offence. This usually means the edit was formatted
|
||||||
|
mechanically instead of by reading the local style.
|
||||||
|
|
||||||
|
#### Stray blank line before `export default`
|
||||||
|
|
||||||
|
Bad:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const Component: FC = () => {
|
||||||
|
return <div/>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default Component
|
||||||
|
```
|
||||||
|
|
||||||
|
Good:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const Component: FC = () => {
|
||||||
|
return <div/>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component
|
||||||
|
```
|
||||||
|
|
||||||
|
Rule: do not leave an extra empty line between the last top-level declaration
|
||||||
|
and `export default` unless some surrounding file structure genuinely requires
|
||||||
|
visual separation.
|
||||||
|
Penalty: minor offence. It is small, but it is easy to avoid and should not
|
||||||
|
recur.
|
||||||
|
|
||||||
### Frontend delimiter decision table
|
### Frontend delimiter decision table
|
||||||
|
|
||||||
Use this table before accepting any edited TypeScript or TSX hunk. The table is
|
Use this table before accepting any edited TypeScript or TSX hunk. The table is
|
||||||
|
|||||||
+234
-418
ファイル差分が大きすぎるため省略します
差分を読込み
@@ -1445,4 +1445,5 @@ const SettingPage: FC<Props> = ({ user, setUser }) => {
|
|||||||
</MainArea>)
|
</MainArea>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default SettingPage
|
export default SettingPage
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする