Tom*_*zyk 8 reactjs eslint flowtype eslint-config-airbnb
我有定义的全局类型/flow-typed/redux.flow.js:
declare type Action = {|
+type: string,
+payload: any,
|}
declare type State = {|
+ui: UI,
+user: User,
+team: Team,
+projects: Project[],
+profile: Profile,
|}
declare type UI = {|
+isSliderOpen: boolean,
+isModalVisible: boolean,
+modalAction: string,
+modalPayload: Object,
|}
...
Run Code Online (Sandbox Code Playgroud)
我已将airbnb eslint配置添加到我的项目中,现在我得到:
type Props = {
logout: () => Action, //error ESLint 'Action' is not defined.(no-undef)
user: UserDetails, //error ESLint 'UserDetails' is not defined.(no-undef)
}
Run Code Online (Sandbox Code Playgroud)
它的纯粹的eslint错误.一切都配置得当,流动本身就很开心.
如何告诉eslint这些类型确实被声明为全局?或者我应该将它们添加到某个忽略列表中?
Tom*_*zyk 17
事实证明(就像我想的那样)不是将全局类型添加到eslint忽略列表的方式.实际上它是由eslint-plugin-flowtype处理的,我已经安装了但是我并没有扩展它:
.eslintrc
"extends": ["airbnb", "plugin:flowtype/recommended"],
"plugins": [
"flowtype"
],
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2420 次 |
| 最近记录: |