1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ESLint(TypeScript)の指摘の直し方

Last updated at Posted at 2023-12-22

手元で表示されたものだけ

Arrow function should not return assignment

カッコで囲む

    () => a = b

    () => { a = b }

Block must not be padded by blank lines

{の直下の空行を消す

'xxx' is never reassigned. Use 'const' instead

letconstに変える

Don't use Boolean as a type. Use boolean instead

Booleanbooleanに変える

Expected { after 'if' condition

if文を{}で囲む

Expected '===' and instead saw '=='

=====に変える

Expected blank line between class members

クラスメソッドの前に空行を入れる

export class CAiueo {
   public aaa (): void {
   }
   public bbb (): void {
   }
}

export class CAiueo {
   public aaa (): void {
   }

   public bbb (): void {
   }
}

Expected error to be handled

コールバックで渡ってきた引数を使う

Expected indentation of 2 spaces but found 4

インデントは4文字では無く2文字

8文字教の人からしたらどんな感じなんだろう

Extra semicolon

;(セミコロン)つけるな

Missing return type on function

関数の戻り値の型が設定されていない

function aiueo () {

function aiueo (): void {

Missing space before function parentheses

カッコの前にスペース入れる

function aiueo(): void {

function aiueo (): void {

More than 1 blank line not allowed

2行以上の連続空行は認めない

Newline required at end of file but not found

ファイルの最後に改行しろ

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the void operator

これはよくわからないけど指摘のところにvoidを入れるとなおる。
おそらく vscode.window.showInformationMessageが非同期処理だからだとかそんな感じかなぁ

  vscode.window.showInformationMessage("Hello, world")

  void vscode.window.showInformationMessage("Hello, world")

Strings must use singlequote

"(ダブルクォーテーション)使うな

Unexpected literal in error position of callback

コールバックI/Fの第1引数はErrorで無いとだめらしい

参考:https://stackoverflow.com/questions/50755653/unexpected-literal-in-error-position-of-callback-in-vue-js

Unexpected nullable object value in conditional. An explicit null check is required

  if (!err) {

  if (err == null) {

Unexpected object value in conditional. The condition is always true

  if (err == null || !err) {

  if (err == null) {

Unexpected string value in conditional. An explicit empty string check is required

stringnullチェックは要らんらしい

function aaa (arg: string) {
  if (arg == null) {

条件文ごと削除

Unexpected tab character

タブ使うな

Variable name xxx_xxx must match one of the following formats: camelCase, PascalCase, UPPER_CASE

アンダーバーがあって、小文字だけの変数名は認められないらしい

  let aaa_bbb: string = 'aiueo'

  let aaaBbb: string = 'aiueo'
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?