File tree 2 files changed +32
-0
lines changed
packages/react-scripts/bin
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,32 @@ switch (script) {
43
43
process . exit ( result . status ) ;
44
44
break ;
45
45
}
46
+ case 'lint' : {
47
+ let eslintConfigPath ;
48
+
49
+ try {
50
+ eslintConfigPath = require . resolve ( 'eslint-config-react-app' ) ;
51
+ } catch ( e ) {
52
+ eslintConfigPath = require . resolve ( '../../../package.json' ) ;
53
+ }
54
+
55
+ const results = spawn (
56
+ 'node' ,
57
+ [
58
+ require . resolve ( 'eslint/bin/eslint' ) ,
59
+ '--config' ,
60
+ eslintConfigPath ,
61
+ 'src/**/*.{js,jsx}' ,
62
+ ] ,
63
+ { stdio : 'inherit' }
64
+ ) ;
65
+
66
+ results . on ( 'error' , err => {
67
+ console . log ( 'Error running ESLint: ' + err ) ;
68
+ process . exit ( results . status ) ;
69
+ } ) ;
70
+ break ;
71
+ }
46
72
default :
47
73
console . log ( 'Unknown script "' + script + '".' ) ;
48
74
console . log ( 'Perhaps you need to update react-scripts?' ) ;
Original file line number Diff line number Diff line change @@ -278,6 +278,9 @@ function verify_module_scope {
278
278
# Enter the app directory
279
279
cd test-app
280
280
281
+ # Test lint
282
+ ./node_modules/.bin/react-scripts lint
283
+
281
284
# Test the build
282
285
npm run build
283
286
# Check for expected output
@@ -314,6 +317,9 @@ npm link "$root_path"/packages/eslint-config-react-app
314
317
npm link " $root_path " /packages/react-dev-utils
315
318
npm link " $root_path " /packages/react-scripts
316
319
320
+ # Test lint
321
+ " $root_path " /packages/react-scripts/bin/react-scripts.js lint
322
+
317
323
# Test the build
318
324
npm run build
319
325
# Check for expected output
You can’t perform that action at this time.
0 commit comments