2017-05-25 87 views
0

只是想有證監會和ESLint抱怨ESLint規則被忽視

我HAZ在我.eslinrc

{ 
    "env": { 
    "es6": true, 
    "browser": true 
    }, 
    "extends": "airbnb", 
    "rules": { 
    "semi": [2, "never"], 
    "no-unexpected-multiline": 2, 
    "no-console": 0, 
    "react/prefer-stateless-function": [0, { 
     "ignorePureComponents": true 
    }], 
    "comma-dangle": ["error", "never"], 
    "arrow-body-style": ["error", "never"] 
    } 
} 

即使添加/* eslint arrow-body-style: ["error", "never"]*/直接錯誤上述規則,任何人都碰到過這樣的?

我在做什麼錯

ESLINT RULE PLZ!!

回答

2

您可以使用禁用,下一行只是你的出口前:

// eslint-disable-next-line arrow-body-style 
export onst Hi =() > { 
[...] 
} 

也許你也可以嘗試通過"arrow-body-style": "off"在更換"arrow-body-style": ["error", "never"]你的.eslinrc。

順便說一句,如果你只是想避免這種錯誤,請用下面的代碼:

import React from 'react'; 

export const Hi =() => (
    <div> 
    <h1>Hi</h1> 
    </div> 
); 

export default Hi;