# svelte/valid-compile

disallow warnings when compiling.

  • ⚙️ This rule is included in "plugin:svelte/recommended".

# 📖 Rule Details

This rule uses Svelte compiler to check the source code.

<script>
  /* eslint svelte/valid-compile: "error" */
  let src = 'tutorial/image.gif';
</script>

<!-- ✓ GOOD -->
<img {src} alt="Rick Astley dances." />

<!-- ✗ BAD -->
<img {src} />

Note that we exclude reports for some checks, such as missing-declaration, and dynamic-slot-name, which you can check with different ESLint rules.

# 🔧 Options

{
  "svelte/valid-compile": [
    "error",
    {
      "ignoreWarnings": false
    }
  ]
}
  • ignoreWarnings … If set to true, ignores any warnings other than fatal errors reported by the svelte compiler.
<script>
  /* eslint svelte/valid-compile: ["error", { ignoreWarnings: true }] */
  let src = 'tutorial/image.gif';
</script>

<!-- Ignore -->
<img {src} />

# 🚀 Version

This rule was introduced in eslint-plugin-svelte v0.7.0

# 🔍 Implementation