根据在线教程,我正在尝试将tslint设置为一个小示例React / Typescript项目。当我运行yarn lint
或只是在终端中输入tslint --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
版本转换时,我可能搞砸了# New york city polygon
nyc1 <- readOGR(".", "ZIP_CODE_040114")
> class(nyc1)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
> proj4string(nyc1)
[1] "+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +datum=NAD83 +units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0"
nyc1 <- as(nyc1, "SpatialPolygons") # remove the attributes
nyc <- as(nyc1, "owin")
class(nyc)
[1] "owin"
> print(nyc)
window: polygonal boundary
enclosing rectangle: [913129, 1067494.3] x [120020.86, 272710.95] units
,但现在我迷路了。任何帮助,不胜感激。
答案 0 :(得分:4)
诀窍在于,需要指定一个目录(ts)所在的目录。因此,如果您位于项目的根目录,
tslint --project '.'
起到了作用。