antfu's ESLint Config in Different Frameworks

eslint; config; framework
93 words

Here I'll record how to use antfu's ESLint configuration in different frameworks.

Vue

Vue is supported by default, no additional configuration needed.

eslint.config.mjs

import antfu from '@antfu/eslint-config'

export default antfu({
  formatters: {
    css: true,
    html: true,
    markdown: 'prettier',
  },
})

Nuxt

eslint.config.mjs

import antfu from '@antfu/eslint-config'

export default antfu({
  typescript: {
    tsconfigPath: 'tsconfig.json',
  },
  formatters: {
    css: true,
    html: true,
    markdown: 'prettier',
  },
})

The following configuration must be set, otherwise you'll get errors: when using the default import method from nuxt, you'll get errors like 'useRuntimeConfig' is not defined no-undef, 'useState' is not defined no-undef, etc.

typescript: {
  tsconfigPath: 'tsconfig.json',
},