antfu / eslint-config

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

Avoid using type aware rules in astro plugin #477

Open TheElegantCoding opened 2 weeks ago

TheElegantCoding commented 2 weeks ago

Describe the bug

in the eslin-plugin-astro there is an issue not resolved about type aware rules, this issue

yes this can be avoided just by warning people, but also this affects how the linting rules are in a script tag, in my reproduction i put no-console rule and only work on the begginnig of the file and not in the script tag, but this can work if we put as they say in this another issue, this config like this, all works

  {
      files: ["*.astro"],
      processor: "astro/client-side-ts"
  }
  {
    files: [ '**/*.astro/*.ts', '*.astro/*.ts' ],
    languageOptions:
    {
      globals: {
        ...globals.browser
      },
      parser: parserTs,
      parserOptions:
      {
        project: null
      },
      sourceType: 'module'
    },

keep in mind that we need to override the parserOptions in order to work

i add an example of a working config with no errors in the file example.eslint.config.js

Reproduction

https://github.com/TheElegantCoding/astro-eslint-issue

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 4.68 GB / 15.87 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD        
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.5 - ~\AppData\Local\pnpm\pnpm.CMD
    bun: 1.1.3 - ~\AppData\Roaming\npm\bun.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.19041.4355

Used Package Manager

pnpm

Validations

Contributions

TheElegantCoding commented 2 weeks ago

i found a possible solution and also an issue that can be related to @stylistic/eslint-plugin, in the repo of typescript and in the docs ther is this file for disabled type aware rules they mention that in this link in the doc, this could be a way to disable all rules by default and also when i finally run all my config i found the @stylistic/eslint-plugin/eol-last don't work well

the rule said i have an extra soace in the end of the file, but is false image

and when it auto fix do this, putting the tag at the end

image