@typescript-eslint v3登場にともなって消えたルールを置き換える

# `@typescript-eslint` v3登場

ついに`@typescript-eslint` v3が登場しました。`eslint` v7に正式対応です。早速アップデートしましょう！

```
C:\msys64\home\yumetodo\es-string-algorithm\src\impl.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing
  1:6  error  Type Alias name Pred must match one of the following formats: camelCase   @typescript-eslint/naming-convention

C:\msys64\home\yumetodo\es-string-algorithm\src\index.ts
    1:1   error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing
  176:14  error  Variable name _ must match one of the following formats: camelCase        @typescript-eslint/naming-convention

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstNotOf\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstNotOf\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstNotOf\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstNotOf\stringSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstOf\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstOf\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstOf\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findFirstOf\stringSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastNotOf\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastNotOf\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastNotOf\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastNotOf\stringSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastOf\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastOf\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastOf\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\findLastOf\stringSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\find\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\find\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\find\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\find\stringSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\rfind\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\rfind\charSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\rfind\pointerSizeSize.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\size\baisc.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\size\size.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\substr\basic.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

C:\msys64\home\yumetodo\es-string-algorithm\test\substr\substr.pass.test.ts
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found  @typescript-eslint/class-name-casing

✖ 31 problems (31 errors, 0 warnings)
```

ってあれっ、なんかエラーが。

# `camelcase`と`class-name-casing`の廃止

Change Logを見に行くとこんな記述が。

> https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0
>
> The following deprecated rules have been deleted. Please switch to the listed alternative:
>
- `ban-ts-ignore` - replaced by [`ban-ts-comment`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md)
- `camelcase` - replaced by [`naming-convention`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md)
- `class-name-casing` - replaced by [`naming-convention`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md)
- `generic-type-naming` - replaced by [`naming-convention`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md)
- `interface-name-prefix` - replaced by [`naming-convention`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md)
- `member-naming` - replaced by [`naming-convention`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md)
- `no-untyped-public-signatures` - replaced by [`explicit-module-boundary-types`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md)

`naming-convention`ってやつに置き換えろってことらしい。

# `naming-convention`

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md

をみると、だいぶわちゃわちゃしている。

```json:eslintのcamelcase相当
{
  "@typescript-eslint/naming-convention": [
    "error",
    {
      "selector": "default",
      "format": ["camelCase"]
    },

    {
      "selector": "variable",
      "format": ["camelCase", "UPPER_CASE"]
    },
    {
      "selector": "parameter",
      "format": ["camelCase"],
      "leadingUnderscore": "allow"
    },

    {
      "selector": "memberLike",
      "modifiers": ["private"],
      "format": ["camelCase"],
      "leadingUnderscore": "require"
    },

    {
      "selector": "typeLike",
      "format": ["PascalCase"]
    }
  ]
}
```

編集時点で`custom`と`filter`の使い方が全くわかりません。

自分の掛けたいルールは

- 基本camelCaseに
- でも`type`で作ったエイリアスはPascalCaseに
- プロパティは何もしない
- 変数名`_`を許容したい

なので・・・ええっとつまり・・・

```diff
diff --git a/.eslintrc.json b/.eslintrc.json
index 088967e..a928c61 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -19,9 +19,32 @@
     "no-throw-literal": "error",
     "no-unused-expressions": "error",
     "curly": ["error", "multi-line"],
-    "@typescript-eslint/class-name-casing": "error",
     "@typescript-eslint/semi": "error",
-    "@typescript-eslint/camelcase": ["error", { "properties": "never" }],
+    "@typescript-eslint/naming-convention": [
+      "error",
+      {
+        "selector": "default",
+        "format": ["camelCase"]
+      },
+      {
+        "selector": "class",
+        "format": ["camelCase"]
+      },
+      {
+        "selector": "typeAlias",
+        "format": ["PascalCase"]
+      },
+      {
+        "selector": "property",
+        "format": null
+      },
+      {
+        "selector": "variable",
+        "format": ["camelCase"],
+        "leadingUnderscore": "allow",
+        "trailingUnderscore": "allow"
+      }
+    ],
     "@typescript-eslint/explicit-function-return-type": "off",
     "eqeqeq": "error",
     "@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "_" }],
```

なんか長くなったでござる。