question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use onwarn and other options from svelte.config.js for every tool

See original GitHub issue

Currently there are three places where I should configure ignores for svelte’s a11y warnings:

  1. language server

    lspconfig.svelte.setup{
      cmd = { "yarn", "svelteserver", "--stdio" };
      on_attach = on_attach;
      settings = {
        svelte = {
          plugin = {
            svelte = {
              compilerWarnings = {
                ["a11y-no-onchange"] = "ignore"
              }
            }
          }
        }
      }
    }
    
  2. svelte-check, which makes package.json look ugly when configured and this is only place to configure it

    {
      "val": "svelte-check --compiler-warnings a11y-no-onchange:ignore",
      "validate": "yarn val --threshold warning && yarn tsc --noEmit"
    }
    
  3. eslint

    settings: {
      'svelte3/ignore-warnings': ({ code }) => code === 'a11y-no-onchange',
      // ...
    },
    

I would love to configure it in one place: svelte.config.js. It can’t be avoided because of svelte-preprocess and also these tools are reading it anyway for svelte-preprocess, why not use it for onwarn?

Also in the current situation I can’t make per-project configurations for language server.

Ideally, I would like to use svelte.config.js both in language tools and bundler and configure everything svelte-related there. This stuff too: https://github.com/sveltejs/language-tools/tree/master/packages/svelte-vscode#settings

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
dummdidummcommented, Mar 4, 2021

Candidates for harmonization of onwarn in my opinion are: language-server, svelte-check, rollup plugin, webpack plugin.

2reactions
Conduitrycommented, Mar 4, 2021

I’m rather concerned about adding svelte.config.js support to things that already have well established mechanisms for configuration. In ESLint, for example, plugins are just passed the configuration object that ESLint has already loaded. This could be the result of the merging of several hierarchical .eslintrc.js files (or JSON files, or YAML files, or the contents of the eslintConfig keys in package.json files), and I don’t think ESLint tells the plugin where any of these files were, so I don’t know where the plugin ought to look for svelte.config.js. There’s a single unified way for configuration to be handled, and ESLint core wants to be responsible for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration • Docs • SvelteKit
Your project's configuration lives in a svelte.config.js file at the root of your project. As well as SvelteKit, this config object is used...
Read more >
Top 5 svelte-preprocess Code Examples - Snyk
Learn more about how to use svelte-preprocess, based on svelte-preprocess code examples created from the most popular ways it is used in public...
Read more >
Starting our Svelte to-do list app - Learn web development
To learn how to create a Svelte component, render it inside another component, pass data into it using props, and save its state....
Read more >
svelte - npm
There are 980 other projects in the npm registry using svelte. ... { js, css, ast } - Compile the component with the...
Read more >
rollup-plugin-svelte v7.1.0 - npm.io
Usage. // rollup.config.js import svelte from 'rollup-plugin-svelte'; import resolve ... let Rollup handle all other warnings normally handler(warning); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found