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.

How can we disable svelte warnings? (a11y, etc)

See original GitHub issue

These warnings often do more harm than good and pollute our console real estate. It’s not acceptable to litter the code with <!-- svelte-ignore a11y-no-onchange --> etc.

We can usually filter these in the rollup.config but svelte-check won’t pick that.

What’s the best way to filter these:

  • in the console when using svelte-check --watch
  • in VScode (without having to tell everyone to manually add tons of entries in their IDE preferences)

Is it time perhaps to introduce a config file?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:15
  • Comments:36 (6 by maintainers)

github_iconTop GitHub Comments

25reactions
telamoncommented, Aug 7, 2022

Is it just me or are you guys bandaging a footgun blast?

This really should go into the rollup/svelte() configuration, setting up a development standard in a team by asking each individual dev to modify their respective editor configuration is well… inefficient.

How do I get rid of A11y entirely? It’s garbage 😦

25reactions
peter-pakanuncommented, Jul 12, 2022

@leumasme To disable editor warning put this inside .vscode/settings.json

{
  "svelte.plugin.svelte.compilerWarnings": {
    "a11y-aria-attributes": "ignore",
    "a11y-incorrect-aria-attribute-type": "ignore",
    "a11y-unknown-aria-attribute": "ignore",
    "a11y-hidden": "ignore",
    "a11y-misplaced-role": "ignore",
    "a11y-unknown-role": "ignore",
    "a11y-no-abstract-role": "ignore",
    "a11y-no-redundant-roles": "ignore",
    "a11y-role-has-required-aria-props": "ignore",
    "a11y-accesskey": "ignore",
    "a11y-autofocus": "ignore",
    "a11y-misplaced-scope": "ignore",
    "a11y-positive-tabindex": "ignore",
    "a11y-invalid-attribute": "ignore",
    "a11y-missing-attribute": "ignore",
    "a11y-img-redundant-alt": "ignore",
    "a11y-label-has-associated-control": "ignore",
    "a11y-media-has-caption": "ignore",
    "a11y-distracting-elements": "ignore",
    "a11y-structure": "ignore",
    "a11y-mouse-events-have-key-events": "ignore",
    "a11y-missing-content": "ignore",
  }
}

To disable compiler warning put this inside svelte.config.js

const config = {
  onwarn: (warning, handler) => {
    if (warning.code.startsWith('a11y-')) {
      return;
    }
    handler(warning);
  },
  kit: {
    adapter: adapter(),
  }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

What Svelte's accessibility warnings won't tell you - Geoff Rich
Svelte's accessibility (often shortened to "a11y") warnings are one of the framework's standout features. Per Rich Harris, Svelte is an ...
Read more >
How can I systematically disable certain irrelevant a11y ...
You can disable warnings at the project level. If you're using rollup, warnings can be suppressed by providing a custom onwarn handler:
Read more >
Confused about a11y warning for on:click : r/sveltejs - Reddit
If I put a on:keydown on some div it will never trigger, so as far as I can tell this a11y warning is...
Read more >
Checklist - The A11Y Project
A beginner's guide to digital accessibility. ... Ensure that viewport zoom is not disabled. 1.4.4 Resize text ... Heading elements (h1, h2, h3,...
Read more >
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 >

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