From a4963d7c0e7c23a682b22b194966fd05bc9d52c3 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 30 Dec 2021 16:10:46 +0100 Subject: [PATCH 1/9] [chore] delete stale bot yaml config The stale bot was removed so there's no use for having the config anymore --- .github/stale.yml | 52 ----------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index c95bc4cf22..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - popular - - pinned - - security - - bug - - "[Status] Maybe Later" - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale-bot - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 1 - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -pulls: - daysUntilStale: 210 - daysUntilClose: 25 - markComment: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This pull request has been closed as it was previously marked as stale and saw no subsequent activity. - -issues: - daysUntilStale: 180 - daysUntilClose: 14 - markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This issue has been closed as it was previously marked as stale and saw no subsequent activity. From ca2aedfb6c2d5f8eab07cac9ab31f14f043e209e Mon Sep 17 00:00:00 2001 From: Daniel Sandoval Date: Sat, 1 Jan 2022 04:47:02 -1000 Subject: [PATCH 2/9] [docs] "What's new in Svelte" January newsletter (#7074) --- ...-01-01-whats-new-in-svelte-january-2022.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md diff --git a/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md b/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md new file mode 100644 index 0000000000..bf7bc3df57 --- /dev/null +++ b/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md @@ -0,0 +1,77 @@ +--- +title: "What's new in Svelte: January 2022" +description: "Faster builds with SvelteKit and a much anticipated REPL feature" +author: Daniel Sandoval +authorURL: https://desandoval.net +--- + +Happy new year, Svelte Community! Lots to share this month across Svelte, SvelteKit, Language Tools and the Showcase. Thanks to everyone who made 2021 a great year to use Svelte. Looking forward to the next one 🚀 + +## What's new in SvelteKit +- `@sveltejs/adapter-static` for SvelteKit now has a `precompress` option to make brotli compression of assets and pages easier to do out of the box ([#3079](https://github.com/sveltejs/kit/pull/3079)) +- Concurrency mode in SvelteKit will now prerender pages in parallel ([#3120](https://github.com/sveltejs/kit/pull/3120)). It is enabled by default in `1.0.0-next.205` and later +- CSS is now automatically included before JS for improved page performance ([d13efe](https://github.com/sveltejs/kit/commit/d138efe21692f5925f1e89afc0a33f42d6a1a711)) +- A new config option adds the ability to disable service worker registration to do your own custom registration ([#2988](https://github.com/sveltejs/kit/pull/2988)) +- SSR route-splitting is here - breaking monolithic builds into smaller pieces for improved startup and routing performance ([#2931](https://github.com/sveltejs/kit/pull/2931)) +- `request.origin/path/query` is now `request.url` - simplifying the config and page `load` functions ([#3126](https://github.com/sveltejs/kit/pull/3126)) +- After the [update to Vite 2.7](https://github.com/sveltejs/kit/pull/3018), SvelteKit users are [reporting significant performance improvements](https://www.reddit.com/r/sveltejs/comments/rljhfc/sveltekit_massive_compiler_improvement_by/) and loading third-parties libraries in SSR has also been greatly improved +- SvelteKit server will now automatically restart when the config files is changed ([vite-plugin-svelte#237](https://github.com/sveltejs/vite-plugin-svelte/pull/237)) + + +## Other new bits from `svelte/*` +- [Svelte 3.44.3](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md#3443) is out with a few bug fixes in the binding and loop code +- Svelte Language Tools has introduced support for the then/catch shorthands from Svelte 3.41 and TypeScript's "go to" functionality ([105.8.0 and later](https://github.com/sveltejs/language-tools/releases/tag/extensions-105.8.0)) +- The Svelte REPL got a nice upgrade as well - letting you delete saved REPLs. Try it out by logging in at [svelte.dev/apps](https://svelte.dev/apps) + + +--- + +## Community Showcase + +**Apps & Sites** +- [Discover Twitter Spaces](https://github.com/navneetsharmaui/discover-twitter-spaces) is a tool that helps you find the Twitter Spaces +- [Modern Fluid Typography Editor](https://github.com/codeAdrian/modern-fluid-typography-editor) helps create beautiful fluid typography using CSS clamp +- [Unnwhiteboard](https://github.com/AviKKi/unnwhiteboard) is a job board for companies (or teams) that don't do "whiteboard" interviews +- [Secret Santa](https://gitlab.com/arturoguzman/secret-santa-sveltekit) is a gift giving coordination app developed with easiness in mind +- [LogSnag](https://logsnag.com/) notifies you of your projects' events and provides you with a timeline to keep track of anything important that happens +- [Version 0.2 of Tangent](http://tangentnotes.com/Download), a Svelte-based note writing app, is now in beta +- [Intl Explorer](https://github.com/jesperorb/intl-explorer) is a tool for viewing output for all possible formatters for Intl + +A lot of work this month has gone into migrating the Svelte main website and Svelte REPL to live in the https://github.com/sveltejs/sites repository - including a brand new homepage for [svelte.dev](https://svelte.dev/). Thanks to all the contributors who made this possible! + +If you're looking for a fun SvelteKit project to work on, [you can contribute to the Svelte Society site rewrite](https://github.com/svelte-society/sveltesociety-2021/issues) 💅 + + +**Learning and Listening** + +_To Read_ +- [Mutating Query Params in SvelteKit Without Page Reloads or Navigations](https://dev.to/mohamadharith/mutating-query-params-in-sveltekit-without-page-reloads-or-navigations-2i2b) by Mohamad Harith +- [Svelte for Reactaholics : A guide for React developers](https://www.100ms.live/blog/svelte-guide-for-react-developers) by Puru Vijay +- [Svelte's lifecycle methods can be used anywhere](https://geoffrich.net/posts/svelte-lifecycle-examples/) and [The many meanings of $ in Svelte](https://geoffrich.net/posts/svelte-$-meanings/) by Geoff Rich +- [Vercel and Svelte: A Perfect Match for Web Developers](https://thenewstack.io/vercel-and-svelte-a-perfect-match-for-web-developers/) by Darryl K. Taft +- [User-defined TailwindCSS Color Scheme with Svelte Stores](https://blog.dayslice.io/user-defined-tailwindcss-color-scheme-with-svelte-stores-ad80ca2cf038) by jeremy zaborowski +- [Ionic 6 + Svelte 🚀](https://medium.com/@raymondboswel/ionic-6-svelte-ae904caa82df) by Raymond Boswel +- [What happened in #Svelte language tools this year](https://twitter.com/dummdidumm_/status/1474158105395179525?t=ytj2K2Q52iD5-lNyLnQaAQ&s=19) by Simon H + +_To Watch_ +- [The Future of Svelte (Interview with Rich Harris)](https://www.youtube.com/watch?v=uQntFkK8Z54) by Lee Robinson, Director of Developer Relations at Vercel +- [Svelte is becoming the go-to framework](https://www.youtube.com/watch?v=fo6BKY2xR2w&t=1834s) for Obsidian plugin developers +- [Sveltekit WordPress Headless Blog](https://www.youtube.com/watch?v=c0UDVgjPxFw) by WebJeda +- [Getting started with SvelteKit](https://www.youtube.com/watch?v=i2suPKMPUFA) by Lihau Tan +- [Deploy a full-stack SvelteKit app on Cloudflare Pages](https://www.youtube.com/watch?v=Wc1_U6Dy5Tw) by 1nf + +_To Listen To_ +- [Syntax podcast: How To Do Things In Svelte](https://podcasts.apple.com/ca/podcast/how-to-do-things-in-svelte/id1253186678?i=1000544796072) +- [JS Party #205: So much Sveltey goodness (w/ Rich Harris)](https://changelog.com/jsparty/205) + +**Libraries, Tools & Components** +- [svelte-headlessui](https://github.com/rgossiaux/svelte-headlessui) is an unofficial, complete Svelte port of the Headless UI component library +- [svelte-forms v2](https://chainlist.github.io/svelte-forms/) has been released - the author is [looking for feedback](https://www.reddit.com/r/sveltejs/comments/r6354j/svelteforms_v2_has_been_released/) +- [Percival](https://github.com/ekzhang/percival) is a declarative data query and visualization language +- [Svelte FlatList](https://github.com/snuffyDev/svelte-flatlist) is a mobile-friendly, simple, and customizable draggable menu +- [svelte-keyed](https://github.com/bryanmylee/svelte-keyed) is a writable derived store for objects and arrays +- [Svemix](https://github.com/svemix/svemix) is Remix for Svelte - providing server scripts inside your Svelte components/routes, which will be transformed into endpoints + +Want to add something to the showcase? Need help bringing your next idea to life in Svelte? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs). + +See ya next month! From 9221f216c6af7531c6f32671cd84d4f7eebb0003 Mon Sep 17 00:00:00 2001 From: Gabriel Francisco Date: Sun, 2 Jan 2022 17:47:24 -0300 Subject: [PATCH 3/9] Update license year (#7091) --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index cbf510847f..cd8f94f4ca 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2016-21 [these people](https://github.com/sveltejs/svelte/graphs/contributors) +Copyright (c) 2016-22 [these people](https://github.com/sveltejs/svelte/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 84a4ef07c97cd70f92ec58fbb310719db0f48f42 Mon Sep 17 00:00:00 2001 From: James Bradbury Date: Mon, 3 Jan 2022 10:33:08 +0000 Subject: [PATCH 4/9] [feat] add a11y-no-redundant-roles check (#7067) Part of #820 Closes #5361 Co-authored-by: mhatvan --- src/compiler/compile/compiler_warnings.ts | 4 + src/compiler/compile/nodes/Element.ts | 73 ++ .../a11y-no-redundant-roles/input.svelte | 44 ++ .../a11y-no-redundant-roles/warnings.json | 632 ++++++++++++++++++ 4 files changed, 753 insertions(+) create mode 100644 test/validator/samples/a11y-no-redundant-roles/input.svelte create mode 100644 test/validator/samples/a11y-no-redundant-roles/warnings.json diff --git a/src/compiler/compile/compiler_warnings.ts b/src/compiler/compile/compiler_warnings.ts index bfcd779fc7..86ec98cb8b 100644 --- a/src/compiler/compile/compiler_warnings.ts +++ b/src/compiler/compile/compiler_warnings.ts @@ -76,6 +76,10 @@ export default { code: 'a11y-unknown-role', message: `A11y: Unknown role '${role}'` + (suggestion ? ` (did you mean '${suggestion}'?)` : '') }), + a11y_no_redundant_roles: (role: string | boolean) => ({ + code: 'a11y-no-redundant-roles', + message: `A11y: Redundant role '${role}'` + }), a11y_accesskey: { code: 'a11y-accesskey', message: 'A11y: Avoid using accesskey' diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 837a0296d0..bf81599bf6 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -70,6 +70,46 @@ const a11y_labelable = new Set([ 'textarea' ]); +const a11y_nested_implicit_semantics = new Map([ + ['header', 'banner'], + ['footer', 'contentinfo'] +]); + +const a11y_implicit_semantics = new Map([ + ['a', 'link'], + ['aside', 'complementary'], + ['body', 'document'], + ['datalist', 'listbox'], + ['dd', 'definition'], + ['dfn', 'term'], + ['details', 'group'], + ['dt', 'term'], + ['fieldset', 'group'], + ['form', 'form'], + ['h1', 'heading'], + ['h2', 'heading'], + ['h3', 'heading'], + ['h4', 'heading'], + ['h5', 'heading'], + ['h6', 'heading'], + ['hr', 'separator'], + ['li', 'listitem'], + ['menu', 'list'], + ['nav', 'navigation'], + ['ol', 'list'], + ['optgroup', 'group'], + ['output', 'status'], + ['progress', 'progressbar'], + ['section', 'region'], + ['summary', 'button'], + ['tbody', 'rowgroup'], + ['textarea', 'textbox'], + ['tfoot', 'rowgroup'], + ['thead', 'rowgroup'], + ['tr', 'row'], + ['ul', 'list'] +]); + const invisible_elements = new Set(['meta', 'html', 'script', 'style']); const valid_modifiers = new Set([ @@ -98,6 +138,23 @@ const react_attributes = new Map([ const attributes_to_compact_whitespace = ['class', 'style']; +function is_parent(parent: INode, elements: string[]) { + let check = false; + + while (parent) { + const parent_name = (parent as Element).name; + if (elements.includes(parent_name)) { + check = true; + break; + } + if (parent.type === 'Element') { + break; + } + parent = parent.parent; + } + return check; +} + function get_namespace(parent: Element, element: Element, explicit_namespace: string) { const parent_element = parent.find_nearest(/^Element/); @@ -351,6 +408,22 @@ export default class Element extends Node { const match = fuzzymatch(value, aria_roles); component.warn(attribute, compiler_warnings.a11y_unknown_role(value, match)); } + + // no-redundant-roles + const has_redundant_role = value === a11y_implicit_semantics.get(this.name); + + if (this.name === value || has_redundant_role) { + component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); + } + + // Footers and headers are special cases, and should not have redundant roles unless they are the children of sections or articles. + const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']); + if (!is_parent_section_or_article) { + const has_nested_redundant_role = value === a11y_nested_implicit_semantics.get(this.name); + if (has_nested_redundant_role) { + component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); + } + } } // no-access-key diff --git a/test/validator/samples/a11y-no-redundant-roles/input.svelte b/test/validator/samples/a11y-no-redundant-roles/input.svelte new file mode 100644 index 0000000000..05525effb6 --- /dev/null +++ b/test/validator/samples/a11y-no-redundant-roles/input.svelte @@ -0,0 +1,44 @@ +a link +
+
+ +