xojs/xo

Better solution for configs & plugins in dependencies

jonahsnider opened this issue · 6 comments

It's been nearly 6.5 years since eslint/eslint#3458 was opened and very little progress has been made on their side.
What can we do to improve the XO user experience while we wait for a fix from ESLint?

The best solution seems to be using Microsoft's @rushstack/eslint-patch to patch ESLint's module resolver.

Another solution which worked for TypeScript + XO users is using bundledDependencies in package.json.

Related:

Most issues are for XO + Prettier.

It's been nearly 6.5 years since eslint/eslint#3458 was opened and very little progress has been made on their side.

I wouldn't say that. They're working on a new config format which will enable this: eslint/eslint#13481 It's likely it will happen this year: eslint/eslint#15383 (comment)

The best solution seems to be using Microsoft's @rushstack/eslint-patch to patch ESLint's module resolver.

This patches ESLint and could break at any time. It might also break certain cases. I don't think I want to risk that.

Another solution which worked for TypeScript + XO users is using bundledDependencies in package.json.

I'm unlikely to bundle dependencies in XO.

This patches ESLint and could break at any time. It might also break certain cases. I don't think I want to risk that.

Could enabling the patch be done via a CLI flag so it's explicitly opt-in?

It technically could, but I'm still the one that has to deal with any issues that occur with the CLI flag specified. I would personally prefer to just wait it out.

mmkal commented

I wrote a wrapper plugin that requires no patching, plays by the rules of eslint and nodejs, and allows plugins and configs to act pretty much like normal dependencies. As a bonus, it lets you locally define rules for your project that don’t need to be published in a separate package. It’s also pretty simple, just a single file with no dependencies itself. (There is a trade off - it prefixes the rules it wraps, and requires using a JavaScript, not json/yaml, config file)

We’ve been using it at my work for a while and it works well enough, while we wait for the proper solution.

The flat config has landed in ESLint. This is the way to go now: