I've just set up a create-react-app project with typescript. I've added eslint with npx eslint --init. When I run npx eslint src/ or npx eslint src I get an error:
Oops! Something went wrong! :(
ESLint: 8.18.0
No files matching the pattern "src" were found.
Please check for typing mistakes in the pattern.
However, if I use this command: npx eslint src/* then it works. This is fine, but some guides and stackoverflow comments (eg on here) I've seen show that the commands that don't work for me are working for seemingly everyone else. What am I doing wrong?
eslint.js
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: ["plugin:react/recommended", "standard"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react", "@typescript-eslint"],
rules: {
semi: "off",
quotes: "off",
"space-before-function-paren": "off",
},
ignorePatterns: ["**/*.css", "**/*.svg"],
};
package.json:
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.4.2",
"web-vitals": "^2.1.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.0.1",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.30.1"
},