Skip to content

Commit

Permalink
Merge pull request #130 from hatena/loosen-naming-convention
Browse files Browse the repository at this point in the history
naming-convention ルールの調整
  • Loading branch information
susisu authored Sep 4, 2024
2 parents 93636b2 + 0b564bf commit 3f91088
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lib/rules/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ const rules = {
'@typescript-eslint/naming-convention': [
1,
{
selector: ['variable', 'default'],
// `const CounterComponent = () => { ... }` や `const CONSTANT = 1;` のような変数が記述できるよう、
// PascalCase や UPPER_CASE も許可する
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
selector: 'variableLike',
format: ['camelCase'],
// 末尾のアンダースコアは基本的に使われないのでデフォルトで禁止しておく。
// 必要に応じて allow に上書きすることを想定している。
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
{
selector: 'function',
// React Component の宣言のために PascalCase も許可する
format: ['camelCase', 'PascalCase'],
selector: 'variable',
// `const CounterComponent = () => { ... }` や `const CONSTANT = 1;` のような変数が記述できるよう、
// PascalCase や UPPER_CASE も許可する
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
{
selector: 'parameter',
format: ['camelCase'],
selector: 'function',
// React Component の宣言のために PascalCase も許可する
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
Expand All @@ -56,21 +56,21 @@ const rules = {
trailingUnderscore: 'forbid',
},
{
selector: 'typeLike',
format: ['PascalCase'],
selector: 'property',
// オブジェクトのプロパティには様々な命名規則の識別子が書かれるので、緩めにしておく
format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
{
selector: 'property',
// オブジェクトのプロパティには様々な命名規則の識別子が書かれるので、緩めにしておく
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
modifiers: ['requiresQuotes'],
// クオートが必要な場合は意図してそうなっていると思われるので, フォーマットはなんでもよいことにする
format: null,
},
{
selector: 'method',
format: ['camelCase'],
selector: 'typeLike',
format: ['PascalCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
Expand Down

0 comments on commit 3f91088

Please sign in to comment.