Skip to content

Multiple empty lines error when there are none in <script> tags #41

Open
@ghost

Description

I'm not sure if this is actually a eslint-plugin-svelte3 problem or just a general eslint or babel-eslint problem, but it's happening in .svelte files so I thought I'd share it here.

I've installed eslint and extend the "standard" rule set, and then on top of that I've installed this plugin for Svelte 3.

In a .svelte file if I use both a <script context="module"> tag and a normal <script> tag in the same file I get the following lint error:

More than 1 blank line not allowed no-multiple-empty-lines

When I remove one of the script blocks the error goes away. It also goes away if I move the ending </script> tag onto the end of the last line of JS in the context="module" tags.

For example:

<script context="module">
export const foo = ['bar']
</script>

<script>
const baz = 1

console.log(baz)
</script>

This will produce the multiple empty lines error at the beginning of the </script> tag after ['bar']`.

If I change it to this:

<script context="module">
export const foo = ['bar']</script>

<script>
const baz = 1

console.log(baz)
</script>

The error goes away.

This is my .eslintrc.js file:

module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true
  },
  extends: [
    'standard'
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly'
  },
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module'
  },
  plugins: [
    'svelte3'
  ],
  overrides: [
    {
      files: ['**/*.svelte'],
      processor: 'svelte3/svelte3'
    }
  ],
  rules: {
  }
}

I don't think I've set anything up incorrectly, and so far I've only seen the problem in .svelte files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions