Skip to content

Commit

Permalink
deps: use @agilgur5/tsconfig to simplify tsconfig
Browse files Browse the repository at this point in the history
Basically same as agilgur5/react-signature-canvas@cc6cce9

- this is my own tsconfig base (https://github.com/agilgur5/tsconfig) built on top of @tsconfig/strictest (https://github.com/tsconfig/bases)
  - as you can see, it just reduces all the non-type-checking related config that @tsconfig/strictest doesn't cover

- TS doesn't yet support package `exports` for tsconfigs yet (microsoft/TypeScript#48665), hence the longer path into the package

- Relative paths in tsconfig bases are also relative _within_ `node_modules` (microsoft/TypeScript#29172), so have to repeat any relative paths here
  - And due to this, I think it's better right now for `build` to extend the base here instead of the `build` tsconfig in `@agilgur5/tsconfig`
    - I didn't fully think that one through when I made it tbh, though it still serves as a good example tsconfig
    - Maybe that will be different in the future if TS changes or otherwise comes up with a solution to this (see the issue)
  • Loading branch information
agilgur5 committed Jun 13, 2022
1 parent f5cda83 commit be0922a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
26 changes: 25 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@babel/runtime": "^7.17.9"
},
"devDependencies": {
"@agilgur5/tsconfig": "^0.0.2",
"@babel/core": "^7.17.9",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
Expand All @@ -66,7 +67,6 @@
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^13.2.0",
"@tsconfig/strictest": "^1.0.0",
"changelog-maker": "^3.0.0",
"concurrently": "^7.1.0",
"jest": "^27.5.1",
Expand Down
18 changes: 2 additions & 16 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
{
// https://github.com/tsconfig/bases
"extends": "@tsconfig/strictest/tsconfig.json",
// https://github.com/agilgur5/tsconfig
"extends": "@agilgur5/tsconfig/src/tsconfig.library.json",
// exclude node_modules (the default), dist dir, coverage dir
"exclude": ["node_modules/", "dist/", "coverage/"],
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"compilerOptions": {
// output to dist/ dir
"outDir": "dist/",
// output .d.ts declaration files for consumers
"declaration": true,
// output .d.ts.map declaration map files for consumers
"declarationMap": true,
// output .js.map sourcemap files for consumers
"sourceMap": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// resolve JSON files
"resolveJsonModule": true,
// transpile JSX to React.createElement
"jsx": "react",
// ignored during builds, but commonly used when type-checking with `tsc`
"noEmit": true,
}
}

0 comments on commit be0922a

Please sign in to comment.