eslint-config-xo icon indicating copy to clipboard operation
eslint-config-xo copied to clipboard

Migrate to flat config

Open fisker opened this issue 1 year ago • 10 comments

fisker avatar Jun 06 '24 03:06 fisker

eslint-config-xo-typescript may need expose an array instead of an object https://github.com/xojs/eslint-config-xo-typescript/blob/3271346cfa8cdc2d44bee64718399eea9f603ea3/index.js#L737

Should we expose an array here too?

So user can

export {default} from 'eslint-config-xo';

and

import eslintConfigXo from 'eslint-config-xo';

export default [
-	eslintConfigXo,
+	...eslintConfigXo,
];

fisker avatar Jun 06 '24 03:06 fisker

eslint-config-xo-typescript

Do you need separate packages anymore? My understanding is that configurations are now configurable, so you can just expose a function and pass typescript:true, spaces:4, etc if needed. See https://github.com/antfu/eslint-config?tab=readme-ov-file#customization

Perhaps you can work on a baseline eslint-config-xo first and the progressively integrate the rest after a successful launch.

fregante avatar Jun 06 '24 04:06 fregante

But eslint-config-xo-typescript need extra packages installed/imported, it's not good if user only uses js syntax.

fisker avatar Jun 06 '24 04:06 fisker

Should we expose an array here too?

Looks like shared config can be an object, maybe arrays will be flattened too, if it's true, we don't need care, I'll test.

fisker avatar Jun 06 '24 04:06 fisker

But eslint-config-xo-typescript need extra packages installed/imported, it's not good if user only uses js syntax.

That hasn't been a limiting factor for XO itself, which includes TypeScript and Prettier whether you use them or not.

In an ideal world, eslint-config-xo contains all the logic XO needs, and XO becomes a wrapper around eslint and eslint-config-xo without a lot of glue. This way users can choose xo-cli or eslint + eslint-config-xo without losing much.

fregante avatar Jun 06 '24 04:06 fregante

Waiting for answers https://github.com/eslint/eslint/issues/18563

fisker avatar Jun 06 '24 06:06 fisker

I don't want to merge the TS one into this one yet.

The "space" config should be merged into this one though. It was only a separate package because of ESLint limitations.

sindresorhus avatar Jun 06 '24 11:06 sindresorhus

Let's export an array? Check discussion in https://github.com/eslint/eslint/issues/18563

fisker avatar Jun 06 '24 11:06 fisker

👍

sindresorhus avatar Jun 06 '24 11:06 sindresorhus

I would also consider eventually upstreaming eslint-config-xo into xo and let it be run through either xo or be extended and run through eslint.

xo includes cli modules (as well as the whole of Prettier), which eslint wouldn't use. Since there won't be a xo-cli package I think it can stay as eslint-config-xo

fregante avatar Jun 11 '24 12:06 fregante

Sorry that I didn't get time to check feedbacks.

fisker avatar Aug 04 '24 09:08 fisker

Hey, do you think it makes sense to add a legacy support like they did over here in vitest: https://github.com/vitest-dev/eslint-plugin-vitest/pull/434/files

image

Primajin avatar Aug 11 '24 10:08 Primajin

@Primajin Open a new issue for that discussion. Personally I would say: No, it does not make sense :)

voxpelli avatar Aug 11 '24 10:08 voxpelli