Xo: Cannot disable `@typescript-eslint/consistent-indexed-object-style` within `overrides:` section of package.json

Created on 19 Oct 2020  路  1Comment  路  Source: xojs/xo

Steps to reproduce:

  1. mkdir temp && cd temp && npm init -y
  2. npm i -D xo typescript
  3. Create file a.ts:

    export type T = {
    [key: string]: number;
    };
    
  4. npx xo

  5. Confirm that the @typescript-eslint/consistent-indexed-object-style is reported as expected
  6. Disable the rule from an overrides option in package.json:

    {
    "xo": {
      "rules": {
        "no-await-in-loop": "off"
      },
      "overrides": {
        "files": "**/*.ts",
        "rules": {
          "@typescript-eslint/consistent-indexed-object-style": "off"
        }
      }
    }
    }
    
  7. npx xo

  8. Observe that the error with @typescript-eslint/consistent-indexed-object-style is still reported.
  9. As a sanity check move the "@typescript-eslint/consistent-indexed-object-style": "off" setting outside the "overrides" option:

    {
    "xo": {
      "rules": {
        "no-await-in-loop": "off",
        "@typescript-eslint/consistent-indexed-object-style": "off"
      }
    }
    }
    

... Now it works as is should... But why doesn't it work within the "overrides" option?

enhancement help wanted

Most helpful comment

overrides accepts an array of objects, not just an object.

We should definitely have better validation for this though and throw an error on an incorrect type. PR welcome for that.

>All comments

overrides accepts an array of objects, not just an object.

We should definitely have better validation for this though and throw an error on an incorrect type. PR welcome for that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pizzafox picture pizzafox  路  5Comments

SamVerschueren picture SamVerschueren  路  4Comments

dawsbot picture dawsbot  路  5Comments

niftylettuce picture niftylettuce  路  6Comments

Igor-Scekic picture Igor-Scekic  路  3Comments