Skip to content
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

Allow webpack to compile on lint error #1104

Merged
merged 8 commits into from
Jun 14, 2018
Merged

Allow webpack to compile on lint error #1104

merged 8 commits into from
Jun 14, 2018

Conversation

rmars
Copy link

@rmars rmars commented Jun 11, 2018

#1035 added a bunch of useful eslint rules to the project. However it converted a bunch of lint warnings into errors, and webpack will fail to complile the js bundle on any eslint error. This means that if you develop locally with webpack-dev-server and make any lint errors, you won't get that nice webpack auto reload when you make a javascript change.

This change allows webpack to finish compiling the bundle even if there is a lint error.

@rmars rmars added the area/web label Jun 11, 2018
@rmars rmars self-assigned this Jun 11, 2018
@@ -24,7 +24,13 @@ module.exports = {
exclude: /node_modules/,
use: [
'babel-loader',
{ loader: 'eslint-loader', options: { fix: true } }
{
loader: 'eslint-loader',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we configure this behavior by environment? I'd like to make sure CI breaks when eslint is failing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a stab at doing this; it required separating out our dev and prod webpack configs, which one we use now depends on NODE_ENV.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I support splitting them out, I'm not sure it is required quite yet. Why not just:

options: {
  fix: true,
  emitWarning: process.env.NODE_ENV !== 'production'

@@ -24,7 +24,13 @@ module.exports = {
exclude: /node_modules/,
use: [
'babel-loader',
{ loader: 'eslint-loader', options: { fix: true } }
{
loader: 'eslint-loader',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I support splitting them out, I'm not sure it is required quite yet. Why not just:

options: {
  fix: true,
  emitWarning: process.env.NODE_ENV !== 'production'

@@ -32,6 +32,7 @@
"sinon-stub-promise": "^4.0.0",
"webpack": "^3.5.6",
"webpack-dev-server": "^2.7.1",
"webpack-merge": "^4.1.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a cool library!

@rmars
Copy link
Author

rmars commented Jun 11, 2018

oh yeah! that's way simpler, I much rather that !

loader: 'eslint-loader',
options: {
fix: true,
emitWarning: process.env.NODE_ENV !== 'production'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relating to @grampelberg's comment:

I'd like to make sure CI breaks when eslint is failing.

Our CI configuration runs tests with bin/web test, without setting NODE_ENV. So I think NODE_ENV defaults to 'development' when running tests in CI, in which case branches with lint errors won't actually fail the CI run. Maybe there's a different way to configure this to ensure that CI catches lint errors?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the build sets it correctly and testing doesn't modify from the default (development). Could change it to process.env.NODE_ENV === 'development' and then set NODE_ENV=testing in .travis.yml.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a NODE_ENV to the travis.yml and committed a lint error. If CI fails on this commit we'll know everything works.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eugh,CI still passes. Looks like bin/web doesn't exit even if the build function returns a non-zero exit code. Looking into it now.

@rmars
Copy link
Author

rmars commented Jun 14, 2018

Finally! It works!
https://travis-ci.org/runconduit/conduit/jobs/392359561

The command "./bin/web" failed and exited with 1 during .
Your build has been stopped.

I'm going to fix the lint error now, and this should be ready to go.

Copy link
Member

@klingerf klingerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️ Great, thanks for addressing my feedback!

@rmars rmars merged commit 72415d1 into master Jun 14, 2018
@rmars rmars deleted the rmars/tweak-eslint branch June 14, 2018 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants