-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Docs Site] Adopt eslint #19263
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
[Docs Site] Adopt eslint #19263
Conversation
Deploying cloudflare-docs with
|
| Latest commit: |
5c121e0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://53f9a3af.cloudflare-docs-7ou.pages.dev |
| Branch Preview URL: | https://kian-pcx-15396.cloudflare-docs-7ou.pages.dev |
| contentLines = contentLines.filter( | ||
| (line) => !/<[\/]?docs-tag name=".*">/.test(line), | ||
| (line) => !/<[/]?docs-tag name=".*">/.test(line), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to escape [/] when not using PCRE (which is only PHP really).
| @@ -1,4 +1,5 @@ | |||
| --- | |||
| /* eslint-disable astro/jsx-a11y/no-noninteractive-tabindex */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improving the accessibility of this component isn't feasible at the moment, we will tackle it when we migrate from Tippy.js to floating-ui.
| return "Function calling"; | ||
| } | ||
|
|
||
| return []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevents (... | undefined)[] type due to a hole-y array.
| @@ -1,44 +0,0 @@ | |||
| import { useState } from "react"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used and was a WIP that we do not plan on finishing at the moment.
| isCurrent: boolean; | ||
| badge: ComponentProps<typeof Badge> | undefined; | ||
| attrs: LinkHTMLAttributes; | ||
| attrs: HTMLAttributes<"a">; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst the linkHTMLAttributesSchema code was taken from Starlight's codebase, we are happy with HTMLAttributes.
| if (indexPage.data.sidebar.group?.hideIndex) { | ||
| group.entries.splice(indexIdx, 1)[0]; | ||
| group.entries.splice(indexIdx, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[0] was an unused expression - no functionality change.
| & > * a[aria-current="page"] { | ||
| color: var(--sl-color-accent-high) !important; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses the same orange as the logo when highlighting the current page on dark mode.
|
|
||
| // omit sort_date from output | ||
| const { sort_date, ...data } = x.data; | ||
| const { sort_date: _, ...data } = x.data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ to indicate it is unused, we just do this to omit sort_date from data.
94d7dda to
0971e84
Compare
|
Files with changes (up to 15)
|
| @@ -0,0 +1 @@ | |||
| save-exact=true | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to prevent scenarios where npm install and npm ci can result in different versions, due to the ^... selectors that are typical.
With exact selectors ("foo": "0.1.0" vs "foo": "^0.1.0"), regardless of npm i or npm ci, a package at 0.1.0 should always install 0.1.0.
| "react": "19.0.0", | ||
| "react-dom": "19.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We updated to React 19 but it results in no visual or functionality changes for us.
| import tsBlankSpace from "ts-blank-space"; | ||
| import { format } from "prettier"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detype is slower and the latest versions cause build errors due to using a CJS shim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some spot testing and looks good to me.
Post release, should confirm OT functionality.
Summary
Adopts eslint for JavaScript, TypeScript, React, Astro and accessibility.
Moves all
.jsxcomponents to.tsx.Cleans up some redundant Tailwind classes in favour of
DEFAULTcases onblackandaccentcolours.Adds reviewdog in CI for PR comments when eslint produces an error.
Added a third option to
addTooltipto pass custom props totippy, and a customhideAfterimplementation.Rewrote
RuleIDandOneTrustto resolve accessibility issues with non-interactive elements used for interactivity.