Use onwarn and other options from svelte.config.js for every tool
See original GitHub issueCurrently there are three places where I should configure ignores for svelte’s a11y warnings:
-
language server
lspconfig.svelte.setup{ cmd = { "yarn", "svelteserver", "--stdio" }; on_attach = on_attach; settings = { svelte = { plugin = { svelte = { compilerWarnings = { ["a11y-no-onchange"] = "ignore" } } } } } }
-
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" }
-
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:
- Created 3 years ago
- Reactions:6
- Comments:12 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Candidates for harmonization of onwarn in my opinion are: language-server, svelte-check, rollup plugin, webpack plugin.
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 theeslintConfig
keys inpackage.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 forsvelte.config.js
. There’s a single unified way for configuration to be handled, and ESLint core wants to be responsible for it.