[英]no-unused-vars eslint for property in createReducer
I have the following file: 我有以下文件:
import { Map } from 'immutable';
import { createReducer } from 'redux-immutablejs';
import { createAction } from '../utils/Action';
const increment = createAction('INCREMENT');
const initialState = Map({
count: 0
});
export default createReducer(initialState, {
[increment]: (state) => {
return state.merge({
count: state.get('count') + 1
});
}
});
But I am getting the following eslint error: 但是我收到以下错误提示:
3:8 error 'increment' is defined but never used no-unused-vars 3:8错误“增量”已定义,但从未使用过no-unused-vars
Or is there anyway I can disable it for this file or variable only? 还是无论如何我只能对此文件或变量禁用它?
I cannot get the syntax right for this. 我无法正确使用此语法。
I have tried: 我努力了:
const increment = createAction('INCREMENT'); //eslint-disable-line
And also: 并且:
/* eslint-disable no-unused-vars */
...
/* eslint-enable no-unused-vars */
And also: 并且:
/* eslint no-unused-vars: 0 */
At the top of the file 在文件的顶部
But nothing works 但是什么都行不通
May be, you need to install eslint-plugin-react and enable rules 可能是,您需要安装eslint-plugin-react并启用规则
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.