Skip to content

@const raises a "no-undef" false positive #172

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
kevin-legion opened this issue Feb 23, 2022 · 3 comments
Closed

@const raises a "no-undef" false positive #172

kevin-legion opened this issue Feb 23, 2022 · 3 comments

Comments

@kevin-legion
Copy link

Using the "no-undef" rule makes ESlint raise a "no-undef" error:

false-positive

eslint configuration:

module.exports = {
  env: {
    browser: true,
    es2021: true,
    node: true,
  },
  parser: "@typescript-eslint/parser",
  plugins: ["svelte3", "@typescript-eslint"],
  extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
  overrides: [
    {
      files: ["*.svelte"],
      processor: "svelte3/svelte3",
    },
  ],
  settings: {
    "svelte3/typescript": true,
    "svelte3/ignore-styles": () => true,
  },
  rules: {
    camelcase: "error",
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
    "@typescript-eslint/no-unused-vars": "off",
    "no-var": "error",
    "padding-line-between-statements": [
      "error",
      { blankLine: "always", prev: "*", next: "return" },
      { blankLine: "always", prev: "*", next: "block-like" },
      { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
      {
        blankLine: "any",
        prev: ["const", "let", "var"],
        next: ["const", "let", "var"],
      },
    ],
    "prefer-const": [
      "error",
      {
        destructuring: "any",
        ignoreReadBeforeAssign: false,
      },
    ],
  },
};

Svelte 3.46.4
eslint 8.9.0
eslint-plugin-svelte 3.4.0

@ota-meshi
Copy link
Member

Hi @kevin-legion.
It seems that the fix was released 2 hours before you posted the issue.
https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/CHANGELOG.md#341

@Conduitry
Copy link
Member

Yup, duplicate of #164, already fixed in 3.4.1.

@kevin-legion
Copy link
Author

Thank you for the quick reply, I'll update to the last version 👍

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

No branches or pull requests

3 participants