unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
MIT License
3.31k stars 200 forks source link

How to correctly configure the json or js generated by eslintrc in eslint.config v9 version #515

Closed ubuding closed 4 months ago

ubuding commented 4 months ago

I want eslint to check whether my usage is correct when submitting the code. For example, when I write computed(0) eslint will report an error

akinoccc commented 4 months ago

+1

antfu commented 4 months ago

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.

Why reproduction is required

magicalTom commented 3 months ago

貌似和我遇到了同样的问题 这样操作试试:

image
devhaozi commented 1 day ago

This work for me:

import { FlatCompat } from '@eslint/eslintrc'
import unocss from '@unocss/eslint-config/flat'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'

const compat = new FlatCompat()

export default [
  ...pluginVue.configs['flat/essential'],
  ...vueTsEslintConfig(),
  unocss,
  ...compat.extends('./.eslintrc-auto-import.json'),
  skipFormatting,
  {
    name: 'app/files-to-lint',
    files: ['**/*.{ts,mts,tsx,vue}'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
      '@typescript-eslint/no-unused-vars': 'off',
      '@typescript-eslint/no-unused-expressions': 'off',
      '@typescript-eslint/no-empty-function': 'off',
      '@typescript-eslint/no-non-null-assertion': 'off',
      '@typescript-eslint/no-empty-object-type': 'off'
    }
  },
  {
    name: 'app/files-to-ignore',
    ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
  }
]