Skip to content
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

Stricter tsconfig #1620

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/collector/__tests__/getProjectIssues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ describe("Working issue listing", () => {
beforeEach(() => {
nock("https://api.github.com")
.get("/repos/OWNER/REPO/issues")
.query((actualQueryObject) => actualQueryObject.labels === "help-wanted")
.query(
(actualQueryObject) => actualQueryObject["labels"] === "help-wanted",
)
.reply(200, [
{
body: "BODY_C",
Expand All @@ -18,7 +20,9 @@ describe("Working issue listing", () => {
]);
nock("https://api.github.com")
.get("/repos/OWNER/REPO/issues")
.query((actualQueryObject) => actualQueryObject.labels === "help wanted")
.query(
(actualQueryObject) => actualQueryObject["labels"] === "help wanted",
)
.reply(200, [
{
body: "BODY_I",
Expand Down Expand Up @@ -99,7 +103,7 @@ test("getProjectIssues auto-populates body", async () => {

nock("https://api.github.com")
.get("/repos/OWNER/REPO/issues")
.query((actualQueryObject) => actualQueryObject.labels === "help-wanted")
.query((actualQueryObject) => actualQueryObject["labels"] === "help-wanted")
.reply(200, [
{ html_url: "https://example.test", number: 1, title: "CORRECT" },
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jest.mock("../src/octokit", () => {
const OctokitWithRest = Octokit.plugin(restEndpointMethods);
return {
octokit: new OctokitWithRest({
auth: process.env.PAT,
auth: process.env["PAT"],
request: {
fetch: nodeFetch,
},
Expand Down
1 change: 1 addition & 0 deletions packages/collector/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export default tseslint.config(
files: ["**/*.js"],
rules: {
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
},
},
);
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/src/getProjectIssues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function getProjectIssues(
});
return issues.data.map((issue) => ({
description: issue.body ?? "",
link: publicRepo ? issue.html_url : undefined,
...(publicRepo && { link: issue.html_url }),
number: issue.number,
title: issue.title,
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/src/octokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";

// eslint-disable-next-line @typescript-eslint/naming-convention -- Classes should be PascalCase
const OctokitWithRest = Octokit.plugin(restEndpointMethods);
export const octokit = new OctokitWithRest({ auth: process.env.PAT });
export const octokit = new OctokitWithRest({ auth: process.env["PAT"] });
6 changes: 6 additions & 0 deletions packages/collector/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
"compilerOptions": {
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,

"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/__tests__/components/IssuesList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ describe("IssuesList component", () => {
<MemoryRouter>
<IssuesList
issues={project.issues.map((issue) => ({
...issue,
link: undefined,
description: issue.description,
number: issue.number,
title: issue.title,
}))}
project={project}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/Issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Issue = ({
subtitle={issue.project.name}
subtitleDescription={issue.project["short-description"]}
subtitleLink={getProjectLink(issue.project)}
tags={!hideTags ? issue.project.tags : []}
tags={!hideTags ? issue.project.tags ?? [] : []}
title={issue.title}
/>
);
2 changes: 1 addition & 1 deletion packages/frontend/src/components/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Project = ({
<ArticleBox
description={project.info.description}
link={getProjectLink(project)}
tags={project.info.tags}
tags={project.info.tags ?? []}
title={project.info.name}
/>
);
4 changes: 2 additions & 2 deletions packages/frontend/src/pages/IssueDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const IssueDetail = ({
);
const projectIssues = getIssuesWithProjectInfo(data, {
omitIssueNumber: issue?.number,
owner: projectOwner,
repo: projectRepo,
...(projectOwner !== undefined && { owner: projectOwner }),
...(projectRepo !== undefined && { repo: projectRepo }),
});

if (!issue) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/utils/getAllIssues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ProjectIssueWithProjectInfo extends ProjectIssue {
}

interface Query extends Partial<Project> {
omitIssueNumber?: number;
omitIssueNumber: number | undefined;
}

export const getIssuesWithProjectInfo = (
Expand Down
16 changes: 11 additions & 5 deletions packages/frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"compilerOptions": {
"module": "es2020",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es5",
"jsx": "react-jsx",
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"module": "es2020",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",

"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"sourceMap": true,
"strict": true
}
}
Loading