-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
docs: add example config with typescript-eslint and Prettier #2522
Conversation
- I had to search for a couple of hours to find out how to migrate to the new ESLint v9 flat config `eslint.config.mjs`, so I thought that I could add this to the docs to help others like me to get started with the new flat config
Just in case, this is the config I have for strict type checks: import eslintConfigPrettier from 'eslint-config-prettier';
import pluginVue from 'eslint-plugin-vue';
import tseslint from 'typescript-eslint';
export default tseslint.config(
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...pluginVue.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
parserOptions: {
parser: tseslint.parser,
projectService: true,
extraFileExtensions: ['.vue']
}
}
}
); |
@jfrs your code does seem shorter but trying it out doesn't produce the same result on my side, if I move the but now the problem that I have is that Prettier seems to completely ignore these rules when I said and so is not in sync with the eslint prettier config, not exactly sure why though. @jfrs do you happen to know why? or how to make Prettier use the same config? EDIT taking another look at eslint-config-prettier docs, it seems that we have to add it after the rules so that it disables the rules that are conflicting with Prettier. So I think it's better to keep as the last prop in the flat config |
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.
Sorry for the late review. I like this new section, since it is a common setup and reduces the number of places new users need to visit and get their information from. However, I have a few suggestions, see below.
Co-authored-by: Flo Edelmann <[email protected]>
@FloEdelmann thanks for the review, I made changes with your suggestions. It should be all good now. :) |
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.
Thanks, this looks good to me now 🙂
Since I had myself to search for a couple of hours to find out how to migrate to the new ESLint v9 flat config
eslint.config.mjs
, I thought it could be good to improve the docs to help others like me to get started with the new flat config