Skip to content

Emit type declarations #606

@araxor

Description

@araxor

Tell us about your environment

  • ESLint version: 9.18.0
  • eslint-plugin-vue version: 9.32.0
  • eslint-plugin-vue-i18n version: 3.2.0
  • Node version: 20.11.0
  • TypeScript version: 5.7.3

The problem you want to solve.

The plugin does not work well with ESLint TypeScript configuration files (i.e. eslint.config.ts instead of eslint.config.js) because there is no type declaration in the package.

The following TypeScript error is raised:

error TS7016: Could not find a declaration file for module '@intlify/eslint-plugin-vue-i18n'

Your take on the correct solution to problem.

Because the plugin is already written in TypeScript, it should probably work with the following modifications:

  1. In tsconfig.build.json, set compilerOptions.declaration to true
  2. In package.json, set types to dist/index.d.ts

Additional context

A workaround for the issue is to add a dummy declaration file eslint-plugin-vue-i18n.d.ts that looks like this:

declare module '@intlify/eslint-plugin-vue' {
    declare const plugin: {
        configs: {
            base: unknown
            recommended: unknown
            'flat/base': unknown
            'flat/recommended': unknown
        }
        rules: {
            'key-format-style': unknown
            'no-deprecated-i18n-component': unknown
            'no-deprecated-i18n-place-attr': unknown
            'no-deprecated-i18n-places-prop': unknown
            'no-deprecated-modulo-syntax': unknown
            'no-deprecated-tc': unknown
            'no-deprecated-v-t': unknown
            'no-duplicate-keys-in-locale': unknown
            'no-dynamic-keys': unknown
            'no-html-messages': unknown
            'no-i18n-t-path-prop': unknown
            'no-missing-keys-in-other-locales': unknown
            'no-missing-keys': unknown
            'no-raw-text': unknown
            'no-unknown-locale': unknown
            'no-unused-keys': unknown
            'no-v-html': unknown
            'prefer-linked-key-with-paren': unknown
            'prefer-sfc-lang-attr': unknown
            'sfc-locale-attr': unknown
            'valid-message-syntax': unknown
        }
    }

    export default plugin
}

Of course, having the real type declarations would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions