Skip to content

Commit dcb9aca

Browse files
authored
chore: update eslint to v9 (#1439)
Closes #1276
1 parent 43bafa9 commit dcb9aca

File tree

47 files changed

+650
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+650
-811
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

apify-api/openapi/code_samples/javascript/requestQueue_requests_post.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const apifyClient = new ApifyClient({
66
const result = await apifyClient
77
.requestQueue('<QUEUE ID>')
88
.addRequest({
9-
'uniqueKey': 'http://example.com',
10-
'url': 'http://example.com',
11-
'method': 'GET',
9+
uniqueKey: 'http://example.com',
10+
url: 'http://example.com',
11+
method: 'GET',
1212
});
1313

1414
console.log(result);

apify-docs-theme/src/markdown.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,6 @@ const remarkStringify = require('remark-stringify');
33
const { unified } = require('unified');
44
const { visitParents } = require('unist-util-visit-parents');
55

6-
/**
7-
* Updates the markdown content for better UX and compatibility with Docusaurus v3.
8-
* @param {string} changelog The markdown content.
9-
* @returns {string} The updated markdown content.
10-
*/
11-
function updateChangelog(changelog) {
12-
const pipeline = unified()
13-
.use(remarkParse)
14-
.use(removeGitCliffMarkers)
15-
.use(incrementHeadingLevels)
16-
.use(prettifyPRLinks)
17-
.use(linkifyUserTags)
18-
.use(remarkStringify);
19-
20-
changelog = pipeline.processSync(changelog).toString();
21-
changelog = addFrontmatter(changelog);
22-
changelog = escapeMDXCharacters(changelog);
23-
return changelog;
24-
}
25-
266
/**
277
* Bumps the headings levels in the markdown content. This function increases the depth
288
* of all headings in the content by 1. This is useful when the content is included in
@@ -60,7 +40,7 @@ const linkifyUserTags = () => (tree) => {
6040

6141
const directParent = parents[parents.length - 1];
6242

63-
if (!match || directParent.type === 'link') return;
43+
if (!match || directParent.type === 'link') return 0;
6444

6545
const nodeIndexInParent = directParent.children.findIndex((x) => x === node);
6646

@@ -95,7 +75,7 @@ const prettifyPRLinks = () => (tree) => {
9575
const prLinkRegex = /https:\/\/github.com\/[^\s]+\/pull\/(\d+)/g;
9676
const match = prLinkRegex.exec(node.value);
9777

98-
if (!match) return;
78+
if (!match) return 0;
9979

10080
const directParent = parents[parents.length - 1];
10181
const nodeIndexInParent = directParent.children.findIndex((x) => x === node);
@@ -148,6 +128,26 @@ function escapeMDXCharacters(changelog) {
148128
});
149129
}
150130

131+
/**
132+
* Updates the markdown content for better UX and compatibility with Docusaurus v3.
133+
* @param {string} changelog The markdown content.
134+
* @returns {string} The updated markdown content.
135+
*/
136+
function updateChangelog(changelog) {
137+
const pipeline = unified()
138+
.use(remarkParse)
139+
.use(removeGitCliffMarkers)
140+
.use(incrementHeadingLevels)
141+
.use(prettifyPRLinks)
142+
.use(linkifyUserTags)
143+
.use(remarkStringify);
144+
145+
changelog = pipeline.processSync(changelog).toString();
146+
changelog = addFrontmatter(changelog);
147+
changelog = escapeMDXCharacters(changelog);
148+
return changelog;
149+
}
150+
151151
module.exports = {
152152
updateChangelog,
153153
};

apify-docs-theme/src/roa-loader/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ async function getHash(source) {
3838
})).json();
3939

4040
if (!res.data || !res.data.encoded) {
41-
// eslint-disable-next-line no-console
4241
console.error(`Signing failed:' ${inspect(res.error) || 'Unknown error'}`, res);
4342
return 'invalid-token';
4443
}
4544

4645
cache[cacheKey] = res.data.encoded;
47-
await new Promise((resolve) => setTimeout(resolve, 100));
46+
await new Promise((resolve) => {
47+
setTimeout(resolve, 100);
48+
});
4849

4950
return res.data.encoded;
5051
}
@@ -79,7 +80,6 @@ module.exports = async function (code) {
7980
return { code, hash: 'fast' };
8081
}
8182

82-
// eslint-disable-next-line no-console
8383
console.log(`Signing ${urlToRequest(this.resourcePath)}...`, { working, queue: queue.length });
8484
const codeHash = await encodeAndSign(code);
8585

apify-docs-theme/src/theme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ This either means that your Docusaurus setup is misconfigured, or that your GitH
108108
await generateChangelogFromGitHubReleases(pathsToCopyChangelog, `${context.siteConfig.organizationName}/${context.siteConfig.projectName}`);
109109
}
110110
} catch (e) {
111-
// eslint-disable-next-line no-console
112111
console.warn(`Changelog page could not be initialized: ${e.message}`);
113112
}
114113
},

apify-docs-theme/src/theme/ColorModeToggle/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react';
2-
// eslint-disable-next-line import/no-extraneous-dependencies
3-
import clsx from 'clsx';
4-
import useIsBrowser from '@docusaurus/useIsBrowser';
51
import { translate } from '@docusaurus/Translate';
6-
import IconLightMode from '../Icon/LightMode';
7-
import IconDarkMode from '../Icon/DarkMode';
2+
import useIsBrowser from '@docusaurus/useIsBrowser';
3+
import clsx from 'clsx';
4+
import React from 'react';
5+
86
import styles from './styles.module.css';
7+
import IconDarkMode from '../Icon/DarkMode';
8+
import IconLightMode from '../Icon/LightMode';
99

1010
function ColorModeToggle({
1111
className,

apify-docs-theme/src/theme/DocSidebarItem/Link/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react';
2-
// eslint-disable-next-line import/no-extraneous-dependencies
3-
import clsx from 'clsx';
1+
import isInternalUrl from '@docusaurus/isInternalUrl';
2+
import Link from '@docusaurus/Link';
3+
import { isActiveSidebarItem } from '@docusaurus/plugin-content-docs/client';
44
import { ThemeClassNames } from '@docusaurus/theme-common';
55
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
6-
import { isActiveSidebarItem } from '@docusaurus/plugin-content-docs/client';
7-
import Link from '@docusaurus/Link';
8-
import isInternalUrl from '@docusaurus/isInternalUrl';
96
import IconExternalLink from '@theme/Icon/ExternalLink';
7+
import clsx from 'clsx';
8+
import React from 'react';
9+
1010
import styles from './styles.module.css';
1111

1212
export default function DocSidebarItemLink({

apify-docs-theme/src/theme/Footer/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
2-
// eslint-disable-next-line import/no-extraneous-dependencies
3-
import clsx from 'clsx';
41
import { useThemeConfig } from '@docusaurus/theme-common';
52
import LinkItem from '@theme/Footer/LinkItem';
3+
import clsx from 'clsx';
4+
import React from 'react';
5+
66
import styles from './index.module.css';
77

88
function FooterLinksColumn({ column }) {

apify-docs-theme/src/theme/Layout/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react';
1+
import { useLocation } from '@docusaurus/router';
22
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
33
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
4-
import { usePluginData } from '@docusaurus/useGlobalData';
54
import useBaseUrl from '@docusaurus/useBaseUrl';
6-
import { useLocation } from '@docusaurus/router';
5+
import { usePluginData } from '@docusaurus/useGlobalData';
6+
import React from 'react';
77

88
export default function LayoutWrapper(props) {
99
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
@@ -13,9 +13,9 @@ export default function LayoutWrapper(props) {
1313
return (
1414
<div style={{
1515
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
16-
'margin': 0,
17-
'padding': 0,
18-
'boxSizing': 'border-box',
16+
margin: 0,
17+
padding: 0,
18+
boxSizing: 'border-box',
1919
}}>
2020
<Layout {...props} />
2121
</div>

apify-docs-theme/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
21
import { useThemeConfig } from '@docusaurus/theme-common';
32
import useBaseUrl from '@docusaurus/useBaseUrl';
43
import { usePluginData } from '@docusaurus/useGlobalData';
54
import NavbarItem from '@theme/NavbarItem';
5+
import React from 'react';
66

77
function useNavbarItems() {
88
// TODO temporary casting until ThemeConfig type is improved

0 commit comments

Comments
 (0)