-
Notifications
You must be signed in to change notification settings - Fork 40
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
create eslint-plugin-xstate
package
#221
base: main
Are you sure you want to change the base?
Conversation
|
"@typescript-eslint/parser": "^5.37.0", | ||
"concurrently": "6.2.0", | ||
"esbuild": "^0.14.48", | ||
"eslint": "^7.26.0", | ||
"eslint": "^8.0.0", |
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.
We have the config in .eslintrc.js
commented out so updating these doesn't affect anything
"devDependencies": { | ||
"@typescript-eslint/parser": "^5.37.0", | ||
"eslint": "^8.0.0", | ||
"typescript": "^4.3.5" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0", | ||
"typescript": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"typescript": { | ||
"optional": true | ||
} | ||
} |
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.
I'm not entirely sure these dependencies are correct if we end up publishing this package. I somewhat copied the dependencies setup from @typescript-eslint/eslint-plugin
, but they also don't have any of these as devDependencies
which yarn
whined about 🤷
ruleTester.run("avoid-context-spread", rule, { | ||
valid: [ | ||
{ | ||
code: outdent` |
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.
Using outdent
allows the code blocks to be displayed correctly in test output. Not sure if there's a better way to handle that but without it, the indentation was a mess.
Would love to have a discussion on My ultimate goal in playing with this stuff was to use it as the basis for a v5 codemod that automatically migrates codebases (as much as possible, anyway). Perhaps it'd be better to just start with that, or figure out ways to implement this type of stuff through the extension instead of |
f4a3066
to
2dfb6d7
Compare
I would say |
Someone already wrote an |
Hi all! This draft PR contains the start of the
eslint-plugin-xstate
package and will eventually resolve #216.Currently this PR contains implementations for a few rules:
avoid-context-spread
no-cond
no-emitted-from
no-factory-context-arg
require-object-context
require-parameterized-actions-params
require-parameterized-guards-params
Having briefly talked to @Andarist about it, I'm not entirely sure an
eslint
plugin/config makes sense for his vision of XState tooling. It's possible that these rules (and others listed in the issue) would be more useful if implemented as part of the VSCode extension rather than ineslint
.At the very least, this has been a fun exploration of custom
eslint
rules for me and might give us a sense of the type of logic we'd need to implement similar functionality in the extension.