Skip to content

Conversation

@gkjung
Copy link
Contributor

@gkjung gkjung commented Jul 29, 2022

If any of the same paths are processed by eslint and eslint-lwc, we emit a warning to the user that they should use target patterns in the config file.

@gkjung gkjung force-pushed the d/W-11446192 branch 4 times, most recently from 03cab58 to 3bcb517 Compare July 29, 2022 20:21
"targetSkipped": "Target: '%s' was not processed by any engines.",
"targetsSkipped": "Targets: '%s' were not processed by any engines."
"targetsSkipped": "Targets: '%s' were not processed by any engines.",
"pathDoubleProcessed": "A file was processed by both ESLint and ESLint-LWC, which may result in duplicate violations. Check out our documentation on target patterns to cuztomize which paths each engine should target.",
Copy link
Contributor

Choose a reason for hiding this comment

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

In each of these, "cuztomize" should be "customize".

@gkjung gkjung requested a review from jfeingold35 July 29, 2022 21:31
Comment on lines 128 to 135
if (pathsDoubleProcessed.length === 1) {
uxEvents.emit(EVENTS.WARNING_ALWAYS, messages.getMessage('warning.pathDoubleProcessed'));
} else if (pathsDoubleProcessed.length > 1) {
uxEvents.emit(EVENTS.WARNING_ALWAYS, messages.getMessage('warning.pathsDoubleProcessed'));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@gkjung Could you help understand - I feel like I'm missing something obvious - if the warning messages are going to be the same, why do we need an if/else? Can't we do a >=1 check?

Also, can we include the file names that got analyzed by both engines? A comma-separated string with contents of pathsDoubleProcessed would help users create a cleaner target pattern.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it, singular vs plural.
If we were to include the file names, would it be possible to keep it a single message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be cleaner, I'm not sure the best way to phrase the message to suit both. What if the first sentence was At least one file was processed by both ESLint and ESLint-LWC, which may result in duplicate violations.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about including the file names, but if they had several I wasn't sure how to do that without the message getting really long. Any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. How about we put a limit on number of files included in the message? We could list out up to 10 file paths/names and conditionally add and more if the list has more remaining that we didn't cover.

I like the sentence structure. @teresa-allen-sfdc Please let us know your thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what it's currently looking like WARNING: At least one file was processed by both ESLint and ESLint-LWC simultaneously, which could result in duplicate violations. Customize targetPatterns properties for eslint and eslint-lwc engines in /Users/grace.jung/.sfdx-scanner/Config-pilot.json to remove overlap on the following file(s): /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/invalid-lwc/invalidApiDecorator/noLeadingUpperCase.js, /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/projects/dep-test-app/folder-a/SomeGenericFile.js, /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/projects/dep-test-app/folder-a/jquery-3.1.0.js, /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/projects/dep-test-app/folder-b/AnotherGenericFile.js, /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/projects/dep-test-app/folder-b/jquery-3.5.1.js, /Users/grace.jung/Desktop/sfdx-scanner/test/code-fixtures/projects/dep-test-app/folder-c/Burrito.js, and 26 more. @teresa-allen-sfdc @rmohan20 How does this look? It only require one message for plural/singular and I listed out 5 because it was getting really long with 10

Copy link
Contributor

Choose a reason for hiding this comment

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

@gkjung This looks great! I especially like the and 26 more. We could even stick to just two or three to drive the point across.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think three makes sense, and if they want to see the rest they can always fix those and rerun if there's any still overlapping.

@gkjung gkjung force-pushed the d/W-11446192 branch 4 times, most recently from 1a16a63 to 42454bb Compare August 4, 2022 16:01
@gkjung gkjung merged commit e81a3bd into dev-3 Aug 4, 2022
@stephen-carter-at-sf stephen-carter-at-sf deleted the d/W-11446192 branch May 17, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants