-
Notifications
You must be signed in to change notification settings - Fork 236
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
ci: run against upcoming next major ESLint version #1534
Conversation
e84b02a
to
a4b95d7
Compare
It seems like ESLint v9 somehow has different globals resulting in |
d77a688
to
d62e847
Compare
d62e847
to
05bae05
Compare
Seems that I've confirmed this is only a development problem - everything works fine on a standard project that's using |
5c07150
to
6b74595
Compare
6b74595
to
4906b85
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.
exciting!
jest.config.ts
Outdated
coveragePathIgnorePatterns: ['/node_modules/'], | ||
}, | ||
], | ||
} satisfies Config.InitialOptions; |
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.
} satisfies Config.InitialOptions; | |
} satisfies Config; |
why satisfies
instead of assigning?
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.
because assigning means it is Config
- so all properties marked as required are such, and optional ones are that outside of the assignment; so TypeScript won't let us do things on those properties later down without existence checks - sadly it's not perfect: we've got to define properties we want to use since the type information is not retained after the assignment, which is why we've got coveragePathIgnorePatterns
explicitly defined with its default values.
Having said that, I've not checked out Config.InitialOptions
so that might change things
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.
Ok so jest.Config
is just a re-export of Config.InitialOptions
- so yeah, we could do either or; I think using satisfies
is slightly nicer though.
To make it a bit clearer:
that's what happens if you use assignment, and it's because to TypeScript config
is type Config
rather than the actual object we created.
@@ -154,6 +155,20 @@ describe('the rule', () => { | |||
expect(() => { | |||
const linter = new TSESLint.Linter(); | |||
|
|||
/* istanbul ignore if */ | |||
if (usingFlatConfig()) { |
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.
why is this needed?
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.
Because we're effectively running ESLint here per usual - so when using ESLint v9 we have to use flatconfig and when using pre-v9 we have to use legacy config.
While linter.verify
supports being passed both types of configs, since we have call defineRule
in pre-v9 (which errors in v9) this felt the cleanest way to address it (though either way we'll always need usingFlatConfig
.
|
||
export class FlatCompatRuleTester extends TSESLint.RuleTester { | ||
public constructor(testerConfig?: TSESLint.RuleTesterConfig) { | ||
super(FlatCompatRuleTester._flatCompat(testerConfig)); |
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.
is it ok to use this private thing?
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.
it's our private thing so yes :)
(its static since this is in the constructor and it felt a little nicer than having it as an external function)
🎉 This PR is included in version 28.0.0-next.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 28.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hopefully this'll just work...it did not, but now it does!