.eslintrc.js 不适用于规则 "off"

.eslintrc.js doesn't work with rules "off"

native 并且在配置 eslint 时遇到问题。 这是我的.eslintrc.js。

module.exports = {
    "extends": "airbnb",
    "parser": "babel-eslint",
    "env": {
        "jest": true,
    },
    "plugins": [
        "react",
        "node"
    ],
    "rules": {
        "no-use-before-define": "off",
        "react/jsx-filename-extension": "off",
        "node/no-unsupported-features/es-syntax": ["error", {
            "version": ">=6.0.0",
            "ignores": ["modules", "destructuring"]
        }],
        "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
        "react/prop-types": "off",  
    }
};

在App.js,

const { navigation } = this.props;

我遇到了 eslint 错误。

[eslint] Destructuring are not supported yet on Node 4.0.0. (node/no-unsupported-features) 
[eslint] 'navigation' is missing in props validation (react/prop-types)

还有在 App.js,

<View style={styles.container}>
    <UpArrow title="cancel" />
    <SecondsSpinner seconds={this.state.imageTime} changeImageTime={this.changeImageTime} />
    <DownArrow title="save" />
</View>

我收到错误

[eslint] JSX not allowed in files with extension '.js' (react/jsx-filename-extension)

所以我

但它们不起作用。 我不知道为什么以及如何解决这个问题。 是否有任何其他文件来配置 eslint? 提前致谢。

EDIT1) "ignores":["modules"] 有效。太奇怪了。

EDIT2) 我正在使用 vscode 并且在编辑器上不断出现错误,所以我认为是因为 .eslintrc 文件。 但是现在我认为是vscode的问题。我设置

"eslint.options": { "configFile": "/Users/com/vscode/AwesomeProject/.eslintrc.js" } 

在“工作区设置”中即可使用

尝试:

module.exports = {
    "extends": "airbnb",
    "parser": "babel-eslint",
    "env": {
        "jest": true,
    },
    "plugins": [
        "react",
        "node"
    ],
    "rules": {
        "no-use-before-define": 0,
        "react/jsx-filename-extension": 0,
        "node/no-unsupported-features/es-syntax": ["error", {
            "version": ">=6.0.0",
            "ignores": ["modules", "destructuring"]
        }],
        "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
        "react/prop-types": 0,  
    }
};