Skip to content

Commit

Permalink
feat(tsconfig)!: create initial release (#43)
Browse files Browse the repository at this point in the history
Resolves #35 

Creates more configs and makes them shareable.
  • Loading branch information
mheob authored Sep 16, 2022
1 parent cf8ba94 commit c4e3768
Show file tree
Hide file tree
Showing 16 changed files with 254 additions and 75 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-ears-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mheob/tsconfig': major
---

Initial Release
31 changes: 0 additions & 31 deletions .github/workflows/changeset.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"markdownlint.config": {
"MD010": false
},
"typescript.tsdk": "node_modules/typescript/lib"
}
21 changes: 21 additions & 0 deletions packages/tsconfig/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License Copyright (c) 2022 Alexander Böhm

Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
89 changes: 87 additions & 2 deletions packages/tsconfig/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@
# `tsconfig`
# My personal TypeScript configurations

These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from.
To make my configurations a bit easier I share my `tsconfig.json`s.

## Install

### With NPM

```sh
npm install -D @mheob/tsconfig
```

### With YARN

```sh
yarn add -D @mheob/tsconfig
```

### With PNPM

```sh
pnpm add -D @mheob/tsconfig
```

## Usage

`tsconfig.json`

### Default (same as `commonjs.json`)

```json
{
"extends": "@mheob/tsconfig"
}
```

or

```json
{
"extends": "@mheob/tsconfig/commonjs.json"
}
```

You can of course extend or overwrite all settings.

```json
{
"extends": "@mheob/tsconfig",
"compilerOptions": {
"outDir": "dist"
}
}
```

### Specified configurations

#### Astro

```json
{
"extends": "@mheob/tsconfig/astro.json"
}
```

#### ESM

```json
{
"extends": "@mheob/tsconfig/esm.json"
}
```

#### Next.js

```json
{
"extends": "@mheob/tsconfig/nextjs.json"
}
```

#### React

```json
{
"extends": "@mheob/tsconfig/react.json"
}
```
24 changes: 24 additions & 0 deletions packages/tsconfig/astro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false
}
}
20 changes: 0 additions & 20 deletions packages/tsconfig/base.json

This file was deleted.

27 changes: 27 additions & 0 deletions packages/tsconfig/commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Base/CommonJS",
"compilerOptions": {
"lib": ["ES2022"],
"module": "CommonJS",
"target": "ES2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"importsNotUsedAsValues": "error",
"checkJs": true
},
"exclude": ["node_modules"]
}
27 changes: 27 additions & 0 deletions packages/tsconfig/esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Base/ESM",
"compilerOptions": {
"lib": ["ES2022"],
"module": "ES2022",
"target": "ES2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"importsNotUsedAsValues": "error",
"checkJs": true
},
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/tsconfig/nextjs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"target": "ES2017",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
Expand All @@ -13,6 +12,7 @@
"incremental": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
Expand Down
37 changes: 31 additions & 6 deletions packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
{
"name": "tsconfig",
"name": "@mheob/tsconfig",
"version": "0.0.0",
"private": true,
"main": "index.js",
"description": "My personal configurations for typescript.",
"keywords": [
"tsconfig",
"typescript",
"ts",
"config",
"configuration"
],
"homepage": "https://github.com/mheob/config/tree/main/packages/tsconfig",
"bugs": "https://github.com/mheob/config/issues",
"repository": {
"type": "git",
"url": "https://github.com/mheob/config.git"
},
"license": "MIT",
"author": "Alexander Böhm <tools@boehm.work>",
"main": "commonjs.json",
"files": [
"base.json",
"astro.json",
"commonjs.json",
"esm.json",
"nextjs.json",
"react-library.json"
]
"react.json",
"LICENSE",
"README.md"
],
"scripts": {
"sort-package-json": "pnpm dlx sort-package-json"
},
"publishConfig": {
"access": "public"
}
}
11 changes: 0 additions & 11 deletions packages/tsconfig/react-library.json

This file was deleted.

21 changes: 21 additions & 0 deletions packages/tsconfig/react.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React",
"compilerOptions": {
"target": "ES2017",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
}
}
2 changes: 1 addition & 1 deletion scripts/prepare.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { install as installHusky } from 'husky';

const isCI = process.env.CI !== undefined;
const isCI = process.env['CI'] !== undefined;

if (!isCI) {
installHusky();
Expand Down
3 changes: 3 additions & 0 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../packages/tsconfig/commonjs.json"
}
3 changes: 0 additions & 3 deletions tsconfig.json

This file was deleted.

0 comments on commit c4e3768

Please sign in to comment.