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

lint infinite loop #770

Merged
merged 4 commits into from
Mar 1, 2020

Conversation

erniehs-zz
Copy link
Contributor

@erniehs-zz erniehs-zz commented Feb 22, 2020

Fixes #769.

@UlisesGascon UlisesGascon changed the title closes #769 lint infinite loop Feb 22, 2020
Copy link
Member

@silvenon silvenon left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! While this technically solves the problem of the infinite loop, it also stops linting test files, which is the intention of lintTest, and leaves it unused.

Instead I propose modifying lintTest to stop autofixing by making lintBase configurable:

const lintBase = (files, options) => {
  return src(files)
    .pipe($.eslint(options)) // options are passed to ESLint
    // ...
}
function lint() {
  return lintBase('app/scripts/**/*.js', { fix: true }) // configure autofix
    .pipe(dest('app/scripts'));
};
// lintTest stays as-is

What do you think?

@silvenon
Copy link
Member

Actually, in lintTest we would have to lose the dest part to prevent writing the file:

function lintTest() {
  return lintBase('test/spec/**/*.js');
};

@erniehs-zz
Copy link
Contributor Author

erniehs-zz commented Feb 23, 2020 via email

@silvenon
Copy link
Member

It would be misleading to write files that we won't use. Is there a reason why you want to write them somewhere?

@erniehs-zz
Copy link
Contributor Author

erniehs-zz commented Feb 23, 2020 via email

@silvenon
Copy link
Member

silvenon commented Feb 24, 2020

Great! Are you willing to add these changes to your PR? And leave the watch part.

@erniehs-zz
Copy link
Contributor Author

erniehs-zz commented Feb 24, 2020 via email

this seems to work, base is now configurable and stopped writing changes.  removed server reload from startTestServer as server reload is in lintBase; no more double reloading.
@erniehs-zz erniehs-zz requested a review from silvenon February 25, 2020 08:47
app/templates/gulpfile.js Outdated Show resolved Hide resolved
@erniehs-zz
Copy link
Contributor Author

erniehs-zz commented Feb 27, 2020 via email

looks good, no double reloading etc..  i wonder if it is worth adding package-lock into the .gitignore?
@erniehs-zz erniehs-zz requested a review from silvenon March 1, 2020 11:01
Copy link
Member

@silvenon silvenon left a comment

Choose a reason for hiding this comment

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

Almost… 🤞😉

app/templates/gulpfile.js Show resolved Hide resolved
@erniehs-zz erniehs-zz requested a review from silvenon March 1, 2020 12:17
Copy link
Member

@silvenon silvenon left a comment

Choose a reason for hiding this comment

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

Great!

@silvenon silvenon merged commit a4d367e into yeoman:master Mar 1, 2020
@silvenon
Copy link
Member

silvenon commented Mar 1, 2020

Thank you for spotting this crippling error. Published in v4.0.0-8. 🚀

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.

lint infinite loop.
4 participants