Skip to content

Commit

Permalink
added react-scripts lint & e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Jue committed Sep 5, 2017
1 parent f495c15 commit a452a0f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/react-scripts/bin/react-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

const results = spawn(
'node',
[
require.resolve('eslint/bin/eslint'),
'--config',
eslintConfigPath,
'src/**/*.{js,jsx}',
],
{ 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?');
Expand Down
6 changes: 6 additions & 0 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

# Test the build
npm run build
# Check for expected output
Expand Down

0 comments on commit a452a0f

Please sign in to comment.