-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(textlint): add no-js-function-paren #143
Conversation
`fn()`の表記を原則禁止にして、`fn`関数と書くように変更
@@ -67,10 +67,14 @@ function displayView(view) { | |||
コールバック関数を使うと、ソースコードのネストが深くなったり、例外処理が複雑になったりします。 | |||
Promiseを用いることで、可読性を保ちながらエラーハンドリングを簡単に行えます。 | |||
|
|||
<!-- textlint-disable no-js-function-paren --> | |||
|
|||
コールバック関数を使う形式のAPIをPromiseに置き換えるのは、次のコードのように`new Promise()`を用いるのが一般的です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
書き直すとしたら "Promiseのコンストラクタを呼び出します"あたりですかね
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise()
とも読めるから、Promiseをインスタンス化する or new するみたいな感じかなー。
コンストラクタって用語が扱いにくい…
new Foo
Fooをインスタンス化する(Fooクラスとはいえないのが厄介…)Foo()
Fooコンストラクタ関数を呼び出す
かなー
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここでは、Promiseをインスタンス化したいってより、new Promise()
というパターンで書くのが一般的ですみたいな話だからそのままでもいいかなと思ったりしました。
(別の書き方として Promise.resolve().then(() => )
で書くパターンもあるけど、あんまりみないかな)
@@ -45,6 +45,6 @@ Console APIは原始的なプリントデバッグとして利用できるので | |||
「この値は何だろう」と思ったらコンソールに表示してみることで解決する問題は多いです。 | |||
|
|||
また、JavaScriptの開発環境は高機能化が進んでいるため、デバッガーなどが用意されていることが多く、 | |||
コードに`console.log()`と書かなくても値を見ることもできるようになっています。 | |||
コードに`console.log`メソッドを書かなくても値を見ることもできるようになっています。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
関係ないけど、この表現冗長だな…
とりあえずマージします |
fn()
の表記を原則禁止にして、fn
関数と書くように変更close #141
close #110
/cc @laco0416 こんな感じ