xojs / xo

❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
MIT License
7.64k stars 291 forks source link

XO shareable configs? #352

Open niftylettuce opened 5 years ago

niftylettuce commented 5 years ago

Should we allow shareable configs to use top level rules such as "prettier" and "space" in shareable XO configs? It would set the option for xo but delete it before passing along to eslint?

Otherwise I have to do this in all my projects:

"xo": {
  "prettier": true,
  "space": true,
  "extends": [ "xo-lass" ]
}
sindresorhus commented 5 years ago

Yes, I think that makes sense. It should be in a "xo" object though, so it won't conflict with ESLint config.

It should support these options:

The rest of the XO options can already be defined as ESLint config.

It can also only be directly in a shareable config and not nested or in an extended config, as ESLint doesn't expose a method to flatten the extend tree.

tkesgar commented 5 years ago

I'd love this feature, and I have attempted to work it out by editing optionsManager.buildConfig (here).

However, I'm unsure on how to handle options.xo.extensions.

(EDIT: Just noticed eslint/eslint#10828 -- if ESLint will supports extensions, then this commit should be enough.)

bojanmilosavljevic commented 1 year ago

Any info on this? Can one create a config with top level options and use xo directly? I've tried doing so, but ESLint then complains about unexpected top-level properties.