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

chore(eslint): add unicorn/prefer-spread rule #2878

Merged
merged 10 commits into from
Sep 26, 2023

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Sep 20, 2023

To avoid to have to many changes by enabling plugin:unicorn/recommended, I choose to enable some rule one-by-one.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md

Part of #2824

Covers #2742

@csouchet csouchet added chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first refactoring Code refactoring labels Sep 20, 2023
@github-actions
Copy link

github-actions bot commented Sep 20, 2023

♻️ PR Preview 146d084 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Sep 20, 2023

♻️ PR Preview 146d084 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@csouchet csouchet force-pushed the 2742-add_unicorn/prefer-spread_rule branch 6 times, most recently from d0dcb42 to ba09dd0 Compare September 21, 2023 08:36
@csouchet csouchet force-pushed the 2742-add_unicorn/prefer-spread_rule branch from 035e723 to b5684bb Compare September 26, 2023 07:42
@csouchet csouchet removed the depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first label Sep 26, 2023
src/component/parser/json/converter/ProcessConverter.ts Outdated Show resolved Hide resolved
@@ -55,10 +55,13 @@ export function ensureIsArray<T>(elements: (T | string)[] | T | string, acceptEm
export function filter<T extends string>(arrayToFilter: T[], suffix: string, options?: FilterParameter): T[] {
let pattern = '';
if (options?.startingWith) {
// eslint-disable-next-line unicorn/prefer-spread -- pattern is a string not an array
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why the rule detects it as string.concat and not array.concat. If so, it is a bug in the rule
I am testing this locally

Copy link
Member

Choose a reason for hiding this comment

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

@csouchet csouchet marked this pull request as ready for review September 26, 2023 09:50
const orderedFlowNodeBpmnTypes: BpmnSemanticType[] = [
'adHocSubProcess',
'transaction',
// specific management for adhoc and transaction sub-processes which are handled with a dedicated ShapeBpmnSubProcessKind
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: move this line above the first "sub-process" values
Currently, the comment is written after these values which make things hard to understand IMHO.

@sonarcloud
Copy link

sonarcloud bot commented Sep 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for integrating the feedback.

@csouchet csouchet merged commit 7bf5238 into master Sep 26, 2023
26 checks passed
@csouchet csouchet deleted the 2742-add_unicorn/prefer-spread_rule branch September 26, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) refactoring Code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants