Skip to content

Emit type declarations #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
araxor opened this issue Feb 13, 2025 · 0 comments · Fixed by #607
Closed

Emit type declarations #606

araxor opened this issue Feb 13, 2025 · 0 comments · Fixed by #607
Labels
help wanted Extra attention is needed

Comments

@araxor
Copy link
Contributor

araxor commented Feb 13, 2025

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.

@ota-meshi ota-meshi added the help wanted Extra attention is needed label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants