Skip to content

Commit 1dc7b57

Browse files
fix:removed linter warnings
Signed-off-by: shiva <[email protected]>
1 parent 1c8ee99 commit 1dc7b57

File tree

8 files changed

+37
-35
lines changed

8 files changed

+37
-35
lines changed

src/components/CodeEmbed/frame.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export const CodeFrame = (props: CodeFrameProps) => {
146146
return;
147147
}
148148
})();
149-
}, [props.jsCode, mounted]);
149+
}, [props.jsCode, mounted,p5ScriptTag]);
150150

151151
return (
152152
<div

src/components/SearchProvider/index.tsx

+26-24
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,7 @@ const SearchProvider = ({
3030
const [results, setResults] = useState<SearchResult[]>([]);
3131

3232
// Flattens the search index data
33-
const flattenData = (data: FuseResult<SearchResult>) => {
34-
const flatData: SearchResult[] = [];
35-
let flatId = 0;
36-
Object.entries(data).forEach(([category, entries]) => {
37-
Object.entries(entries).forEach(([title, docDetails]) => {
38-
// Since we are generating these links with Javascript and the
39-
// middleware doesn't prefix the locale automatically, we need to
40-
// do it manually here.
41-
const relativeUrl =
42-
currentLocale === defaultLocale
43-
? docDetails.relativeUrl
44-
: `/${currentLocale}${docDetails.relativeUrl}`;
45-
docDetails.relativeUrl = relativeUrl;
46-
flatData.push({
47-
id: flatId++,
48-
category: category.replace("-fallback", ""),
49-
title,
50-
...docDetails,
51-
});
52-
});
53-
});
54-
55-
return flatData;
56-
};
33+
5734

5835
// Read the search term from query params on first load
5936
useEffect(() => {
@@ -80,6 +57,31 @@ const SearchProvider = ({
8057
}
8158

8259
if (!searchTerm) return;
60+
61+
const flattenData = (data: FuseResult<SearchResult>) => {
62+
const flatData: SearchResult[] = [];
63+
let flatId = 0;
64+
Object.entries(data).forEach(([category, entries]) => {
65+
Object.entries(entries).forEach(([title, docDetails]) => {
66+
// Since we are generating these links with Javascript and the
67+
// middleware doesn't prefix the locale automatically, we need to
68+
// do it manually here.
69+
const relativeUrl =
70+
currentLocale === defaultLocale
71+
? docDetails.relativeUrl
72+
: `/${currentLocale}${docDetails.relativeUrl}`;
73+
docDetails.relativeUrl = relativeUrl;
74+
flatData.push({
75+
id: flatId++,
76+
category: category.replace("-fallback", ""),
77+
title,
78+
...docDetails,
79+
});
80+
});
81+
});
82+
83+
return flatData;
84+
};
8385

8486
let flatData;
8587

src/pages/_utils-node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const rewriteRelativeLink = (url: string): string => {
7575
!updatedUrl.endsWith('/') &&
7676
!/(\.\w+)$/.exec(updatedUrl) &&
7777
!updatedUrl.includes('?') &&
78-
!/#([\w\-]+)$/.exec(updatedUrl)
78+
!/#([\w-]+)$/.exec(updatedUrl)
7979
) {
8080
updatedUrl += '/';
8181
}

src/scripts/branchTest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ currentEnv = currentEnv
2626
.split('\n')
2727
.filter((line: string) => !line.startsWith('P5_') && !line.startsWith('PUBLIC_P5_'))
2828
.join('\n')
29-
writeFileSync(envFilePath, currentEnv + '\n' + envVars.join('\n'));
29+
writeFileSync(envFilePath, `${currentEnv }\n${ envVars.join('\n')}`);
3030

3131
// First delete the existing cloned p5 to make sure we clone fresh
3232
const parsedP5Path = path.join(__dirname, "./parsers/in/p5.js/");

src/scripts/builders/contribute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const buildContributorDocs = async () => {
261261

262262
let latestRelease = p5Version;
263263
if (/^\d+\.\d+\.\d+$/.exec(latestRelease)) {
264-
latestRelease = 'v' + latestRelease;
264+
latestRelease = `v${ latestRelease}`;
265265
}
266266

267267
await cloneLibraryRepo(clonedRepoPath, docsRepoUrl, latestRelease);

src/scripts/builders/reference.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const correctRelativeLinksInDescription = (description: string | undefined) => {
208208
!href.endsWith('/') &&
209209
!/(\.\w+)$/.exec(href) &&
210210
!href.includes('?') &&
211-
!/#([\w\-]+)$/.exec(href)
211+
!/#([\w-]+)$/.exec(href)
212212
) {
213213
href += '/';
214214
}

src/scripts/parsers/reference.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const parseLibraryReference =
2424
async (): Promise<ParsedLibraryReference | null> => {
2525
let latestRelease = p5Version;
2626
if (/^\d+\.\d+\.\d+$/.exec(latestRelease)) {
27-
latestRelease = 'v' + latestRelease;
27+
latestRelease = `v${ latestRelease}`;
2828
}
2929

3030
const useExternalP5Sound = !!process.env.P5_REPO_BRANCH ||
@@ -44,7 +44,7 @@ export const parseLibraryReference =
4444
// If we're using a custom build of p5 instead of a public release, create
4545
// a build and copy it to the specified path
4646
if (process.env.PUBLIC_P5_LIBRARY_PATH) {
47-
await createP5Build('p5.js', '../../../public' + process.env.PUBLIC_P5_LIBRARY_PATH);
47+
await createP5Build('p5.js', `../../../public${ process.env.PUBLIC_P5_LIBRARY_PATH}`);
4848
}
4949

5050
// Copy the reference output so we can process it
@@ -67,7 +67,7 @@ export const parseLibraryReference =
6767

6868
// Fix p5.sound classes
6969
for (const key in soundData.classes) {
70-
const newName = 'p5.' + soundData.classes[key].name;
70+
const newName = `p5.${ soundData.classes[key].name}`;
7171
const updated = {
7272
...soundData.classes[key],
7373
name: newName,
@@ -76,7 +76,7 @@ export const parseLibraryReference =
7676
delete soundData.classes[key];
7777
}
7878
for (const item of soundData.classitems) {
79-
item.class = 'p5.' + item.class;
79+
item.class = `p5.${ item.class}`;
8080
}
8181

8282
result = await combineYuidocData(

src/scripts/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let latestRelease = p5Version;
1010
// If the latest release is a version number (e.g. 1.10.0) without a 'v'
1111
// prefix, add the v prefix
1212
if (/^\d+\.\d+\.\d+$/.exec(latestRelease)) {
13-
latestRelease = 'v' + latestRelease;
13+
latestRelease = `v${ latestRelease}`;
1414
}
1515

1616
export const p5RepoUrl = "https://github.com/processing/p5.js.git";
@@ -295,7 +295,7 @@ export const rewriteRelativeMdLinks = (markdownText: string): string => {
295295
* 1. Text for the link
296296
* 2. Link url (but not the .md extension at the end)
297297
*/
298-
const regexPattern: RegExp = /(\!?)\[([^\]]+)\]\(([^\)]+)\)/g;
298+
const regexPattern: RegExp = /(!?)\[([^\]]+)\]\(([^)]+)\)/g;
299299
return markdownText.replace(regexPattern, (match, img, linkText, url: string) => {
300300
// Don't convert images
301301
if (img) return match;

0 commit comments

Comments
 (0)