如何使用Atom制作工作eslint-plugin-react-native?

时间:2016-09-03 11:10:56

标签: react-native atom-editor eslint

我尝试让linter在Atom上运行,但没有任何反应:/ (我习惯于在Atom上使用eslint但是对于一个新的React Native项目我完全陷入困境......)我使用Atom的linter和linter-eslint包。

感谢您的帮助:)

这是我的package.json,配置如下所示: https://github.com/intellicode/eslint-plugin-react-native

{
  "name": "RNApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "eslint": "^3.4.0",
    "eslint-plugin-react": "^6.2.0",
    "eslint-plugin-react-native": "^2.0.0",
    "react": "15.3.1",
    "react-native": "0.32.0"
  },
  "plugins": [
    "react",
    "react-native"
  ],
  "ecmaFeatures": {
    "jsx": true
  },
  "rules": {
    "react-native/no-unused-styles": 2,
    "react-native/split-platform-components": 2,
    "react-native/no-inline-styles": 2,
    "react-native/no-color-literals": 2
  }
}

1 个答案:

答案 0 :(得分:0)

我不得不替换它:

"ecmaFeatures": {
  "jsx": true
},

由此:

"eslintConfig": {
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  }
},