Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 of 7 tasks
TotomInc opened this issue Jul 1, 2024 · 2 comments
Open
5 of 7 tasks

Comments

@TotomInc
Copy link

TotomInc commented Jul 1, 2024

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

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • 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!)
@Nisgrak
Copy link
Sponsor

Nisgrak commented Jul 18, 2024

I'm having this same issue, maybe a ...overrides in

'ts/unbound-method': 'error',

@Dimava
Copy link
Contributor

Dimava commented Jul 19, 2024

Workaround: use an extra ruleset

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

    parserOptions: {
      EXPERIMENTAL_useProjectService: true,
    },
  },
}, {
  files: ['**/*.ts'],
  rules: {
    'ts/no-unsafe-argument': 'off',
  },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants