Skip to content

Commit 8d840be

Browse files
authored
chore(types): make project type safe (#51)
1 parent 7a20840 commit 8d840be

Some content is hidden

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

43 files changed

+198
-98
lines changed

.github/workflows/build-docs.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy Documentation
22

33
on:
44
push:
5-
branches: ["master"]
5+
branches: ['master']
66

77
# Allows you to run this workflow manually from the Actions tab
88
workflow_dispatch:
@@ -16,7 +16,7 @@ permissions:
1616
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1717
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1818
concurrency:
19-
group: "pages"
19+
group: 'pages'
2020
cancel-in-progress: false
2121

2222
jobs:
@@ -42,10 +42,6 @@ jobs:
4242
- name: Build docs site
4343
run: pnpm nx run docs-docs-site:build
4444

45-
- name: Export docs site
46-
run: pnpm nx run docs-docs-site:export
47-
48-
4945
- name: Upload artifact
5046
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
5147
with:

docs/docs-site/next.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const withNextra = require('nextra')({
55
});
66
const nextConfig = {
77
...withNextra(),
8+
output: 'export',
89
distDir: '../../dist/docs/docs-site/.next',
910
images: {
1011
unoptimized: true,

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
}
1616
},
1717
"dependencies": {
18-
"@angular-devkit/schematics": "11.2.0",
1918
"@angular-devkit/core": "11.2.0",
19+
"@angular-devkit/schematics": "11.2.0",
2020
"@apollo/client": "3.6.9",
2121
"@cucumber/gherkin": "27.0.0",
2222
"@cucumber/messages": "19.1.4",
@@ -93,6 +93,7 @@
9393
"@babel/runtime": "7.16.7",
9494
"@badeball/cypress-cucumber-preprocessor": "13.0.2",
9595
"@bahmutov/cypress-esbuild-preprocessor": "2.1.5",
96+
"@cypress/browserify-preprocessor": "3.0.2",
9697
"@cypress/webpack-preprocessor": "6.0.2",
9798
"@next/bundle-analyzer": "14.0.4",
9899
"@nx/cypress": "17.3.2",
@@ -117,10 +118,12 @@
117118
"@swc/core": "~1.3.85",
118119
"@swc/helpers": "~0.5.2",
119120
"@testing-library/cypress": "8.0.2",
121+
"@testing-library/dom": "8.20.1",
120122
"@testing-library/jest-dom": "6.2.1",
121123
"@testing-library/react": "14.0.0",
122124
"@types/ejs": "3.0.6",
123125
"@types/eslint": "8.56.10",
126+
"@types/glob": "7.2.0",
124127
"@types/http-proxy": "1.17.7",
125128
"@types/inquirer": "7.3.1",
126129
"@types/jest": "29.4.4",
@@ -184,9 +187,7 @@
184187
"typescript": "~5.3.2",
185188
"webpack": "5.74.0",
186189
"zod": "3.22.3",
187-
"zod-to-ts": "1.2.0",
188-
"@testing-library/dom": "8.20.1",
189-
"@cypress/browserify-preprocessor": "3.0.2"
190+
"zod-to-ts": "1.2.0"
190191
},
191192
"msw": {
192193
"workerDirectory": ".storybook/msw"

packages/create/bin/versions.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
3-
"@brainly-gene/core": "0.2.0-alpha.18",
4-
"@brainly-gene/next": "0.2.0-alpha.18",
3+
"@brainly-gene/core": "0.2.0-alpha.20",
4+
"@brainly-gene/next": "0.2.0-alpha.20",
55
"@nx/next": "17.3.2",
66
"@sentry/react": "7.77.0",
77
"@storybook/addon-actions": "6.5.16",
@@ -51,8 +51,8 @@
5151
"mini-css-extract-plugin": "2.2.0"
5252
},
5353
"devDependencies": {
54-
"@brainly-gene/eslint-plugin": "0.2.0-alpha.18",
55-
"@brainly-gene/tools": "0.2.0-alpha.18",
54+
"@brainly-gene/eslint-plugin": "0.2.0-alpha.20",
55+
"@brainly-gene/tools": "0.2.0-alpha.20",
5656
"@nx/cypress": "17.3.2",
5757
"@nx/devkit": "17.3.2",
5858
"@nx/eslint-plugin": "17.3.2",
@@ -70,7 +70,7 @@
7070
"@storybook/addons": "6.3.8",
7171
"@storybook/builder-webpack5": "6.5.4",
7272
"@storybook/core-server": "6.5.16",
73-
"@storybook/manager-webpack5": "6.5.4",
73+
"@storybook/manager-webpack5": "6.5.16",
7474
"@storybook/react": "6.5.16",
7575
"@storybook/theming": "6.5.16",
7676
"@testing-library/dom": "8.20.1",

packages/create/tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"noImplicitOverride": true,
88
"noPropertyAccessFromIndexSignature": true,
99
"noImplicitReturns": true,
10-
"noFallthroughCasesInSwitch": true
10+
"noFallthroughCasesInSwitch": true,
11+
"noImplicitAny": true,
12+
"noImplicitThis": true,
13+
"strictNullChecks": true,
14+
"noUncheckedIndexedAccess": true
1115
},
1216
"files": [],
1317
"include": [],

packages/create/tsconfig.lib.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
6-
"types": ["node"]
6+
"types": ["node"],
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noUncheckedIndexedAccess": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"forceConsistentCasingInFileNames": true
712
},
813
"include": ["src/**/*.ts"],
914
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]

packages/eslint-plugin/src/rules/use-listener.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const useListenerRule = ESLintUtils.RuleCreator(
4646
create(context, [{ ignorePaths }]) {
4747
return {
4848
CallExpression(node: TSESTree.CallExpression) {
49-
const isPathIgnored = ignorePaths.some((path) =>
49+
const isPathIgnored = ignorePaths?.some((path) =>
5050
context.getFilename().includes(path)
5151
);
5252

packages/eslint-plugin/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
"compilerOptions": {
44
"module": "node16",
55
"moduleResolution": "node16",
6+
"strict": true,
7+
"noFallthroughCasesInSwitch": true,
8+
"noImplicitAny": true,
9+
"noImplicitThis": true,
10+
"strictNullChecks": true,
11+
"noUncheckedIndexedAccess": true,
12+
"forceConsistentCasingInFileNames": true
613
},
714
"files": [],
815
"include": [],

packages/eslint-plugin/tsconfig.lib.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
6-
"types": ["node"]
6+
"types": ["node"],
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noUncheckedIndexedAccess": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"forceConsistentCasingInFileNames": true
712
},
813
"include": ["**/*.ts"],
914
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]

packages/gene-apollo/tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"forceConsistentCasingInFileNames": true,
88
"strict": true,
99
"noImplicitReturns": true,
10-
"noFallthroughCasesInSwitch": true
10+
"noFallthroughCasesInSwitch": true,
11+
"noImplicitAny": true,
12+
"noImplicitThis": true,
13+
"strictNullChecks": true,
14+
"noUncheckedIndexedAccess": true
1115
},
1216
"files": [],
1317
"include": [],

packages/gene-apollo/tsconfig.lib.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
6-
"types": ["node"]
6+
"types": ["node"],
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noUncheckedIndexedAccess": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"forceConsistentCasingInFileNames": true
712
},
813
"files": [
914
"../../node_modules/@nx/react/typings/cssmodule.d.ts",

packages/gene-next/src/routing/routers/generate.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import {useHrefRewrite} from '../rewrites';
1+
import { useHrefRewrite } from '../rewrites';
22
import React from 'react';
33

44
export function useGenerator() {
5-
const {translateRoute, getRedirect, originUrl} = useHrefRewrite();
5+
const { translateRoute, getRedirect, originUrl } = useHrefRewrite();
66

77
const generate = React.useCallback(
88
(route: string) => {
99
const [pathname, searchParams] = route.split('?');
10-
const rewrite = translateRoute(pathname);
11-
const redirect = getRedirect(pathname);
10+
const rewrite = translateRoute(pathname || '');
11+
const redirect = getRedirect(pathname || '');
1212

1313
const url = rewrite || redirect || originUrl + route;
1414

packages/gene-next/tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"forceConsistentCasingInFileNames": true,
88
"strict": true,
99
"noImplicitReturns": true,
10-
"noFallthroughCasesInSwitch": true
10+
"noFallthroughCasesInSwitch": true,
11+
"noImplicitAny": true,
12+
"noImplicitThis": true,
13+
"strictNullChecks": true,
14+
"noUncheckedIndexedAccess": true
1115
},
1216
"files": [],
1317
"include": [],

packages/gene-next/tsconfig.lib.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
6-
"types": ["node"]
6+
"types": ["node"],
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noUncheckedIndexedAccess": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"forceConsistentCasingInFileNames": true
712
},
813
"files": [
914
"../../node_modules/@nx/react/typings/cssmodule.d.ts",

packages/gene-sentry/tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"forceConsistentCasingInFileNames": true,
88
"strict": true,
99
"noImplicitReturns": true,
10-
"noFallthroughCasesInSwitch": true
10+
"noFallthroughCasesInSwitch": true,
11+
"noImplicitAny": true,
12+
"noImplicitThis": true,
13+
"strictNullChecks": true,
14+
"noUncheckedIndexedAccess": true
1115
},
1216
"files": [],
1317
"include": [],

packages/gene-sentry/tsconfig.lib.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
6-
"types": ["node"]
6+
"types": ["node"],
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noUncheckedIndexedAccess": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"forceConsistentCasingInFileNames": true
712
},
813
"files": [
914
"../../node_modules/@nx/react/typings/cssmodule.d.ts",

packages/gene-tools/src/executors/copy-assets-to-app/copy-assets-to-app.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
// @ts-expect-error TS7016
12
import { copySync } from 'fs-extra';
23
import { join } from 'path';
34

4-
async function executor(options, context) {
5+
async function executor(
6+
options: any,
7+
context: { projectName: any; root: any; workspace: any }
8+
) {
59
const projectName = context.projectName;
610
const appRootPath = context.root;
7-
11+
812
if (!projectName) {
913
throw new Error('No project specified.');
1014
}
@@ -49,7 +53,7 @@ async function executor(options, context) {
4953
copySync(imageFrom, imageTo, {
5054
recursive: true,
5155
overwrite: true,
52-
filter: (src) => {
56+
filter: (src: string | string[]) => {
5357
if (src.includes('.svg')) {
5458
throw new Error(
5559
`'Please put SVG files into "nx-static" folder instead of "nx-images": ${src}`

packages/gene-tools/src/executors/copy-assets-to-storybook/copy-assets-to-storybook.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { prepareStorybookRootAssets } from './prepare-storybook-root-assets';
2-
2+
// @ts-expect-error TS7016
33
import { copySync, removeSync } from 'fs-extra';
44
import { join } from 'path';
55
import { toAbsolute } from '../utilities/path';
66

7-
async function executor(options, context) {
7+
async function executor(options: any, context: { root: any; workspace: any; }) {
88
const workspaceRoot = context.root;
99
const assetsProject = 'assets';
1010
const workspace = context.workspace;
@@ -47,7 +47,7 @@ async function executor(options, context) {
4747
copySync(imagesFrom, imagesTo, {
4848
recursive: true,
4949
overwrite: true,
50-
filter: (src) => {
50+
filter: (src: string | string[]) => {
5151
if (src.includes('.svg')) {
5252
throw new Error(
5353
`Please put SVG files into "nx-static" folder instead of "nx-images": ${src}`

packages/gene-tools/src/executors/copy-translations-to-app/copy-translations-to-app.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// @ts-expect-error TS7016
12
import { copySync, removeSync } from 'fs-extra';
23
import { join } from 'path';
34

4-
async function executor(options, context) {
5+
async function executor(
6+
options: any,
7+
context: { projectName: any; root: any; workspace: any }
8+
) {
59
const projectName = context.projectName;
610
const appRootPath = context.root;
711

packages/gene-tools/src/executors/copy-translations-to-storybook/copy-translations-to-storybook.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// @ts-expect-error TS7016
12
import { copySync, removeSync } from 'fs-extra';
23
import { join } from 'path';
34
import { toAbsolute } from '../utilities/path';
45

5-
async function executor(options, context) {
6+
async function executor(options: any, context: { root: any; workspace: any }) {
67
const appRootPath = context.root;
78
const translationsProject = 'translations';
89
const workspace = context.workspace;

packages/gene-tools/src/generators/bff-app-generator/files/app/tsconfig.json__tmpl__

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"types": ["node", "jest"],
1010
"strict": true,
1111
"strictNullChecks": true,
12+
"noFallthroughCasesInSwitch": true,
13+
"noUncheckedIndexedAccess": true,
1214
"forceConsistentCasingInFileNames": true,
1315
"resolveJsonModule": true,
1416
"isolatedModules": true,

packages/gene-tools/src/generators/component-generator/utils/getComponentTemplateVariables.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ export const getComponentTemplateVariables = (
3838
const stylesExtension = 'scss';
3939

4040
const propsArray = pipe(
41-
splitStringToEntries(defaultPropsType),
41+
splitStringToEntries(defaultPropsType) as any,
4242
map(
4343
parsePropsEntries({
4444
defaultValue: defaultPropsType,
4545
shouldAddFlowDeclaration,
4646
})
4747
)
48+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
49+
// @ts-ignore
4850
)(props as string);
4951
const eventsArray = splitStringToArray(events as string);
5052
const copyArray = splitStringToArray(copy as string);

0 commit comments

Comments
 (0)