Skip to content

Commit

Permalink
vitest, consolidate tsconfig, cleanup tasks (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick authored Mar 25, 2024
1 parent 8d740f0 commit 03d5f20
Show file tree
Hide file tree
Showing 116 changed files with 1,648 additions and 2,637 deletions.
13 changes: 2 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module.exports = {
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:jest/recommended",
"plugin:vitest/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:tailwindcss/recommended",
"plugin:@next/next/recommended",
],
plugins: ["jest", "deprecation", "import", "eslint-plugin-tailwindcss"],
plugins: ["deprecation", "import", "eslint-plugin-tailwindcss"],
env: {
browser: true,
es2021: true,
Expand All @@ -41,9 +41,6 @@ module.exports = {
allowAutomaticSingleRunInference: true,
tsconfigRootDir: __dirname,
},
env: {
"jest/globals": true,
},
ignorePatterns: ["*.js", "*.jsx"],
rules: {
"@typescript-eslint/no-unused-vars": [
Expand Down Expand Up @@ -79,7 +76,6 @@ module.exports = {
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"jest/expect-expect": ["error", { assertFunctionNames: ["expect*"] }],
"linebreak-style": ["error", "unix"],
"no-console": "error",
"no-empty": [
Expand All @@ -98,7 +94,6 @@ module.exports = {
],
semi: ["error", "always"],
indent: "off",
"jest/unbound-method": ["error"],
"object-shorthand": ["error"],
"deprecation/deprecation": "error",
"import/no-internal-modules": [
Expand All @@ -125,10 +120,6 @@ module.exports = {
{
files: ["packages/fdr-sdk/**/*", "servers/fdr-deploy/**/*", "servers/fdr/**/*"],
rules: {
"jest/expect-expect": "off",
"jest/valid-expect": "off",
"jest/no-standalone-expect": "off",
"jest/no-conditional-expect": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ To run the unit tests: `pnpm test`.

To run the integration tests: `pnpm test:ete`.

Many of our tests rely on [Jest snapshot testing](https://jestjs.io/docs/snapshot-testing). To rewrite snapshots, use `-u`: `pnpm test -u` and `pnpm test:ete -u`.
Many of our tests rely on [Vite](https://vitejs.dev/) snapshots. To rewrite snapshots, use `-u`: `pnpm test -u` and `pnpm test:ete -u`.

### CLI

Expand Down
14 changes: 14 additions & 0 deletions DEVELOPMENT_TIPS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Development Tips

This document contains some tips for developing in this repo. This is a living document, so feel free to add to it as you see fit.

## Using Turbo effectively

Turbo knows your dependencies and task graphs. If you need to build all tasks/scripts that depend on a certain task/script, just run it through `turbo`.

```sh
pnpm run <task> # this just runs given task
turbo run <task> # this runs given task and all tasks that depend on it
```

Turbo will cache all your tasks so it is safe to run it multiple times.
43 changes: 0 additions & 43 deletions jest.config.ts

This file was deleted.

20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"test": "turbo test",
"test": "CI=true turbo test",
"test:playwright": "pnpm exec playwright test --debug",
"clean": "turbo clean",
"compile": "turbo compile",
"codegen": "turbo codegen",
"compile": "turbo compile",
"build": "turbo build",
"depcheck": "turbo depcheck",
"lint": "pnpm lint:monorepo && pnpm lint:eslint && pnpm lint:style && pnpm format:check",
Expand Down Expand Up @@ -39,15 +39,14 @@
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.3",
"@babel/preset-typescript": "^7.24.1",
"@next/eslint-plugin-next": "^14.1.0",
"@playwright/test": "^1.42.1",
"@types/is-ci": "^3.0.4",
"@types/jest": "^29.5.11",
"@types/lodash-es": "4.17.12",
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "6.18.1",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"@yarnpkg/sdks": "^3.1.0",
"chalk": "^5.3.0",
"depcheck": "^1.4.3",
Expand All @@ -57,16 +56,15 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-vitest": "^0.3.26",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-tailwindcss": "^3.13.1",
"execa": "^5.1.1",
"husky": "^8.0.1",
"immer": "^9.0.15",
"is-ci": "^3.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"vitest": "^1.4.0",
"jsonc-parser": "~2.2.1",
"lint-staged": "^13.0.3",
"lodash-es": "^4.17.21",
Expand All @@ -84,8 +82,8 @@
"ts-node": "^10.9.1",
"tsx": "^4.7.1",
"turbo": "^1.12.5",
"typescript": "4.9.5",
"typescript-plugin-css-modules": "^5.0.2"
"typescript": "5.4.3",
"typescript-plugin-css-modules": "^5.1.0"
},
"resolutions": {
"postcss": "8.4.31",
Expand Down
1 change: 0 additions & 1 deletion packages/cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.js
!jest.config.js
*.d.ts
node_modules

Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The `cdk.json` file tells the CDK Toolkit how to execute your app.

- `npm run build` compile typescript to js
- `npm run watch` watch for changes and compile
- `npm run test` perform the jest unit tests
- `npm run test` perform the vitest unit tests
- `cdk deploy` deploy this stack to your default AWS account/region
- `cdk diff` compare deployed stack with current state
- `cdk synth` emits the synthesized CloudFormation template
8 changes: 0 additions & 8 deletions packages/cdk/jest.config.js

This file was deleted.

9 changes: 5 additions & 4 deletions packages/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},
"private": true,
"files": [
"lib"
"dist"
],
"type": "commonjs",
"source": "src/cdk.ts",
"main": "lib/cdk.js",
"types": "lib/cdk.d.ts",
"main": "dist/cdk.js",
"types": "dist/cdk.d.ts",
"sideEffects": false,
"scripts": {
"cdk": "cdk",
Expand All @@ -29,10 +29,11 @@
"constructs": "^10.3.0"
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/archiver": "^6.0.2",
"@types/node": "^18.7.18",
"aws-cdk": "^2.118.0",
"prettier": "^3.2.4",
"typescript": "4.9.5"
"typescript": "5.4.3"
}
}
4 changes: 2 additions & 2 deletions packages/cdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "module": "CommonJS", "outDir": "lib", "rootDir": "src" },
"extends": "@fern-platform/configs/tsconfig/cli.json",
"compilerOptions": { "outDir": "./dist", "rootDir": "./src" },
"include": ["./src/**/*"],
"exclude": ["cdk.out"]
}
2 changes: 1 addition & 1 deletion packages/commons/core-utils/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node", "vite", "@types/react"], "ignore-patterns": ["lib"] }
{ "ignores": ["@fern-platform/configs", "@types/node", "vite", "@types/react"], "ignore-patterns": ["dist"] }
1 change: 0 additions & 1 deletion packages/commons/core-utils/jest.config.ts

This file was deleted.

10 changes: 5 additions & 5 deletions packages/commons/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"private": true,
"files": [
"lib"
"dist"
],
"type": "module",
"source": "src/index.ts",
Expand All @@ -18,7 +18,7 @@
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "jest --passWithNoTests",
"test": "vitest --passWithNoTests --globals",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
Expand All @@ -34,16 +34,16 @@
"ua-parser-js": "^1.0.35"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/title": "^3.4.3",
"@types/ua-parser-js": "^0.7.39",
"depcheck": "^1.4.3",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"vitest": "^1.4.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.2.4",
"stylelint": "^16.1.0",
"typescript": "4.9.5"
"typescript": "5.4.3"
}
}
2 changes: 1 addition & 1 deletion packages/commons/core-utils/src/objects/isPlainObject.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/lodash/lodash/blob/master/isPlainObject.js
export function isPlainObject(value: unknown): value is Record<string, unknown> {
if (!isObjectLike(value) || toString.call(value) !== "[object Object]") {
if (!isObjectLike(value) || String.toString.call(value) !== "[object Object]") {
return false;
}
if (Object.getPrototypeOf(value) == null) {
Expand Down
4 changes: 2 additions & 2 deletions packages/commons/core-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "." },
"extends": "@fern-platform/configs/tsconfig/library.json",
"compilerOptions": { "outDir": "./dist", "rootDir": "./src" },
"include": ["./src/**/*"]
}
2 changes: 1 addition & 1 deletion packages/commons/fdr-utils/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node", "vite", "@types/react"], "ignore-patterns": ["lib"] }
{ "ignores": ["@fern-platform/configs", "@types/node", "vite", "@types/react"], "ignore-patterns": ["dist"] }
1 change: 0 additions & 1 deletion packages/commons/fdr-utils/jest.config.ts

This file was deleted.

10 changes: 5 additions & 5 deletions packages/commons/fdr-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"private": true,
"files": [
"lib"
"dist"
],
"type": "module",
"source": "src/index.ts",
Expand All @@ -18,7 +18,7 @@
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "jest --passWithNoTests",
"test": "vitest --passWithNoTests --globals",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
Expand All @@ -33,15 +33,15 @@
"@fern-ui/core-utils": "workspace:*"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"vitest": "^1.4.0",
"next-mdx-remote": "^4.4.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.2.4",
"stylelint": "^16.1.0",
"typescript": "4.9.5"
"typescript": "5.4.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`getAllUrlsFromDocsConfig hume gets all urls from docs config 1`] = `
exports[`getAllUrlsFromDocsConfig > hume > gets all urls from docs config 1`] = `
[
"dev.hume.ai",
"dev.hume.ai/docs",
Expand Down Expand Up @@ -68,28 +68,28 @@ exports[`getAllUrlsFromDocsConfig hume gets all urls from docs config 1`] = `
]
`;

exports[`getNavigationRoot hume gets navigation root for /docs 1`] = `
exports[`getNavigationRoot > hume > gets navigation root for /docs 1`] = `
{
"redirect": "/intro",
"type": "redirect",
}
`;

exports[`getNavigationRoot hume gets navigation root for /reference 1`] = `
exports[`getNavigationRoot > hume > gets navigation root for /reference 1`] = `
{
"redirect": "/reference/expression-measurement-api/batch/list-jobs",
"type": "redirect",
}
`;

exports[`getNavigationRoot hume gets navigation root for /reference/expression-measurement-api/stream 1`] = `
exports[`getNavigationRoot > hume > gets navigation root for /reference/expression-measurement-api/stream 1`] = `
{
"redirect": "/reference/expression-measurement-api/stream/stream",
"type": "redirect",
}
`;

exports[`getNavigationRoot hume gets navigation root for /support 1`] = `
exports[`getNavigationRoot > hume > gets navigation root for /support 1`] = `
{
"found": {
"currentNode": {
Expand Down
Loading

0 comments on commit 03d5f20

Please sign in to comment.