Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint not running with npm run lint #113

Closed
Emmahchinonso opened this issue Apr 25, 2022 · 6 comments
Closed

eslint not running with npm run lint #113

Emmahchinonso opened this issue Apr 25, 2022 · 6 comments

Comments

@Emmahchinonso
Copy link

Emmahchinonso commented Apr 25, 2022

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
Copy link

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

@jonreiland
Copy link

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
Copy link
Owner

wesbos commented Dec 15, 2022

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
Copy link

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
Copy link
Owner

wesbos commented Dec 15, 2022

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

@wesbos
Copy link
Owner

wesbos commented Dec 15, 2022

closing this but let me know if you still have troubles

@wesbos wesbos closed this as completed Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants