Skip to content

Commit

Permalink
deps: use @agilgur5/tsconfig to simplify tsconfig (agilgur5#87)
Browse files Browse the repository at this point in the history
- this is my own tsconfig base built on top of @tsconfig/strictest
  - 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, hence the longer path into the package

- Relative paths in tsconfig bases are also relative _within_ node_modules, 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
  • Loading branch information
agilgur5 committed Jun 13, 2022
1 parent 5771d33 commit cc6cce9
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 @@ -78,6 +78,7 @@
},
"devDependencies": {
"@agilgur5/changelog-maker": "^3.0.0",
"@agilgur5/tsconfig": "^0.0.1",
"@babel/core": "^7.17.9",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
Expand All @@ -88,7 +89,6 @@
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@tsconfig/strictest": "^1.0.1",
"@types/enzyme": "^3.10.4",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"canvas": "^2.9.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, and example for now
"exclude": ["node_modules/", "dist/", "coverage/", "example/"],
// 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 cc6cce9

Please sign in to comment.