sveltejs / eslint-plugin-svelte3

An ESLint plugin for Svelte v3 components.
MIT License
373 stars 43 forks source link

no-unused-vars and $store breaks with svelte@3.16 #48

Closed aphitiel closed 4 years ago

aphitiel commented 4 years ago

The following script is linted with error 'someStore' is assigned a value but never used no-unused-vars with svelte@3.16 but not with svelte@3.15.

<script>
  import {writable} from 'svelte/store';
  const someStore = writable({});
</script>

{$someStore}

To reproduce, I had installed the following:

    "eslint": "^6.7.2",
    "eslint-plugin-svelte3": "^2.7.3",
    "svelte": "^3.16.0"

And used this minimal .eslintrc.js:

module.exports = {
  root: true,
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    es6: true,
  },
  plugins: [
    'svelte3'
  ],
  overrides: [
    {
      files: ['**/*.svelte'],
      processor: 'svelte3/svelte3'
    }
  ],
  rules: {
    'no-unused-vars': 'error',
  },
};
Conduitry commented 4 years ago

This is a bug in the warnings emitted by Svelte - https://github.com/sveltejs/svelte/issues/4021 - It's been fixed on master but not yet released.