Closed maxdzin closed 8 months ago
@ota-meshi thank you for the update! The flat config support is a good step forward!
However, there's another issue after installing v3.0.0-next.8
:
> eslint .
Oops! Something went wrong! :(
ESLint: 8.57.0
ESLint couldn't find a configuration file. To set up a configuration file for this project, please run:
npm init @eslint/config
ESLint looked for configuration files in /home/.../testapp and its ancestors. If it found none, it then looked in your home directory.
If you think you already have a configuration file or if you need more help, please stop by the ESLint Discord server: https://eslint.org/chat
eslint.config.mjs
is used there with this updated configuration:
import vueI18n from '@intlify/eslint-plugin-vue-i18n'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import vitest from 'eslint-plugin-vitest'
import withNuxt from './.nuxt/eslint.config.mjs'
/** @type {import('eslint').Linter.FlatConfig[]} */
export default withNuxt([
{
ignores: [
'.nitro/**',
'.nuxt/**',
'.output/**',
'.vscode/**',
'dist/**',
'node_modules/**',
'coverage/**',
],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.vue'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'vue/no-v-html': 'off',
},
},
{
files: ['tests/**'],
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
languageOptions: {
globals: {
...vitest.environments.env.globals,
},
},
},
eslintPluginPrettierRecommended,
// Refers to https://eslint-plugin-vue-i18n.intlify.dev/started.html
...vueI18n.configs['flat/recommended'],
{
rules: {
// Optional.
'@intlify/vue-i18n/no-dynamic-keys': 'error',
'@intlify/vue-i18n/no-unused-keys': [
'error',
{
extensions: ['.js', '.ts', '.vue'],
},
],
},
settings: {
'vue-i18n': {
// extension is glob formatting!
localeDir: './locales/*.{json,json5,yaml,yml}',
// Specify the version of `vue-i18n` you are using.
// If not specified, the message will be parsed twice.
messageSyntaxVersion: '^9.0.0',
},
},
},
])
@maxdzin Thank you for your feedback!
eslint-plugin-vue-i18n supports flat config and this issue of flat config support has been resolved. Please open a new issue, as we would like to treat the above issue you submitted separately from this one.
flat config can be debugged with config-inspector. https://github.com/eslint/config-inspector Also, please provide a minimal reproduction configuration with your repo.
Thank you!
Tell us about your environment
The problem you want to solve. A possibility to use the
@intlify/eslint-plugin-vue-i18n
plugin, its rules, etc. in theeslint.config.mjs
configuration file.Your take on the correct solution to problem. I tried to import the plugin but it seems not working or I'm doing it wrong. Here's how I tried to use that:
Additional context
And so the error I got: