-
Notifications
You must be signed in to change notification settings - Fork 378
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
ESLint Config Migration: Add test-specific ruleset #1044
Conversation
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.
💯 comment for reasoning 👍
46ec80b
to
4723cc4
Compare
79ef148
to
fcbae2d
Compare
59e4a06
to
9b348fe
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.
approved again
Thanks for your review @seratch; FYI I added two more rule changes (reminder: that only apply to
If you could let me know what you think about those, I would very much appreciate it 🙏 EDIT: 😆 @seratch nevermind you are too fast for me 😂 |
@filmaj Both look good to me 👍 |
Allow use of "as Type" syntax for type assertions in test code. Dont force symbol descriptors in test code
9b348fe
to
7b6be5d
Compare
Summary
This is a PR that should be merged into #1024 and incrementally addresses #842.
This PR adds test-code-specific rules:
prefer-arrow-callback rule
- but only for test files (i.e.**/*.spec.ts
). The use offunction
over arrow syntax actually came up when writing tests in one time in Mocha (see Add tests for SocketModeReceiver (#750) #1012 (review)). As such, we shouldn't have the linter recommend to use only arrow functions in test files, as that may lead to the same situation as in Add tests for SocketModeReceiver (#750) #1012.consistent-type-assertions
rule), to allow for theconst x = { ... } as T
over theconst x: T = { ... }
syntax. The latter requires all properties of a type to be declared, whereas the former requires only the required properties to be defined. I believe theas T
syntax is handy to have in test code.symbol-descriptor
rule and allows for creatingSymbol
objects without a descriptor.Impact
Before
After
Requirements (place an
x
in each[ ]
)