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

Update --print-pending logic to ignore existing pending modules that have no linting errors #954

Merged
merged 3 commits into from
Dec 20, 2019

Conversation

gmurphey
Copy link
Contributor

Was changing my rule configuration and running ember-template-lint . --print-pending to generate an updated pending list of files and noticed that there were some entries that looked like this:

{
 "moduleId": "my/path/to/a/template",
 "only": [
    null
  ]
},

Debugging led me to realize these were being added to the output for --print-pending due to an error being thrown during linting saying Pending module ('my/path/to/a/template') passes all rules. Please remove 'my/path/to/a/template' from pending list.

This PR adds a check when building the output for --print-pending to make sure that the error thrown by the linter has a rule.

Thanks for this great tool!

Copy link
Member

@rwjblue rwjblue 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 working to fix this!

@@ -166,7 +166,13 @@ function run() {

if (printPending) {
let failingRules = Array.from(
fileErrors.reduce((memo, error) => memo.add(error.rule), new Set())
fileErrors.reduce((memo, error) => {
if (error.rule) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of making this kindof implicit, can we add a special .code / .rule value that we can check for?

I'm thinking we can tweak this:

messages.push({
message: `Pending module (\`${options.moduleId}\`) passes all rules. Please remove \`${options.moduleId}\` from pending list.`,
moduleId: options.moduleId,
severity: 2,
});

And add a rule: 'invalid-pending-module' or something.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion! Should be more clear now.

@rwjblue
Copy link
Member

rwjblue commented Dec 12, 2019

Friendly ping @gmurphey 😸

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@rwjblue rwjblue merged commit 66c3c1f into ember-template-lint:master Dec 20, 2019
@gmurphey gmurphey deleted the ignore-passing-pending branch December 20, 2019 20:04
@rwjblue rwjblue added the bug label Dec 20, 2019
@rwjblue rwjblue changed the title Ignoring existing pending modules that have no linting errors Update --print-pending logic to ignore existing pending modules that have no linting errors Dec 20, 2019
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.

2 participants