Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
zugdev committed Dec 5, 2024
1 parent 4ee571a commit af9c62b
Show file tree
Hide file tree
Showing 11 changed files with 8,458 additions and 5,939 deletions.
2 changes: 1 addition & 1 deletion build/esbuild-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export async function server() {
port: 8080,
});
console.log(`http://localhost:${port}`);
}
}
8 changes: 1 addition & 7 deletions src/home/fetch-github/fetch-and-display-previews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,7 @@ export async function displayNotifications({
applyAvatarsToIssues();
}

export async function searchDisplayGitHubIssues({
searchText,
skipAnimation = false,
}: {
searchText: string;
skipAnimation?: boolean;
}) {
export async function searchDisplayGitHubIssues({ searchText, skipAnimation = false }: { searchText: string; skipAnimation?: boolean }) {
const searchResult = filterIssuesBySearch(searchText);
let filteredIssues = searchResult.filter(getProposalsOnlyFilter(isProposalOnlyViewer));
filteredIssues = filterIssuesByOrganization(filteredIssues);
Expand Down
6 changes: 3 additions & 3 deletions src/home/github-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export type GitHubPullRequest = RestEndpointMethodTypes["pulls"]["get"]["respons
export type GitHubNotifications = RestEndpointMethodTypes["activity"]["listNotificationsForAuthenticatedUser"]["response"]["data"];
export type GitHubNotification = GitHubNotifications[0];
export type GitHubAggregated = {
"issue": GitHubIssue,
"pullRequest": GitHubPullRequest,
"notification": GitHubNotification
issue: GitHubIssue;
pullRequest: GitHubPullRequest;
notification: GitHubNotification;
};
export type GitHubLabel =
| {
Expand Down
13 changes: 11 additions & 2 deletions src/home/rendering/render-github-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export function renderNotifications(tasks: GitHubNotifications, skipAnimation: b
notificationsContainer.classList.remove("ready");
notificationsContainer.innerHTML = "";
}
const existingIssueIds = new Set(Array.from(notificationsContainer.querySelectorAll(".issue-element-inner")).map((element) => element.getAttribute("data-issue-id")));
const existingIssueIds = new Set(
Array.from(notificationsContainer.querySelectorAll(".issue-element-inner")).map((element) => element.getAttribute("data-issue-id"))
);

let delay = 0;
const baseDelay = 1000 / 15; // Base delay in milliseconds
Expand Down Expand Up @@ -53,7 +55,14 @@ function everyNewNotification({ notification, notificationsContainer }: { notifi
return issueWrapper;
}

function setUpIssueElement(issueElement: HTMLDivElement, task: GitHubNotifications, organizationName: string, repositoryName: string, labels: string[], url: string) {
function setUpIssueElement(
issueElement: HTMLDivElement,
task: GitHubNotifications,
organizationName: string,
repositoryName: string,
labels: string[],
url: string
) {
const image = `<img />`;

issueElement.innerHTML = `
Expand Down
16 changes: 6 additions & 10 deletions src/home/search/string-similarity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@ export class StringSimilarity {
public static calculate(str1: string, str2: string): number {
const maxLen = Math.max(str1.length, str2.length);
if (maxLen === 0) return 1.0;

const distance = this._calculateLevenshteinDistance(str1, str2);
return 1 - (distance / maxLen);
return 1 - distance / maxLen;
}

private static _calculateLevenshteinDistance(str1: string, str2: string): number {
const matrix: number[][] = Array(str2.length + 1).fill(null).map(() =>
Array(str1.length + 1).fill(null)
);
const matrix: number[][] = Array(str2.length + 1)
.fill(null)
.map(() => Array(str1.length + 1).fill(null));

for (let i = 0; i <= str1.length; i++) matrix[0][i] = i;
for (let j = 0; j <= str2.length; j++) matrix[j][0] = j;

for (let j = 1; j <= str2.length; j++) {
for (let i = 1; i <= str1.length; i++) {
const indicator = str1[i - 1] === str2[j - 1] ? 0 : 1;
matrix[j][i] = Math.min(
matrix[j][i - 1] + 1,
matrix[j - 1][i] + 1,
matrix[j - 1][i - 1] + indicator
);
matrix[j][i] = Math.min(matrix[j][i - 1] + 1, matrix[j - 1][i] + 1, matrix[j - 1][i - 1] + indicator);
}
}

Expand Down
2 changes: 1 addition & 1 deletion static/progressive-web-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ self.addEventListener("fetch", (event) => {
}
})()
);
});
});
6 changes: 3 additions & 3 deletions static/style/inverted-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
}
#authentication {
position: absolute;
right:8px;
right: 8px;
cursor: pointer;
vertical-align: middle;
flex: 0 0 auto;
Expand Down Expand Up @@ -541,7 +541,7 @@
.preview th {
font-weight: bold;
}
.preview th,
.preview th,
.preview td {
padding: 6px 13px;
}
Expand Down Expand Up @@ -947,7 +947,7 @@
/* Prevent content from going under bottom bar */
/* padding-bottom: 48px; */
}

.preview-body::-webkit-scrollbar {
width: 2px;
}
Expand Down
4 changes: 2 additions & 2 deletions static/style/special.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
background-color: var(--light-background);
}
.preview th,
.preview td{
.preview td {
border: 1px solid var(--alt-dark-background);
}
.preview tr:nth-child(even) {
Expand Down Expand Up @@ -98,7 +98,7 @@
background-color: var(--dark-background);
}
.preview th,
.preview td{
.preview td {
border: 1px solid var(--alt-light-background);
}
.preview tr:nth-child(even) {
Expand Down
6 changes: 3 additions & 3 deletions static/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
}
#authentication {
position: absolute;
right:8px;
right: 8px;
cursor: pointer;
vertical-align: middle;
flex: 0 0 auto;
Expand Down Expand Up @@ -541,7 +541,7 @@
.preview th {
font-weight: bold;
}
.preview th,
.preview th,
.preview td {
padding: 6px 13px;
}
Expand Down Expand Up @@ -947,7 +947,7 @@
/* Prevent content from going under bottom bar */
/* padding-bottom: 48px; */
}

.preview-body::-webkit-scrollbar {
width: 2px;
}
Expand Down
20 changes: 10 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": ["DOM", "ESNext"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": ["DOM", "ESNext"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
Expand All @@ -25,21 +25,21 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "commonjs" /* Specify what module code is generated. */,
"module": "commonjs" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
"types": ["cypress"] /* Specify type package names to be included without being referenced in a source file. */,
"types": ["cypress"] /* Specify type package names to be included without being referenced in a source file. */,
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
"resolveJsonModule": true /* Enable importing .json files. */,
"resolveJsonModule": true /* Enable importing .json files. */,
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */

Expand All @@ -55,7 +55,7 @@
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./static/dist/" /* Specify an output folder for all emitted files. */,
"outDir": "./static/dist/" /* Specify an output folder for all emitted files. */,
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand All @@ -77,12 +77,12 @@
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
Expand All @@ -104,6 +104,6 @@

/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
Loading

0 comments on commit af9c62b

Please sign in to comment.