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 files are ignored (no error) #464

Closed
fregante opened this issue Apr 17, 2020 · 5 comments
Closed

Svelte files are ignored (no error) #464

fregante opened this issue Apr 17, 2020 · 5 comments

Comments

@fregante
Copy link
Member

fregante commented Apr 17, 2020

Follows #428

Tested on XO 0.29.1 and Node 12.15

This is the relevant configuration suggested on https://github.com/sveltejs/eslint-plugin-svelte3#installation

{
  "xo": {
    "extensions": [
      "svelte"
    ],
    "plugins": [
      "svelte3"
    ],
    "overrides": [
      {
        "files": [
          "**/*.svelte"
        ],
        "processor": "svelte3/svelte3"
      }
    ]
  }
}

Svelte files are ignored, no error appears.
Even if I set "processor": "blah", no errors.
Even if move processor to xo instead of xo.overrides, no errors.
Even if there are simple whitespace errors in the svelte files.

I'd expect XO to at least try loading Svelte files (thanks to the extensions config) and fail, but nothing at all happens.

Not a minimal repro but here's the repo: https://github.com/hankxdev/one-click-extensions-manager/tree/svelte-eslint

@fregante
Copy link
Member Author

fregante commented Apr 17, 2020

For comparison, I tried this eslint config:

module.exports = {
    parserOptions: {
        ecmaVersion: 2019,
        sourceType: 'module'
    },
    extends: "eslint:recommended",
    env: {
        es6: true,
        browser: true
    },
    plugins: [
        'svelte3'
    ],
    overrides: [{
        files: ['**/*.svelte'],
        processor: 'svelte3/svelte3'
    }]
};

and I do get these errors:

❯ npx eslint src/*.svelte --ext svelte

./src/App.svelte
   8:14  error  'chrome' is not defined                   no-undef
   9:18  error  'chrome' is not defined                   no-undef
  14:6   error  'optionsShown' is defined but never used  no-unused-vars
  40:23  error  'browser' is not defined                  no-undef
  67:25  error  'event' is defined but never used         no-unused-vars

./src/Extension.svelte
  12:18  error    'chrome' is not defined                      no-undef
  15:28  error    'event' is defined but never used            no-unused-vars
  19:4   error    'browser' is not defined                     no-undef
  24:28  error    'event' is defined but never used            no-unused-vars
  25:3   error    'browser' is not defined                     no-undef
  58:3   warning  A11y: <a> element should have child content  a11y-missing-content
  62:4   warning  A11y: <a> element should have child content  a11y-missing-content
  64:3   warning  A11y: <a> element should have child content  a11y-missing-content

When I run it without the overrides I do get these errors:

❯ npx eslint src/*.svelte --ext svelte

./src/App.svelte
  1:1  error  Parsing error: Unexpected token <

./src/Extension.svelte
  1:1  error  Parsing error: Unexpected token <

✖ 2 problems (2 errors, 0 warnings)

Whereas a very explicit xo src/App.svelte --extension=svelte only exits with 0

Also available in the repro repo: https://github.com/hankxdev/one-click-extensions-manager/tree/svelte-eslint

fregante added a commit to hankxdev/one-click-extensions-manager that referenced this issue Apr 18, 2020
fregante added a commit to npmhub/npmhub that referenced this issue Aug 3, 2020
@floer32
Copy link

floer32 commented Dec 8, 2020

Does a maintainer have a suggestion about this? I am hitting the same thing, wondering if I'm missing something subtle.

@sindresorhus
Copy link
Member

The extension option was fixed in 35e6336.

@sindresorhus
Copy link
Member

@fregante
Copy link
Member Author

fregante commented Jan 21, 2021

extensions: ['svelte'] and processor: "svelte3/svelte3" confirmed to work. Thanks!

fregante added a commit to npmhub/npmhub that referenced this issue Jan 21, 2021
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