Skip to content

ref(dev): Unify typescript config files #4178

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

Merged
merged 30 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dd7615f
add templates
lobsterkatie Nov 23, 2021
3fa9b23
alphabetize base `tsconfig.json` compiler options
lobsterkatie Nov 23, 2021
f8bb951
make `tsconfig.esm.json` inherit from package-level `tsconfig.json`
lobsterkatie Nov 23, 2021
5067883
make `tsconfig.build.json` inherit from package-level `tsconfig.json`
lobsterkatie Nov 23, 2021
1faecba
move package-specific options to package-level `tsconfig.json` - angular
lobsterkatie Nov 23, 2021
7617041
move package-specific options to package-level `tsconfig.json` - gatsby
lobsterkatie Nov 23, 2021
9b0eaa1
move package-specific options to package-level `tsconfig.json` - inte…
lobsterkatie Nov 23, 2021
e1e1d91
move package-specific options to package-level `tsconfig.json` - react
lobsterkatie Nov 23, 2021
05d8825
move package-specific options to package-level `tsconfig.json` - serv…
lobsterkatie Nov 23, 2021
07f32cf
move package-specific options to package-level `tsconfig.json` - vue
lobsterkatie Nov 23, 2021
1213493
remove `"declarationMap": false` settings in tsconfig files
lobsterkatie Nov 23, 2021
dd4a01d
add `declarationMap` setting to rollup configs missing it
lobsterkatie Nov 24, 2021
0b94f60
remove redundant `rootDir` setting from `tsconfig.build.json`
lobsterkatie Nov 23, 2021
5869272
remove redundant node types in package-level config
lobsterkatie Nov 23, 2021
0adf0b3
remove trailing commas
lobsterkatie Nov 23, 2021
c570526
add module config to all package-level `build` and `esm` files
lobsterkatie Nov 23, 2021
dfdc2f3
inherit from `esm` rather than `build` in rollup configs
lobsterkatie Nov 24, 2021
420c04d
remove unnecessary `paths` config from top-level tsconfig
lobsterkatie Nov 23, 2021
0944502
remove now unnecessary `baseUrl` overrides from package-level tsconfigs
lobsterkatie Nov 24, 2021
70002d4
add `baseUrl` setting to rollup config
lobsterkatie Nov 24, 2021
e84063a
remove unnecessary `exclude` settings
lobsterkatie Nov 23, 2021
6181957
make package-level `tsconfig.json` inherit from repo-level `tsconfig.…
lobsterkatie Nov 23, 2021
8a37a38
move test config to separate `tsconfig.test.json` file
lobsterkatie Nov 23, 2021
e06e205
remove now-unnecessary `rootDir` config from package-level `tsconfig.…
lobsterkatie Nov 23, 2021
4c4d2cc
simplify `include` settings
lobsterkatie Nov 23, 2021
e15af42
fix formatting and add/fix comments
lobsterkatie Nov 23, 2021
465ec2d
rename `tsconfig.build.json` to `tsconfig.cjs.json`
lobsterkatie Nov 23, 2021
821f543
fix package.json scripts to reflect `build` -> `cjs` renaming
lobsterkatie Nov 23, 2021
ccd2ad0
fix eslint config to use new test-specific tsconfig
lobsterkatie Nov 23, 2021
797ce20
add readme for templates
lobsterkatie Nov 23, 2021
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
21 changes: 11 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file
// lives

module.exports = {
root: true,
env: {
Expand All @@ -7,20 +10,18 @@ module.exports = {
ecmaVersion: 2018,
},
extends: ['@sentry-internal/sdk'],
ignorePatterns: [
'coverage/**',
'build/**',
'dist/**',
'esm/**',
'examples/**',
'scripts/**',
'test/manual/**',
],
ignorePatterns: ['coverage/**', 'build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**', 'test/manual/**'],
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
parserOptions: {
project: './tsconfig.json',
project: ['tsconfig.json'],
},
},
{
files: ['test/**/*.ts', 'test/**/*.tsx'],
parserOptions: {
project: ['tsconfig.test.json'],
},
},
{
Expand Down
10 changes: 6 additions & 4 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
"typescript": "3.7.5"
},
"scripts": {
"build": "run-p build:es5 build:esm",
"build": "run-p build:cjs build:esm",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:dev": "run-s build",
"build:es5": "tsc -p tsconfig.build.json",
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
"build:esm": "tsc -p tsconfig.esm.json",
"build:watch": "run-p build:es5:watch build:esm:watch",
"build:watch": "run-p build:cjs:watch build:esm:watch",
"build:cjs:watch": "tsc -p tsconfig.cjs.json -w --preserveWatchOutput",
"build:dev:watch": "run-s build:watch",
"build:es5:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there is any place that uses them directly, let's just remove.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could do, but given that there's no harm in leaving it, any reason not to err on the side of caution?

Copy link
Member

Choose a reason for hiding this comment

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

I guess if we are going back to standardize all the package.json eventually, we can get away with leaving it here for now.

"build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
Expand Down
9 changes: 0 additions & 9 deletions packages/angular/tsconfig.build.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages/angular/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",

"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
}
}
11 changes: 5 additions & 6 deletions packages/angular/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"extends": "../../tsconfig.esm.json",
"extends": "./tsconfig.json",

"compilerOptions": {
"baseUrl": ".",
"outDir": "esm",
"experimentalDecorators": true
},
"include": ["src/**/*"]
"module": "es6",
"outDir": "esm"
}
}
10 changes: 6 additions & 4 deletions packages/angular/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"extends": "./tsconfig.build.json",
"include": ["src/**/*.ts"],
"exclude": ["dist"],
"extends": "../../tsconfig.json",

"include": ["src/**/*"],

"compilerOptions": {
"rootDir": "."
// package-specific options
"experimentalDecorators": true
}
}
12 changes: 12 additions & 0 deletions packages/angular/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",

"include": ["test/**/*"],

"compilerOptions": {
// should include all types from `./tsconfig.json` plus types for all test frameworks used
"types": ["jest"]

// other package-specific, test-specific options
}
}
14 changes: 8 additions & 6 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@
"webpack": "^4.30.0"
},
"scripts": {
"build": "run-s build:es5 build:esm build:bundle",
"build": "run-p build:cjs build:esm build:bundle",
"build:bundle": "rollup --config",
"build:dev": "run-s build:es5 build:esm",
"build:es5": "tsc -p tsconfig.build.json",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:dev": "run-p build:cjs build:esm",
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
"build:esm": "tsc -p tsconfig.esm.json",
"build:watch": "run-p build:es5:watch build:esm:watch build:bundle:watch",
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch",
"build:bundle:watch": "rollup --config --watch",
"build:dev:watch": "run-p build:es5:watch build:esm:watch",
"build:es5:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
"build:cjs:watch": "tsc -p tsconfig.cjs.json -w --preserveWatchOutput",
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
"build:dev:watch": "run-p build:cjs:watch build:esm:watch",
"build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage .rpt2_cache",
Expand Down
12 changes: 6 additions & 6 deletions packages/browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ const paths = {

const plugins = [
typescript({
tsconfig: 'tsconfig.build.json',
tsconfig: 'tsconfig.esm.json',
tsconfigOverride: {
compilerOptions: {
declaration: false,
declarationMap: false,
module: 'ES2015',
paths,
baseUrl: '.',
},
},
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
Expand Down Expand Up @@ -103,13 +103,13 @@ export default [
},
plugins: [
typescript({
tsconfig: 'tsconfig.build.json',
tsconfig: 'tsconfig.esm.json',
tsconfigOverride: {
compilerOptions: {
declaration: false,
declarationMap: false,
module: 'ES2015',
paths,
baseUrl: '.',
target: 'es6',
},
},
Expand All @@ -126,13 +126,13 @@ export default [
},
plugins: [
typescript({
tsconfig: 'tsconfig.build.json',
tsconfig: 'tsconfig.esm.json',
tsconfigOverride: {
compilerOptions: {
declaration: false,
declarationMap: false,
module: 'ES2015',
paths,
baseUrl: '.',
target: 'es6',
},
},
Expand Down
8 changes: 0 additions & 8 deletions packages/browser/tsconfig.build.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages/browser/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",

"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
}
}
8 changes: 4 additions & 4 deletions packages/browser/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../../tsconfig.esm.json",
"extends": "./tsconfig.json",

"compilerOptions": {
"baseUrl": ".",
"module": "es6",
"outDir": "esm"
},
"include": ["src/**/*"]
}
}
10 changes: 5 additions & 5 deletions packages/browser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "./tsconfig.build.json",
"include": ["src/**/*", "test/**/*"],
"exclude": ["dist"],
"extends": "../../tsconfig.json",

"include": ["src/**/*"],

"compilerOptions": {
"rootDir": ".",
"types": ["node", "mocha", "chai", "sinon", "jest"]
// package-specific options
}
}
12 changes: 12 additions & 0 deletions packages/browser/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",

"include": ["test/**/*"],

"compilerOptions": {
// should include all types from `./tsconfig.json` plus types for all test frameworks used
Copy link
Member

Choose a reason for hiding this comment

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

Would just 🔥 these comments in all of the tsconfigs, we can leave it in the template

Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike the other comments, which I removed, these I think we should keep, because if you ever were to make changes, you'd need to know this fact.

"types": ["node", "mocha", "chai", "sinon", "jest"]

// other package-specific, test-specific options
}
}
10 changes: 6 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
"typescript": "3.7.5"
},
"scripts": {
"build": "run-p build:es5 build:esm",
"build": "run-p build:cjs build:esm",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:dev": "run-s build",
"build:es5": "tsc -p tsconfig.build.json",
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
"build:esm": "tsc -p tsconfig.esm.json",
"build:watch": "run-p build:es5:watch build:esm:watch",
"build:watch": "run-p build:cjs:watch build:esm:watch",
"build:cjs:watch": "tsc -p tsconfig.cjs.json -w --preserveWatchOutput",
"build:dev:watch": "run-s build:watch",
"build:es5:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
"build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm coverage",
Expand Down
8 changes: 0 additions & 8 deletions packages/core/tsconfig.build.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages/core/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",

"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
}
}
8 changes: 4 additions & 4 deletions packages/core/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../../tsconfig.esm.json",
"extends": "./tsconfig.json",

"compilerOptions": {
"baseUrl": ".",
"module": "es6",
"outDir": "esm"
},
"include": ["src/**/*"]
}
}
10 changes: 5 additions & 5 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "./tsconfig.build.json",
"include": ["src/**/*.ts", "test/**/*.ts"],
"exclude": ["dist"],
"extends": "../../tsconfig.json",

"include": ["src/**/*"],

"compilerOptions": {
"rootDir": ".",
"types": ["node", "jest"]
// package-specific options
}
}
12 changes: 12 additions & 0 deletions packages/core/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",

"include": ["test/**/*"],

"compilerOptions": {
// should include all types from `./tsconfig.json` plus types for all test frameworks used
"types": ["node", "jest"]

// other package-specific, test-specific options
}
}
10 changes: 6 additions & 4 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
"typescript": "3.7.5"
},
"scripts": {
"build": "run-p build:es5 build:esm",
"build": "run-p build:cjs build:esm",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:dev": "run-s build",
"build:es5": "tsc -p tsconfig.build.json",
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
"build:esm": "tsc -p tsconfig.esm.json",
"build:watch": "run-p build:es5:watch build:esm:watch",
"build:watch": "run-p build:cjs:watch build:esm:watch",
"build:cjs:watch": "tsc -p tsconfig.cjs.json -w --preserveWatchOutput",
"build:dev:watch": "run-s build:watch",
"build:es5:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
"build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
Expand Down
10 changes: 0 additions & 10 deletions packages/gatsby/tsconfig.build.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages/gatsby/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",

"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
}
}
12 changes: 5 additions & 7 deletions packages/gatsby/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"extends": "../../tsconfig.esm.json",
"extends": "./tsconfig.json",

"compilerOptions": {
"esModuleInterop": true,
"baseUrl": ".",
"outDir": "esm",
"jsx": "react"
},
"include": ["src/**/*"]
"module": "es6",
"outDir": "esm"
}
}
Loading