0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ESLint の設定の落とし穴 naming-convention編

Posted at

eslintの設定で詰まったところがあったのでメモ。

const isHoge = "fuga"

isHoge という変数に対して eslintのルールで naming-convention の設定を

      {
            selector: "variable",
            types: ["boolean"],
            format: ["strictCascalCase"],
            prefix: ["is", "should", "has", "can", "did", "will"]
          },

としようとするとエラーが出る。 ishoge とすれば通る。
ええ・・・何故なのか全然わからず考えること一日、 どうもセレクターの変数名の対象に prefix は含まれないみたいだという結論に。

      {
            selector: "variable",
            types: ["boolean"],
            format: ["StrictPascalCase"],
            prefix: ["is", "should", "has", "can", "did", "will"]
          },

formatPascalCaseしたら通りました。

うむ分かりづらい…。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?