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

chore: Cleanup duplication across tsconfig files in packages #30764

Merged
merged 4 commits into from
Dec 16, 2024
Merged
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
2 changes: 0 additions & 2 deletions packages/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
],
"compilerOptions": {
"noImplicitThis": true,
"useDefineForClassFields": true,
"paths": {
"@cy/i18n": ["../frontend-shared/src/locales/i18n"],
"@cy/components/*": ["../frontend-shared/src/components/*"],
"@cy/gql-components/*": ["../frontend-shared/src/gql-components/*"],
"@cy/store/*": ["../frontend-shared/src/store/*"],
"@packages/*": ["../*"]
},
"allowJs": true,
"types": [
"cypress",
"cypress-real-events",
Expand Down
10 changes: 0 additions & 10 deletions packages/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@
"test"
],
"compilerOptions": {
"strict": true,
"allowJs": false,
"rootDir": "src",
"noImplicitAny": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"types": ["node"],
"typeRoots": [
"../../node_modules/@types"
Expand Down
11 changes: 0 additions & 11 deletions packages/data-context/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@
],
"compilerOptions": {
"lib": ["esnext"],
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUnusedLocals": false,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"types": ["cypress"],
}
}
8 changes: 0 additions & 8 deletions packages/driver/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
"compilerOptions": {
"target": "ES2016",
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"module": "commonjs",
"allowJs": true,
"noImplicitAny": false,
"noImplicitThis": false,
"strictFunctionTypes": true,
"preserveWatchOutput": true,
"sourceMap": true,
"importHelpers": true,
"strictNullChecks": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"noEmit": true,
"noImplicitReturns": true,
"allowSyntheticDefaultImports": true,
"outDir": "dist",
"esModuleInterop": true,
"noErrorTruncation": true,
"types": []
},
Expand Down
10 changes: 0 additions & 10 deletions packages/errors/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@
"src",
],
"compilerOptions": {
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noImplicitReturns": false,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
}
}
7 changes: 1 addition & 6 deletions packages/extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"extends": "../ts/tsconfig.json",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newly extended

"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noImplicitAny": false,
"importHelpers": true,
"strict": false
}
}
59 changes: 2 additions & 57 deletions packages/frontend-shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,12 @@
{
"extends": "../ts/tsconfig.json",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newly extended

"compilerOptions": {
/* Basic Options */
"target": "ES2018",
"module": "esnext",
"lib": ["dom", "ESNext"],
/*
* Allow javascript files to be compiled.
* Override this in modules that need JS
*/
"noEmit": true,
"jsx": "preserve",
"preserveWatchOutput": true,
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
/* Generates corresponding '.d.ts' file. */
// "declaration": true,
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
/* Generates corresponding '.map' file. */
"sourceMap": true,
/* Import emit helpers from 'tslib'. */
"importHelpers": true,
"strictNullChecks": true,
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
// "traceResolution": true,
"strict": true,
"noImplicitAny": false,
"noImplicitThis": false,
"forceConsistentCasingInFileNames": true,
/**
* Skip type checking of all declaration files (*.d.ts).
* TODO: Look into changing this in the future
*/
/* Additional Checks */
"skipLibCheck": true,
/* Report errors on unused locals. */
// "noEmit": true,
"noUnusedLocals": false,
// "noUnusedParameters": true, /* Report errors on unused parameters. */
/* Report error when not all code paths in function return a value. */
"noImplicitReturns": true,
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": ["../driver/src"], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [] /* List of folders to include type definitions from. */

/* Type declaration files to be included in compilation. */
"noErrorTruncation": true,
"paths": {
"@cy/i18n": ["../frontend-shared/src/locales/i18n"],
"@cy/components/*": ["../frontend-shared/src/components/*"]
Expand All @@ -63,17 +20,5 @@
"cypress-real-events",
"cypress"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noErrorTruncation": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"useUnknownInCatchVariables": false
}
}
1 change: 0 additions & 1 deletion packages/graphql/src/utils/nexusTypegenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const nexusTypegenDebounced = (cfg: NexusTypegenCfg) => {
debounced[cfg.filePath] =
debounced[cfg.filePath] ?? _.debounce(nexusTypegen, 500)

// @ts-expect-error
debounced[cfg.filePath](cfg)
}

Expand Down
11 changes: 0 additions & 11 deletions packages/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,8 @@
],
"compilerOptions": {
"lib": ["esnext"],
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"noUnusedLocals": false,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"types": []
},
}
12 changes: 0 additions & 12 deletions packages/icons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
{
"extends": "../ts/tsconfig.json",
"compilerOptions": {
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"noUnusedLocals": false,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"outDir": "dist",
"declaration": true
},
}
1 change: 0 additions & 1 deletion packages/launcher/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"./index.ts"
],
"compilerOptions": {
"skipLibCheck": true
},
"files": [
"./../ts/index.d.ts"
Expand Down
1 change: 0 additions & 1 deletion packages/reporter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../ts/tsconfig.json",
"compilerOptions": {
"useDefineForClassFields": true,
"types": [
"node",
"cypress",
Expand Down
11 changes: 0 additions & 11 deletions packages/scaffold-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,8 @@
],
"compilerOptions": {
"lib": ["esnext"],
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUnusedLocals": false,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
/*
* TODO: remove importsNotUsedAsValues after typescript 5.5 and up as it will no longer work. If we want the same behavior
* as importsNotUsedAsValues, we need to use "verbatimModuleSyntax", which will require this package to be an ES Module.
*/
"importsNotUsedAsValues": "error",
"types": []
}
}
2 changes: 2 additions & 0 deletions packages/server/lib/automation/util.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type playwright from 'playwright-webkit'
import { domainMatch } from 'tough-cookie'

// @ts-ignore
export type CyCookie = Pick<chrome.cookies.Cookie, 'name' | 'value' | 'expirationDate' | 'hostOnly' | 'domain' | 'path' | 'secure' | 'httpOnly'> & {
// use `undefined` instead of `unspecified`
sameSite?: 'no_restriction' | 'lax' | 'strict'
}

// Cypress uses the webextension-style filtering
// https://developer.chrome.com/extensions/cookies#method-getAll
// @ts-ignore
Copy link
Member Author

@jennifer-shehane jennifer-shehane Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't quite understand why these server checks weren't failing before. Here ts cannot find 'chrome'

export type CyCookieFilter = chrome.cookies.GetAllDetails

export const cookieMatches = (cookie: CyCookie | playwright.Cookie, filter: CyCookieFilter) => {
Expand Down
1 change: 1 addition & 0 deletions packages/server/lib/modes/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export = {
show: true,
frame: true,
transparent: false,
// @ts-ignore
Copy link
Member Author

@jennifer-shehane jennifer-shehane Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot find getPathToIcon - I think there's something strange with the icons package export/import, but don't think this should be a part of this PR

icon: image.createFromPath(cyIcons.getPathToIcon('icon_64x64.png')),
},
}
Expand Down
7 changes: 0 additions & 7 deletions packages/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,5 @@
],
"compilerOptions": {
"lib": ["esnext"],
"types": [
"mocha",
"node"
],
"resolveJsonModule": true,
"noUnusedLocals": false,
"importHelpers": true
}
}
1 change: 0 additions & 1 deletion packages/socket/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./../ts/tsconfig.json",
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"skipLibCheck": false
},
Expand Down
5 changes: 0 additions & 5 deletions packages/telemetry/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
"compilerOptions": {
"outDir": "./dist",
"lib": ["esnext", "DOM"],
"strict": true,
"allowJs": false,
"noImplicitAny": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noUnusedLocals": false,
"noUncheckedIndexedAccess": true,
"types": ["cypress"],
}
}
2 changes: 1 addition & 1 deletion packages/ts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TS

Internal package used to standardize this repo's version of `ts-node` used for development. In production we pre-transpile all of the typescript so this packages `register` export is a no-op
Internal package used to standardize this repo's version of `ts-node` and the base `tsconfig` options used for development. In production we pre-transpile all of the typescript so this packages `register` export is a no-op

## Installing
N/A - handled by the top level `yarn install`
Expand Down
Loading
Loading