【发布时间】:2021-05-25 03:18:43
【问题描述】:
所以我有一个 package-scripts 文件夹,其中包含我在 react 环境中构建的所有脚本:
const npsUtils = require('nps-utils')
module.exports = {
scripts: {
default: 'react-scripts start',
build: 'react-scripts build',
test: 'react-scripts test',
eject: 'react-scripts eject',
lint: {
default: 'eslint ./ --ignore-path .gitignore',
fix: 'yarn run lint -- --fix',
},
format: 'prettier --write "{,!(node_modules)/**/}*.js"',
validate: npsUtils.concurrent.nps('lint', 'format', 'build'),
},
}
但是,当我尝试调用 lint 修复脚本时,它总是失败。我的电话yarn start lint:fix 总是失败并给出错误
脚本必须解析为字符串。没有脚本可以 从“lint:fix”解决
那么我该如何调用 lint fix?
【问题讨论】: