Solving "No files matching "src/**/*.{js, jsx}" were found please check for typing mistakes". Im trying to set up React js as im trying to learn it however i run into that problem Issue of react js cant find files matching pattern](https://i.stack.imgur.com/JFnmS.png). The problem is in the package-json file code Package-json code and for some reason when I run npm lint the error is displayed on my terminal. My project structure is Project structure. How do I fix it so when I run npm run lint there are no errors? Project structure with error](https://i.stack.imgur.com/uJIxQ.png). Is the vite a part of the problem as well or not?
The package.json code is:
{
"name": "adopt-me",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"format": "prettier --write \"src/**/*.{js,jsx}\"",
"lint": "eslint \"src/**/*.{js,jsx}\" --quiet",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@vitejs/plugin-react": "4.2.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"prettier": "^2.7.1",
"vite": "3.1.4"
},
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0"
}
}
And vite is
import { defineConfig } from "vite";
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
root: "src",
})
What I did was npm install to see if any dependencies were still not installed which i thought would solve the issue but didn’t. I need answers on how I solve the issue. I want the No files matching the pattern "src/**/*.{js, jsx}" were found.
Please check for typing mistakes in the pattern. to be solved but i need a solution? Does anyone have any?
>Solution :
Vite has its own way of handling projects, different from traditional React setups.
-
Update ESLint Configuration:
In yourpackage.json, change the"lint"script to target all JavaScript and JSX files:"lint": "eslint \"**/*.{js,jsx}\" --quiet", -
Check Vite Configuration:
Confirm that your Vite configuration invite.config.jshas the correctrootsetting:export default defineConfig({ plugins: [react()], root: "src", }) -
Run ESLint:
Executenpm run lintagain to lint your files and check for errors. -
Check File Extensions:
Ensure correct file extensions (".js" or ".jsx") and check for typos in file names. -
Review ESLint Configuration:
Verify your ESLint configuration (.eslintrc.jsor `.eslintrc.json) matches your project structure and needs.
These steps should help resolve the "No files matching the pattern" issue in your Vite-based React project.