Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

feat(no-multiple-global-stores): add suggestion #198

Merged

Conversation

rafaelss95
Copy link
Collaborator

@rafaelss95 rafaelss95 commented Sep 13, 2021

Part of #179.

messageId: noMultipleGlobalStores,
suggestions: [
{
messageId: noMultipleGlobalStoresSuggest,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just noticed that updating Typescript and @typescript-eslint fixes the problem in SOME cases of the weird as MessageIds 🤷‍♂️ (I've removed that typecast where applicable... for the others unfortunately, TS keeps complaining).

@@ -66,8 +66,8 @@
"@types/eslint": "^7.28.0",
"@types/node": "^14.14.7",
"@types/prettier": "^2.3.2",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"@typescript-eslint/eslint-plugin": "^4.31.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was impressed that updating just these 3 packages makes such a big diff in package-lock.json.

@@ -20,6 +20,7 @@ export default ESLintUtils.RuleCreator(docsUrl)<Options, MessageIds>({
category: 'Best Practices',
description: 'Use a consistent name for the global store.',
recommended: 'warn',
suggestion: true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you think it would be a good idea to adjust the README script to include when a rule has suggestions or not?

Copy link
Owner

Choose a reason for hiding this comment

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

Yea, it's on my backlog to add it to the generation of the rules 😅

@rafaelss95 rafaelss95 force-pushed the feat/no-multiple-stores-fixer branch from c5abe37 to a1e2d1a Compare September 13, 2021 15:17
Comment on lines 25 to -35
export class OnePlusExtraOk {
constructor(private store: Store, data: Service) {}
}`,
`
export class FirstOk {
constructor(private store: Store, data: Service) {}
}

export class SecondOk {
constructor(private store: Store, data: Service) {}
}`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've removed these because they are repeated.

@rafaelss95 rafaelss95 force-pushed the feat/no-multiple-stores-fixer branch from a1e2d1a to 83d09f4 Compare September 13, 2021 15:24
Comment on lines +41 to +53
const detailsContent =
err instanceof Error
? `
Details:
${err.message}
`
: ''
context.logger.warn(`
Something went wrong while adding the NgRx ESLint Plugin.
The NgRx ESLint Plugin is installed but not configured.

Please see ${docs} to configure the NgRx ESLint Plugin.

Details:
${err.message}
${detailsContent}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

},
}
},
})

function getRemoveRangeFor(
Copy link
Owner

Choose a reason for hiding this comment

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

Oh, this was more code than I had expected 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah! Dealing with tokens (mostly parenthesis, commas and comments) is really, really boring and lead to a verbose code. I wish it were possible to use use selectors for fixer/suggestions as well 😄

@timdeschryver timdeschryver merged commit 217d110 into timdeschryver:main Sep 13, 2021
@github-actions
Copy link

🎉 This PR is included in version 1.34.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants