News
Meetup
YouTube
Blog
書き起こし
2021/12/03 に公開
1971 views
このエピソードについて
@potato4d が @akinori.inoue と @asakura_dev に、 LINE NEWS の eslint-disable 事情について話を聞きました。
eslint-disableは、仕方なくdisableにしたケースや、linecorp推奨のルールを導入した際に一括でdisableにしたケースがある
違反経緯並びにどうすべきだったのかなどをLINE NEWSの開発の歴史を振り返りながら紹介する
特に気になるルール
@typescript-eslint/no-explicit-any,6
eqeqeq,5
vue/multi-word-component-names
@typescript-eslint/explicit-function-return-type
TOP10
react/prop-types
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
prefer-const
https://eslint.org/docs/rules/prefer-const
prefer-template
https://eslint.org/docs/rules/prefer-template
prefer-templateはES5に対応していなかったので、コードとして残っているのは納得
babelを介してES5に変換いるので実際のコードはprefer-templateではない
react/no-string-refs
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
no-unused-vars
react/require-default-props
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
@typescript-eslint/camelcase
サーバーのレスポンスがキャメルケースの場合がある
APIレスポンスをStoreにそのまま保存するケースなど
テストでもちらほら
@typescript-eslint/no-empty-function
LINE NEWS での運用方針について
ESLint/Prettier を利用
実行は Husky + CI
NEWS ならではの要素
社内共通の ESLint があって、それを活用している
新規プロジェクトでは全てこれではじめており、既存のコードにも適用している
既存プロジェクトに追加するにあたって、一度 eslint-disable を付与
Refs
BGM&SE
魔王魂/騒音のない世界/OtoLogic
1.0x
1.3x
1.5x