我有这段代码:
for(const physicalEffect of deleteSolution.physicalEffects) {
const { solutions } = cache.readQueryNoThrow({
query: solutionsQuery,
variables: {
projectId: project.id,
physicalEffect: physicalEffect.id,
engineeringArticle: null,
biologyArticle: null
}
})
solutions && cache.writeQuery({
query: solutionsQuery,
variables: {
projectId: project.id,
physicalEffect: physicalEffect.id,
engineeringArticle: null,
biologyArticle: null
},
data: {
solutions: solutions.filter(({ id }) => id !== deleteSolution.id)
}
})
}
使用create-react-app,react-app-rewired和custom-cra,我有以下.eslintrc
:
{
"extends": "react-app",
"rules": {
"jsx-a11y/anchor-is-valid": 0,
"react-hooks/exhaustive-deps": 0
}
}
我收到此警告:
Compiled with warnings.
./src/pages/project/solution/Editor.js
Line 60: 'physicalEffect' is defined but never used no-unused-vars
第60行指的是我上面的代码示例的第一行。该警告由physicalEffect
循环中的for ... of
声明引起。
到底发生了什么?