Skip to content

Commit

Permalink
chore: Add ts lint (#3975)
Browse files Browse the repository at this point in the history
To validate that TypeScript is happy
  • Loading branch information
fb55 authored Aug 6, 2024
1 parent bcdc28e commit 98e41ae
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run format:prettier:raw -- --write",
"format:prettier:raw": "prettier \"**/*.{{m,c,}{j,t}s{x,},md{x,},json,y{a,}ml}\" --ignore-path .gitignore",
"lint": "npm run lint:es && npm run lint:prettier",
"lint": "npm run lint:es && npm run lint:prettier && npm run lint:ts",
"lint:es": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
"lint:prettier": "npm run format:prettier:raw -- --check",
"lint:ts": "tsc --noEmit",
"prepare": "husky install",
"prepublishOnly": "npm run build",
"test": "npm run lint && npm run test:vi",
Expand Down
3 changes: 2 additions & 1 deletion scripts/fetch-sponsors.mts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ if (!CHEERIO_SPONSORS_GITHUB_TOKEN) {
throw new Error('Missing CHEERIO_SPONSORS_GITHUB_TOKEN.');
}

// @ts-expect-error - Types don't have a constructor
const imgix = new ImgixClient({
domain: 'humble.imgix.net',
secureURLToken: IMGIX_TOKEN,
Expand Down Expand Up @@ -143,7 +144,7 @@ async function fetchOpenCollectiveSponsors(): Promise<Sponsor[]> {
body: JSON.stringify({ query }),
});

const payload = await body.json();
const payload: any = await body.json();

return payload.data.account.orders.nodes.map((order: any): Sponsor => {
const donation = order.amount.value * 100;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true
}
},
"exclude": ["website/"] /* The website has its own tsconfig. */
}
2 changes: 2 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ const config = {
pretty: true,
},
outputFileStrategy: 'members',
membersWithOwnFile: ['Class', 'Enum', 'Interface'],
propertyMembersFormat: 'htmlTable',
},
],
],
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download",
"typecheck": "tsc"
"lint:ts": "tsc --noEmit"
},
"dependencies": {
"@docusaurus/core": "^3.4.0",
Expand Down
1 change: 1 addition & 0 deletions website/src/theme/ReactLiveScope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as cheerio from '../../../../dist/browser/index.js';
const ReactLiveScope = {
React,
cheerio,
// @ts-expect-error - `render` is not part of the React types
show: (x) => React.render(JSON.stringify(x, null, 2)),
...React,
};
Expand Down
6 changes: 4 additions & 2 deletions website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"resolveJsonModule": true
}
"resolveJsonModule": true,
"checkJs": true
},
"exclude": [".docusaurus", "build", "node_modules"]
}

0 comments on commit 98e41ae

Please sign in to comment.