-
Notifications
You must be signed in to change notification settings - Fork 234
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
refactor: make config rules static rather than based off rule metadata #1506
Conversation
const recommendedRules = { | ||
'jest/expect-expect': 'warn', | ||
'jest/no-alias-methods': 'error', | ||
'jest/no-commented-out-tests': 'warn', | ||
'jest/no-conditional-expect': 'error', | ||
'jest/no-deprecated-functions': 'error', | ||
'jest/no-disabled-tests': 'warn', | ||
'jest/no-done-callback': 'error', | ||
'jest/no-export': 'error', | ||
'jest/no-focused-tests': 'error', | ||
'jest/no-identical-title': 'error', | ||
'jest/no-interpolation-in-snapshots': 'error', | ||
'jest/no-jasmine-globals': 'error', | ||
'jest/no-mocks-import': 'error', | ||
'jest/no-standalone-expect': 'error', | ||
'jest/no-test-prefixes': 'error', | ||
'jest/valid-describe-callback': 'error', | ||
'jest/valid-expect': 'error', | ||
'jest/valid-expect-in-promise': 'error', | ||
'jest/valid-title': 'error', | ||
} satisfies Record<string, TSESLint.Linter.RuleLevel>; | ||
|
||
const styleRules = { | ||
'jest/no-alias-methods': 'warn', | ||
'jest/prefer-to-be': 'error', | ||
'jest/prefer-to-contain': 'error', | ||
'jest/prefer-to-have-length': 'error', | ||
} satisfies Record<string, TSESLint.Linter.RuleLevel>; |
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.
how can we ensure this is kept in sync with docs and the meta prop?
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.
The docs are generated based on this (specifically, it builds the plugin and looks at the resulting configs
object), and the meta props are going away - I've not removed them yet because the types currently still require them and that it might technically be breaking, though I could axe category
in this PR if you like
e62a64f
to
6b73dec
Compare
🎉 This PR is included in version 28.0.0-next.1 🎉 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 📦🚀 |
Rule metadata is really typed for how
@typescript-eslint
use it and their recent majors have changed exports so we can't actually argument their interfaces anymore so this switches us to just using a static object.I've not done anything fancy like having dedicated files in
configs/
because I don't think there's a big advantage at this point and frankly I just want to push through to the ESLint v9 /@typescript-eslint
v (I think 7..?) so will revisit restructuring later once the dust has settled.I've also not removed the actual properties from the rules as I think that technically could be a breaking change? but I have at least tested without them locally to ensure all the scripts and workflow still work.