antfu / eslint-config

Anthony's ESLint config preset
https://eslint-config.antfu.me/
MIT License
3.41k stars 400 forks source link

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

Open TotomInc opened 2 days ago

TotomInc commented 2 days ago

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

Contributions