gpt4 book ai didi

reactjs - 在 React 项目上运行 "Invalid option for project: true"时会产生什么 'tslint --project'?

转载 作者:行者123 更新时间:2023-12-04 01:03:23 24 4
gpt4 key购买 nike

我正在尝试按照在线教程设置 tslint 以处理一个小型示例 React/Typescript 项目。当我运行 yarn lint或直接输入 tslint --project在终端中,我不断收到错误消息

Invalid option for project: true



我已经做了很多谷歌搜索,我找不到我做错了什么。

我的 tslint.json
{
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-config-prettier"
],
"rules": {
"ordered-imports": false,
"object-literal-sort-keys": false,
"no-console": false,
"jsx-no-lambda": false,
"member-ordering": false
}
}

和我的 package.json
{
"name": "something",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "parcel ./src/index.html",
"lint": "tslint --project",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"babel-preset-react": "^7.0.0-beta.3",
"parcel-bundler": "^1.12.3",
"prettier": "^1.18.2",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0",
"tslint-react": "^4.0.0"
},
"dependencies": {
"@babel/core": "^7.0.0",
"@emotion/babel-preset-css-prop": "^10.0.14",
"@emotion/core": "^10.0.16",
"@emotion/styled": "^10.0.15",
"axios": "^0.19.0",
"babel": "^6.23.0",
"bulma": "^0.7.5",
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"typescript": "^3.5.3"
}
}

可能是我搞砸了 package.json从原始 eslint 转换此版本,但我在这一点上迷路了。非常感谢任何帮助。

最佳答案

诀窍是需要指定 (ts) linting 所在的目录。因此,如果您在项目的根目录中,

tslint --project '.'

诀窍。

关于reactjs - 在 React 项目上运行 "Invalid option for project: true"时会产生什么 'tslint --project'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57680471/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com