Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No files matching pattern "src/**/*.{js, jsx}" were found. Please check for typing mistakes in the pattern. React js problem

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

  1. Update ESLint Configuration:
    In your package.json, change the "lint" script to target all JavaScript and JSX files:

    "lint": "eslint \"**/*.{js,jsx}\" --quiet",
    
  2. Check Vite Configuration:
    Confirm that your Vite configuration in vite.config.js has the correct root setting:

    export default defineConfig({
        plugins: [react()],
        root: "src",
    })
    
  3. Run ESLint:
    Execute npm run lint again to lint your files and check for errors.

  4. Check File Extensions:
    Ensure correct file extensions (".js" or ".jsx") and check for typos in file names.

  5. Review ESLint Configuration:
    Verify your ESLint configuration (.eslintrc.js or `.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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading