I'm trying to set up tslint to work on a small sample React/Typescript project, following a tutorial online. When I either run yarn lint
or simply enter tslint --project
in the terminal, I keep getting the error
Invalid option for project: true
I've done a lot of googling, and I can't find what I'm doing wrong.
My tslint.json
is
{
"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
}
}
and my package.json
is
{
"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"
}
}
It may be I've messed up the package.json
in converting this from the original eslint
version, but I am lost at this point. Any help much appreciated.
--project
needs a param, i think thats for telling it where to get yourtsconfig.json
file. Something liketslint --project ./some/path/tsconfig.json
– Futilitarian--project
you're incorrectly calling it. just runtslint
. If you do pass the project flag then give it a path as well :) – Futilitariantslint
by itself gives meNo files specified. Use --project to lint a project folder.
. Buttslint --project '.'
works – Claudio