Skip to content
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

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

Closed
2 tasks done
timephy opened this issue Feb 26, 2025 · 0 comments · Fixed by #1100
Closed
2 tasks done

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

timephy opened this issue Feb 26, 2025 · 0 comments · Fixed by #1100

Comments

@timephy
Copy link

timephy commented Feb 26, 2025

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

@timephy timephy changed the title svelte/valid-prop-names-in-kit-pages triggered on module export svelte/valid-prop-names-in-kit-pages triggered on module exports Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant