-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 Flat Config Support #7694
Comments
As per the OP...
We have not used or tested flat configs at all, and we don't know the correct style for configs and we provide no guarantees that anything works. Until we have official support for flat configs - using them with our tooling is considered "no warranty provided" and our advice is to instead using a "classic" config for now. |
+1 I'm very much looking forward to this as well as the FlatESLint config types in the TSEslint and DefinitelyTyped repos! |
This comment has been minimized.
This comment has been minimized.
Yes - it's all "just javascript" so if you manually pull our configs apart then you can reassemble them into the correct shape to satisfy the new flat config structure. But you are relying on implementation details of the configs to pull them apart like this. Instead it's better if you use eslint's compatibility tooling to work with our configs for now until we have full support. See: https://www.npmjs.com/package/@eslint/eslintrc |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We have a config to help disable type-aware rules: https://typescript-eslint.io/linting/configs#disable-type-checked Which you can apply to just JS files using overrides (aka file filters in flat configs) |
I don't think we can without going inside the config structure which we wanted to avoid in the first place. Though maybe
is good enough. |
Actually, going the other way seems better to me:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
If anyone wants to use our tooling (or any tooling that hasn't updated yet) with flat configs you can do so right now without doing any dodgy stuff like pulling apart our tooling or re-defining our configs. You can use the official compatibility tooling - const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname });
module.exports = [
// use our recommended config
compat.extends("plugin:@typescript-eslint/recommended"),
// use our plugin by itself
compat.plugin("@typescript-eslint"),
// this will define make our rules available as `@typescript-eslint/`
// or translate an entire eslintrc style config!
compat.config({
extends: [
'plugin:@typescript-eslint/recommended-type-checked',
],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
}),
]; Again there's no need to jump through hoops and try to figure out how to disect our packages to attempt to reconstruct them so it works with flat configs - just use the official tooling. However we don't recommend people use flat configs yet just because they are still not fully stable. We haven't released support yet because we have encountered crashes! If you want to use them - please feel free! But know that you are using a beta that doesn't yet support all valid configs and as such you may encounter crashes. Going to lock this for now as this is our officially recommended path for using our tooling in flat configs for now. Once we are ready we shall release support with full documentation. |
This will be releasing with our v7 release next week. |
Edit: typescript-eslint@>=v7 supports ESLint flat config! See: https://typescript-eslint.io/blog/announcing-typescript-eslint-v7
Overview
ESLint is adding an exciting new config system called "flat" configs:
@typescript-eslint/eslint-plugin
does not yet officially support ESLint flat configs. We'd certainly like it to soon. But doing so is a nontrivial in-progress task and isn't done yet. Flat configs with TypeScript code may work in your specific project. They may not.Tracking references:
If you're filing a complex / configuration issue on typescript-eslint, for now, please make sure you're using traditional ESLint configs. We'll post back in this issue once we can officially provide support for using
@typescript-eslint/eslint-plugin
with flat configs.The text was updated successfully, but these errors were encountered: