-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: @sapphire/eslint-plugin-result #556
Conversation
packages/eslint-plugin-result/tests/rules/no-discard-result.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs updating:
- /.npm-deprecaterc.yml
- I see that now we have to prefix the whole of
@sapphire/eslint-plugin
, whereas if the package would just be namedeslint-plugin-result
(which is in fact available) then it could just beresult
. Adding to my other comment about the usage that would also allow"extends": ["result/recommended"]
iirc
@vladfrangu wdyt about dropping our org prefix for this? Or alternativelyeslint-plugin-sapphire-result
.
Didn't review the actual code yet, just did this while waiting for a compile at work
Edit: So I looked up what the naming requirements are and with the current name we'd could do:
"plugins": ["@sapphire/result"]
See: https://eslint.org/docs/latest/use/configure/plugins#include-a-plugin
That has some appeal to it because it matches the actual package name, but at the same time I'm not if that very fact is a good idea. Again I defer to @vladfrangu for his input.
Not a fan of this, @favna. Also, doesn't using just |
Further resolved on Discord. We're sticking to |
c346152
to
082f57e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appear to still be some bugs in the plugin. You can repro the error with:
- Build all (required) packages with
yarn build
in the root folder - Add to
/.eslintrc
extends
:"plugin:@sapphire/result/recommended"
cd packages/result
- Run
yarn lint
- Observe the error:
Oops! Something went wrong! :(
ESLint: 8.28.0
TypeError: Cannot read properties of undefined (reading 'flags')
Occurred while linting /Users/favna/workspace/sapphire/utilities/packages/result/tests/Option.test.ts:832
Rule: "@sapphire/result/no-discard-result"
at Object.getObjectFlags (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:19894:21)
at couldContainTypeVariables (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:69657:34)
at Object.some (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:748:25)
at couldContainTypeVariables (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:69665:167)
at instantiateTypeWithAlias (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:65125:18)
at instantiateType (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:65122:37)
at instantiateList (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:64712:34)
at instantiateTypes (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:64726:20)
at instantiateTypeWorker (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:65166:32)
at instantiateTypeWithAlias (/Users/favna/workspace/sapphire/utilities/node_modules/typescript/lib/typescript.js:65139:26)
2b0c2c9
to
b617753
Compare
* feat: eslint-plugin-result * feat: support for void keyword * chore: cleanup * chore: typo * chore: github meta * chore: suggested changes * refactor(recommended): apply plugin * fix: ensure `eslint-plugin-result` is build before `ts-config` * docs(readme): fixed usage for the plugin * chore: regen lockfile * chore: fix tsconfig for the plugin * fix: hard crashes and lack of foo(bar()) handling * ci: fix linting in CI --------- Co-authored-by: Jeroen Claassens <support@favware.tech>
No description provided.