Skip to content

svelte/valid-prop-names-in-kit-pages triggered on module exports #1098

Closed
@timephy

Description

@timephy

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

v9.21.0

What version of eslint-plugin-svelte are you using?

3.0.0

What did you do?

Configuration
import js from "@eslint/js"
import ts from "typescript-eslint"
import svelte from "eslint-plugin-svelte"
import prettier from "eslint-config-prettier"
import globals from "globals"

/** @type {import('eslint').Linter.Config[]} */
export default [
    js.configs.recommended,
    ...ts.configs.recommended,
    ...svelte.configs["flat/recommended"],
    prettier,
    ...svelte.configs["flat/prettier"],
    {
        languageOptions: {
            globals: {
                ...globals.browser,
                ...globals.node,
                // these types are missing from "globals", but are present in TypeScript lib "dom"
                ScrollBehavior: false,
                RTCPeerConnectionState: false,
                AutoFill: false,
            },
        },
    },
    {
        files: ["**/*.svelte"],
        languageOptions: {
            parserOptions: {
                parser: ts.parser,
                svelteFeatures: {
                    experimentalGenerics: true,
                },
            },
        },
    },
    {
        rules: {
            "@typescript-eslint/no-unused-vars": [
                "warn",
                {
                    argsIgnorePattern: "^_",
                    varsIgnorePattern: "^_",
                    caughtErrorsIgnorePattern: "^_",
                },
            ],
            "@typescript-eslint/no-unused-expressions": "warn",
            "svelte/valid-compile": [
                "error",
                {
                    ignoreWarnings: true,
                },
            ],
            "no-useless-escape": "warn",
            "no-fallthrough": "off",
            "svelte/require-each-key": "off",
        },
    },
    {
        ignores: [
            "**/build/",
            "**/build-*/",
            "**/dist/",
            "**/.svelte-kit/",
            // only ignore generated files directly in this directory, but not in subdirectories
            "**/i18n/*.ts",
        ],
    },
]

<script lang="ts" module>
    // ❗ ERROR: disallow props other than data or errors in SvelteKit page components.eslint[svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/)
    export const LANG_PATH: Record<Locales, string> = {
        en: "",
        de: "/de",
        es: "/es",
        fr: "/fr",
        hi: "/hi",
        it: "/it",
        ru: "/ru",
    }
</script>

What did you expect to happen?

exported module constants should be allowed to have any name.

What actually happened?

This is the linting error:

disallow props other than data or errors in SvelteKit page components.eslint[svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/)

Link to GitHub Repo with Minimal Reproducible Example

--

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions