diff --git a/.changeset/selfish-ears-flow.md b/.changeset/selfish-ears-flow.md new file mode 100644 index 0000000..0ee6e28 --- /dev/null +++ b/.changeset/selfish-ears-flow.md @@ -0,0 +1,5 @@ +--- +'@mheob/tsconfig': major +--- + +Initial Release diff --git a/.github/workflows/changeset.yml b/.github/workflows/changeset.yml deleted file mode 100644 index 4841652..0000000 --- a/.github/workflows/changeset.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Changeset available - -on: - pull_request: - paths: ["packages/**"] - branches: ["main"] - -jobs: - changeset-available: - name: Changeset available - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - with: - version: 7 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - - name: Install Dependencies - run: pnpm install --frozen-lockfile - - - name: Check for changeset - run: pnpm run changeset status --since main diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..88988b0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "markdownlint.config": { + "MD010": false + }, + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/packages/tsconfig/LICENSE b/packages/tsconfig/LICENSE new file mode 100644 index 0000000..b3239e2 --- /dev/null +++ b/packages/tsconfig/LICENSE @@ -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. \ No newline at end of file diff --git a/packages/tsconfig/README.md b/packages/tsconfig/README.md index 0da79cf..0c92411 100644 --- a/packages/tsconfig/README.md +++ b/packages/tsconfig/README.md @@ -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" +} +``` diff --git a/packages/tsconfig/astro.json b/packages/tsconfig/astro.json new file mode 100644 index 0000000..37594ee --- /dev/null +++ b/packages/tsconfig/astro.json @@ -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 + } +} diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json deleted file mode 100644 index 061d2c5..0000000 --- a/packages/tsconfig/base.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Default", - "compilerOptions": { - "composite": false, - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "inlineSources": false, - "isolatedModules": true, - "moduleResolution": "Node", - "noUnusedLocals": false, - "noUnusedParameters": false, - "preserveWatchOutput": true, - "skipLibCheck": true, - "strict": true - }, - "exclude": ["node_modules"] -} diff --git a/packages/tsconfig/commonjs.json b/packages/tsconfig/commonjs.json new file mode 100644 index 0000000..07a6d6f --- /dev/null +++ b/packages/tsconfig/commonjs.json @@ -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"] +} diff --git a/packages/tsconfig/esm.json b/packages/tsconfig/esm.json new file mode 100644 index 0000000..1fd6663 --- /dev/null +++ b/packages/tsconfig/esm.json @@ -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"] +} diff --git a/packages/tsconfig/nextjs.json b/packages/tsconfig/nextjs.json index 2d51686..644d82d 100644 --- a/packages/tsconfig/nextjs.json +++ b/packages/tsconfig/nextjs.json @@ -1,7 +1,6 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "Next.js", - "extends": "./base.json", "compilerOptions": { "target": "ES2017", "lib": ["DOM", "DOM.Iterable", "ESNext"], @@ -13,6 +12,7 @@ "incremental": true, "esModuleInterop": true, "module": "ESNext", + "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve" diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index e12d011..8f472d4 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -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 ", + "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" + } } diff --git a/packages/tsconfig/react-library.json b/packages/tsconfig/react-library.json deleted file mode 100644 index cc33213..0000000 --- a/packages/tsconfig/react-library.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "React Library", - "extends": "./base.json", - "compilerOptions": { - "jsx": "react-jsx", - "lib": ["ES2017"], - "module": "ESNext", - "target": "ES2017" - } -} diff --git a/packages/tsconfig/react.json b/packages/tsconfig/react.json new file mode 100644 index 0000000..5e1f984 --- /dev/null +++ b/packages/tsconfig/react.json @@ -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" + } +} diff --git a/scripts/prepare.ts b/scripts/prepare.ts index 6982096..d601ec1 100644 --- a/scripts/prepare.ts +++ b/scripts/prepare.ts @@ -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(); diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 0000000..4dde218 --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../packages/tsconfig/commonjs.json" +} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index e542360..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./packages/tsconfig/base.json" -}