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 5 years have passed since last update.

React NavigationのnavigationOptionsで、ESLintがエラー吐いた

0
Last updated at Posted at 2017-10-23
class ResultScreen extends Component {
  static navigationOptions = {
    title: 'Photo Result Log'
  };

  render() {
    // 省略
  }
}

React Navigationを使うにあたって、こんな感じのコードを書いたらParsing error: unexpected token = (Fatal)の表記が。
エディタはAtomを使っています。

full classes compatibility (with static properties) · Issue #43 · yannickcr/eslint-plugin-react
こちらを参考にして、下記の対応をしました。

  1. babel-eslintを導入
  2. .eslintrcに"parser": "babel-eslint""classes": trueの表記を追加。
(抜粋)
"parser": "babel-eslint",
"parserOptions": {
    "ecmaFeatures": {
        "experimentalObjectRestSpread": true,
        "jsx": true,
        "classes": true
    },
    "sourceType": "module"
},
0
0
4

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?