I am using eslint in a react project, I have .jsx, .js, .test.jsx, .test.js files, I want to configure my eslintrc.json file to such that, ,it check .js and .jsx files as well as ignore .test.jsx and .test.jsx file, how may I do that ? Thanks for the help.
1 Answer
You can set a .eslintignore
file, to ignore certain folders and files.
Refer document: ignoring-files-and-directories
You can tell ESLint to ignore specific files and directories by creating an
.eslintignore
file in your project's root directory.
The.eslintignore
file is a plain text file where each line is a glob pattern indicating which paths should be omitted from linting.
For example:
src/serviceWorker.ts
src/react-app-env.d.ts
-
but say i have folder ``` app-| file.js file.test.js ``` then wouldn't adding the folder to .ignore would not be useful. Commented Mar 25, 2020 at 13:30
-
@sudiptdabral well you can make it
app/**/*.test.jsx
, for this issue, you can do it with no doubt, the only thing left is how to write it.– keikaiCommented Mar 25, 2020 at 13:32 -
-
@sudiptdabral It depends on your file structure description, you need to be more specific, maybe a screenshot of it.– keikaiCommented Mar 25, 2020 at 14:23
-
I did add *.test.js in eslintignore file and it worked correctly ! thank you Commented Mar 25, 2020 at 20:29