wesbos / eslint-config-wesbos

No-Sweat™ Eslint and Prettier Setup - with or without VS Code
2.74k stars 419 forks source link

eslint not running with npm run lint #113

Closed Emmahchinonso closed 1 year ago

Emmahchinonso commented 2 years ago

Hello, please can anyone help. I first created a create-react-app project, then decided to add typescript later on. I followed the instructions in the readme but when I try to run npm run lint it just freezes, it doesn't do anything, no errors and I have just two files. I don't know what I did wrong.

"devDependencies": { "@babel/core": "^7.17.9", "@babel/eslint-parser": "^7.17.0", "@babel/preset-react": "^7.16.7", "@types/node": "^16.11.27", "@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/parser": "^5.18.0", "eslint": "^8.13.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^16.2.0", "eslint-config-prettier": "^8.5.0", "eslint-config-wesbos": "^3.0.2", "eslint-plugin-html": "^6.2.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-react": "^7.29.4", "eslint-plugin-react-hooks": "^4.4.0", "husky": "^7.0.0", "lint-staged": "^12.4.0", "prettier": "^2.6.2", "typescript": "^4.6.3" }

.eslintrc { "extends": ["wesbos/typescript", "react-app/jest"] }

tsconfig.json { "compilerOptions": { "jsx": "react", "target": "es2016" / Set the JavaScript language version for emitted JavaScript and include compatible library declarations. /, "module": "commonjs" / Specify what module code is generated. /, "strict": true / Enable all strict type-checking options. /, "skipLibCheck": true / Skip type checking all .d.ts files. / } }

richardcarrigan commented 2 years ago

Did you add "lint": "eslint .", "lint:fix": "eslint . --fix" to the scripts section of your package.json?

jonreiland commented 1 year ago

I can confirm I'm having the same issue. Seems like eslint isn't able to find the .eslintrc file in the project root for whatever reason.

wesbos commented 1 year ago

It might be that the react-app/jest config - try take it out and try again.

Also make sure you are running this in the root directory. sometimes if the parent has any eslint configs things get weird.

If you can post a reproduction, Ill take a lookski

jonreiland commented 1 year ago

Thanks @wesbos, that did it! Removing react-app/jest from eslintConfig in my create-react-app project fixed it.

So now it looks like this: "eslintConfig": { "extends": [ "react-app", "wesbos" ] },

wesbos commented 1 year ago

awesome - I was going to suggest that - put the other things first - mine will overwrite any duplicate properties

wesbos commented 1 year ago

closing this but let me know if you still have troubles