Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
183
rated 0 times [  190] [ 7]  / answers: 1 / hits: 65007  / 7 Years ago, thu, january 4, 2018, 12:00:00

I have a folder structure similar to this:



/root
.eslintrc.json
package.json
/someFolder
/sub
/sub
/anotherFolder
/src
/containers
/components
/oneMoreFolder
/sub
/sub


I'm working with create-react-app and am applying airbnb rules. I have been able to run the linter in a specific folder easily from the CLI but on compile, it targets ALL folders.



I want to run the linter on compile on just the files within the /src folder.



How can I go about this? I've tried a number of solutions.



Thank you!



TL:DR How do I target just one subfolder and all of its files on compile when using eslint and create-react-app?


More From » eslint

 Answers
25

You need to do something like eslint src/**/*.js[x]. If you are running a webpack build(or precommit hook) that does linting check then add it within the scripts object inside package.json.


[#55550] Friday, December 29, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cadendericki

Total Points: 482
Total Questions: 109
Total Answers: 103

Location: Ecuador
Member since Thu, Jun 4, 2020
4 Years ago
cadendericki questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Wed, Jul 8, 20, 00:00, 4 Years ago
Thu, May 14, 20, 00:00, 4 Years ago
;