xojs/xo

xo does not appear to use `extends: ["plugin:?"]` when specified in config

bbugh opened this issue ยท 2 comments

bbugh commented

Hi! ๐Ÿ‘‹๐Ÿป thanks for this great tool, seems like it will save me a ton of time setting this all up on every project.

I noticed that some rules I prefer, like @typescript-eslint/no-non-null-assertion wasn't included, so I attempted to add it by using the extends of xo config in package.json (and .xo-config.json while testing):

  "xo": {
    "extends": [
      "plugin:@typescript-eslint/eslint-recommended",
      "plugin:@typescript-eslint/recommended-requiring-type-checking"
    ]
  }

And expected to see Forbidden non-null assertion. eslint(@typescript-eslint/no-non-null-assertion) on this code:

document.getElementById("whatever")!

but it did not appear. Running

npx xo --print-config src/main.ts

does not show the extra rules provided by the extended plugins.

I've read through the documentation and looked through all of the issues that GitHub's issue search would show and it seems like this should work.

I created an example repo here: https://github.com/bbugh/xo-not-using-extends - just need to run

npm install
npx xo --print-config src/main.ts

I don't know if it's related or not, but ESLint made a rewrite on its configuration system, extends it's not used anymore.

You can check it on:
https://eslint.org/blog/2022/08/new-config-system-part-2/

bbugh commented

I'm not sure either, but from this comment, it doesn't sound like xo is using the prerelease eslint flat config.