@hyrious/configs
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "@hyrious/configs", | ||
"type": "module", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Shared configs across my projects", | ||
@@ -6,0 +6,0 @@ "author": "hyrious <hyrious@outlook.com>", |
@@ -11,59 +11,10 @@ # @hyrious/configs | ||
### tsconfig.json | ||
### [tsconfig.json](./docs/tsconfig.md) | ||
```json | ||
{ "extends": "@hyrious/configs/tsconfig.json" } | ||
``` | ||
- 0.1.2: Make use of [`"module": "Preserve"`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#support-for-require-calls-in---moduleresolution-bundler-and---module-preserve) (TypeScript ≥ 5.4)\ | ||
If your TypeScript Compiler < 5.4, you can lock the version as\ | ||
`"@hyrious/configs": "0.1.1"`. | ||
Default choice for normal projects. | ||
## License | ||
```json | ||
{ "extends": "@hyrious/configs/tsconfig.strictest.json" } | ||
``` | ||
The `strictest` adds these configs aside from `strict`: | ||
- noFallthroughCasesInSwitch: true | ||
- noImplicitOverride: true | ||
- noPropertyAccessFromIndexSignature: true | ||
- noUncheckedIndexedAccess: true | ||
```json | ||
{ "extends": "@hyrious/configs/tsconfig.casual.json" } | ||
``` | ||
Less strict mode, it alters these settings from `strict`: | ||
- noImplicitAny: false\ | ||
It allows you to write `globalThis.debug = 1` without error. | ||
- strictPropertyInitialization: false\ | ||
It stops reporting error on uninitialized properties in constructor, | ||
which allows you to write an `initialize()` pattern of code. | ||
```ts | ||
class Rectangle { | ||
x: number; y: number; width: number; height: number | ||
constructor() { this.initialize.apply(this, arguments) } | ||
initialize(x = 0, y = 0, width = 0, height = 0) { /* ... */ } | ||
} | ||
``` | ||
Why this pattern? Because you can reuse other classes' constructors without hack. | ||
```ts | ||
// This is a valid and common usage of JavaScript. | ||
Rectangle.prototype.initialize.call(somethingNotRectangle, ...args) | ||
``` | ||
- useUnknownInCatchVariables: false\ | ||
Make the `err` object in catch clause as type of `any`. | ||
Some people prefer `unknown` because it prevents stupid authors throwing `null` or `undefined` which | ||
causes `err.message` become a `TypeError: Cannot read properties of undefined`. | ||
But this is an insane idea and common codes just throw `new Error('message')`. | ||
- noImplicitOverride: true\ | ||
Must write an `override` annotation before these methods. I just like this mark. | ||
- useDefineForClassFields: false\ | ||
`class { foo = 1 }` becomes `class { constructor() { this.foo = 1 } }`. | ||
MIT @ [hyrious](https://github.com/hyrious) |
@@ -5,8 +5,6 @@ { | ||
"target": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true, | ||
"module": "Preserve", | ||
"types": [], | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"resolveJsonModule": true, | ||
"verbatimModuleSyntax": true, | ||
@@ -13,0 +11,0 @@ "noImplicitAny": false, |
@@ -5,10 +5,8 @@ { | ||
"target": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true, | ||
"module": "Preserve", | ||
"types": [], | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"resolveJsonModule": true, | ||
"verbatimModuleSyntax": true | ||
} | ||
} |
@@ -5,8 +5,6 @@ { | ||
"target": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true, | ||
"module": "Preserve", | ||
"types": [], | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"resolveJsonModule": true, | ||
"verbatimModuleSyntax": true, | ||
@@ -13,0 +11,0 @@ "noFallthroughCasesInSwitch": true, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2932
43
20