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

Overrides rules provided in `typescript` object is applied before type-awares rules

Open TotomInc opened this issue 8 months ago • 2 comments

Describe the bug

When enabling type-aware rules, the rules provided in the typescript object aren't pushed as the last config items:

import antfu from '@antfu/eslint-config'

export default antfu({
  typescript: {
    tsconfigPath: './tsconfig.json',

    parserOptions: {
      EXPERIMENTAL_useProjectService: true,
    },

    overrides: {
      // Should not trigger an ESLint error on `main.ts#L4`.
      'ts/no-unsafe-argument': 'off',
    },
  },
})
// main.ts
import { createApp } from 'vue'
import App from './App.vue'

// Unsafe argument of type `any` assigned to a parameter of type `Component<any, any, any, ComputedOptions, MethodOptions, {}, any>`.
// eslint (ts/no-unsafe-argument)
//                    ⌄
const app = createApp(App)
app.mount('#app')

CleanShot 2024-07-01 at 11 15 34

Reproduction

https://github.com/TotomInc/antfu-eslint-repro

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 93.69 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    pnpm: 8.15.1 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 126.1.67.123
    Chrome: 126.0.6478.127
    Safari: 17.5

Used Package Manager

npm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

Contributions

  • [ ] I am willing to submit a PR to fix this issue
  • [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

TotomInc avatar Jul 01 '24 09:07 TotomInc