@checkdigit/typescript-config 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: node_js
2
+ node_js:
3
+ - "16"
4
+ arch: arm64
5
+ notifications:
6
+ slack: checkdigit:KPANFpO8mCjIwBUXdElcj7Mr
7
+ after_success: npm run coveralls
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2021 Check Digit, LLC
3
+ Copyright (c) 2021-2022 Check Digit, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,22 +3,38 @@
3
3
  [![MIT License](https://img.shields.io/github/license/checkdigit/typescript-config)](https://github.com/checkdigit/typescript-config/blob/master/LICENSE.txt)
4
4
  [![David](https://status.david-dm.org/gh/checkdigit/typescript-config.svg)](https://status.david-dm.org/gh/checkdigit/typescript-config.svg)
5
5
 
6
- Copyright (c) 2021 [Check Digit, LLC](https://checkdigit.com)
6
+ Copyright (c) 2022 [Check Digit, LLC](https://checkdigit.com)
7
7
 
8
8
  ### Introduction
9
9
 
10
10
  This module contains the standard Check Digit Typescript configuration.
11
- - requires Node 14 or above
12
- - emits ES2020
11
+ - requires Node 16 or above
12
+ - emits ES2022
13
+ - uses the new tsconfig `module` type of `node16`. This specifies that whether commonjs or ESM is emitted is dependent
14
+ on the value of the `type` field in `package.json`. If not supplied, the default value is `commonjs`.
15
+ Set `"type": "module"` to emit ESM.
13
16
  - all compiler options set for maximum strictness
14
17
 
18
+ #### A note about versioning
19
+
20
+ Strict semver is a little complicated, as Typescript itself does not adhere to semver. So our "best effort" policy is:
21
+
22
+ - Each new target (e.g. `ES2019` to `ES2020`) will result in a new major version of this module. We coordinate this
23
+ with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions
24
+ and Azure Functions.
25
+ - Each new major version of Typescript (e.g. `4.2.x` to `4.3.x`) will result in a new minor version of this module.
26
+ - Each new minor update of Typescript (e.g. `4.3.1` to `4.3.2`) will result in a new patch version of this module.
27
+
28
+ Bear in mind, any update of Typescript can potentially break your build. But hopefully in a way that's useful.
29
+
15
30
  ### Installation
16
31
 
17
32
  ```
18
- npm add -D typescript
19
33
  npm add -D @checkdigit/typescript-config
20
34
  ```
21
35
 
36
+ Note: you do not need to explicitly install Typescript itself, as it comes in as a peer dependency of `@checkdigit/typescript-config`.
37
+
22
38
  Make sure your project's `tsconfig.json` extends `@checkdigit/typescript-config`.
23
39
 
24
40
  ### Example `tsconfig.json`
package/package.json CHANGED
@@ -1,19 +1,13 @@
1
1
  {
2
2
  "name": "@checkdigit/typescript-config",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Check Digit standard Typescript configuration",
5
- "scripts": {
6
- "prepublishOnly": "publish",
7
- "postpublish": "rimraf dist .npmignore",
8
- "preversion": "npm test",
9
- "postversion": "git push && git push --tags",
10
- "test": "rimraf build && tsc && test -f build/index.js && test -f build/index.d.ts && test -f build/index.js.map"
11
- },
5
+ "prettier": "@checkdigit/prettier-config",
12
6
  "engines": {
13
- "node": ">=14"
7
+ "node": ">=16"
14
8
  },
15
9
  "peerDependencies": {
16
- "typescript": ">=4.2.4"
10
+ "typescript": ">=4.7.2"
17
11
  },
18
12
  "repository": {
19
13
  "type": "git",
@@ -25,9 +19,16 @@
25
19
  "url": "https://github.com/checkdigit/typescript-config/issues"
26
20
  },
27
21
  "homepage": "https://github.com/checkdigit/typescript-config#readme",
22
+ "scripts": {
23
+ "preversion": "npm test",
24
+ "postversion": "git push && git push --tags",
25
+ "prettier": "prettier --list-different 'src/**/*.ts'",
26
+ "prettier:fix": "prettier --write 'src/**/*.ts'",
27
+ "test": "tsc && node build/index.js | grep -q 'complete' && rimraf build && npm run prettier"
28
+ },
28
29
  "devDependencies": {
29
- "@checkdigit/publish": "^1.0.19",
30
- "rimraf": "^3.0.2",
31
- "typescript": "4.2.4"
30
+ "@checkdigit/prettier-config": "2.0.1",
31
+ "@types/node": "^17.0.35",
32
+ "rimraf": "^3.0.2"
32
33
  }
33
34
  }
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es2020",
3
+ "module": "node16",
4
+ "target": "es2022",
5
5
  "lib": ["esnext", "dom", "webworker"],
6
6
  "sourceMap": true,
7
7
  "outDir": "build",
@@ -27,6 +27,9 @@
27
27
  "noUncheckedIndexedAccess": true,
28
28
  "noPropertyAccessFromIndexSignature": true,
29
29
  "allowUnusedLabels": false,
30
+ "noImplicitOverride": true,
31
+ "useUnknownInCatchVariables": true,
32
+ "exactOptionalPropertyTypes": true
30
33
  },
31
34
  "exclude": [
32
35
  "node_modules",