-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added react-scripts lint #2729
added react-scripts lint #2729
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,32 @@ switch (script) { | |
process.exit(result.status); | ||
break; | ||
} | ||
case 'lint': { | ||
let eslintConfigPath; | ||
|
||
try { | ||
eslintConfigPath = require.resolve('eslint-config-react-app'); | ||
} catch (e) { | ||
eslintConfigPath = require.resolve('../../../package.json'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would |
||
} | ||
|
||
const results = spawn( | ||
'node', | ||
[ | ||
require.resolve('eslint/bin/eslint'), | ||
'--config', | ||
eslintConfigPath, | ||
'src/**/*.{js,jsx}', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to include It's interesting that this doesn't filter tests out. I guess we can say it's a feature. (Currently there's no way to lint tests.) |
||
], | ||
{ stdio: 'inherit' } | ||
); | ||
|
||
results.on('error', err => { | ||
console.log('Error running ESLint: ' + err); | ||
process.exit(results.status); | ||
}); | ||
break; | ||
} | ||
default: | ||
console.log('Unknown script "' + script + '".'); | ||
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 { | |
# Enter the app directory | ||
cd test-app | ||
|
||
# Test lint | ||
./node_modules/.bin/react-scripts lint | ||
|
||
# Test the build | ||
npm run build | ||
# Check for expected output | ||
|
@@ -314,6 +317,9 @@ npm link "$root_path"/packages/eslint-config-react-app | |
npm link "$root_path"/packages/react-dev-utils | ||
npm link "$root_path"/packages/react-scripts | ||
|
||
# Test lint | ||
"$root_path"/packages/react-scripts/bin/react-scripts.js lint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't make sense to me. What is this testing? After you eject, So the script clearly doesn't "still work" after ejecting. If you had |
||
|
||
# Test the build | ||
npm run build | ||
# Check for expected output | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this throw and why? I don't understand.