npm package: @schoero/configs
Description: This repository contains shared configuration files used to configure my personal development environment and projects.
Author: Roger Schönbächler
Latest version: 1.5.31

# Shared configuration files

This repository contains shared configuration files used to configure my personal development environment and projects.

- eslint
- cspell
- markdownlint
- vite
- tsconfig
- unwritten
- changelogen

## Installation

```sh
npm i --save-dev @schoero/configs
```

### VSCode

```jsonc
// .vscode/settings.json
{

  // eslint
  "[javascript][javascriptreact][json][json5][jsonc][typescript][typescriptreact]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "yaml"],

  // markdown
  "[markdown]": {
    "editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
    "editor.rulers": [
      40,
      80,
      119
    ],
    "editor.wordWrapColumn": 119
  },

  // prettier
  "prettier.enable": false,

  // vscode
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.fixAll.markdownlint": "explicit",
    "source.organizeImports": "never"
  },
  "editor.formatOnSave": false,
  "editor.rulers": [
    119
  ],
  "search.exclude": {
    "lib": true
  },

  // file nesting
  "explorer.fileNesting.enabled": true,
  "explorer.fileNesting.expand": false,
  "explorer.fileNesting.patterns": {
    "*.js": "$(capture).test.js,$(capture).cjs,$(capture).mjs,$(capture).d.ts,$(capture).d.ts.map,$(capture).js.map",
    "*.ts": "$(capture).test.ts,$(capture).test.snap,$(capture).test-d.ts"
  },

  "typescript.preferences.autoImportFileExcludePatterns": [
    "@types/node/test.d.ts"
  ],

  // es module import
  "typescript.preferences.importModuleSpecifier": "non-relative",
  "typescript.preferences.importModuleSpecifierEnding": "minimal",
  "typescript.preferences.useAliasesForRenames": true,

  // typescript
  "typescript.tsdk": "node_modules/typescript/lib"
}
```

```jsonc
// .vscode/extensions.json
{
  "recommendations": [
    "dbaeumer.vscode-eslint",
    "DavidAnson.vscode-markdownlint",
    "streetsidesoftware.code-spell-checker"
  ]
}
```

```jsonc
// .vscode/launch.json
{
  "configurations": [
    {
      "args": [
        "run",
        "${relativeFileDirname}/${fileBasenameNoExtension}"
      ],
      "autoAttachChildProcesses": true,
      "console": "integratedTerminal",
      "name": "debug current test file",
      "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
      "request": "launch",
      "skipFiles": ["<node_internals>/**", "**/node_modules/**"],
      "smartStep": true,
      "type": "node"
    },
    {
      "args": [
        "run",
        "${relativeFileDirname}/${fileBasenameNoExtension}"
      ],
      "autoAttachChildProcesses": true,
      "console": "integratedTerminal",
      "name": "debug current test file with node internals",
      "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
      "request": "launch",
      "skipFiles": [],
      "smartStep": true,
      "type": "node"
    }
  ],
  "version": "0.2.0"
}
```

### Scripts

```jsonc
// package.json
{
  "scripts": {
    // vite
    "build": "vite build",
    "prebuild": "npm run typecheck && npm run lint && npm run spellcheck",
    "typecheck": "tsc --noEmit",

    // eslint
    "eslint": "eslint --ext .ts,.tsx,.js,.jsx,.json,.jsonc,.yml,.md .",
    "eslint:ci": "npm run eslint -- --max-warnings 0",
    "eslint:fix": "npm run eslint -- --fix",
    "lint": "npm run eslint && npm run markdownlint",
    "lint:ci": "npm run eslint:ci && npm run markdownlint:ci",
    "lint:fix": "npm run eslint:fix && npm run markdownlint:fix",

    // markdownlint
    "markdownlint": "markdownlint-cli2 '**/*.md' '#node_modules'",
    "markdownlint:ci": "npm run markdownlint",
    "markdownlint:fix": "npm run markdownlint -- --fix",

    // changelogen
    "postrelease:alpha": "npm run postrelease",
    "postrelease:beta": "npm run postrelease",
    "postrelease:latest": "eslint --fix package.json &&  markdownlint-cli2-fix 'CHANGELOG.md'",
    "prerelease:alpha": "npm run test -- --run && npm run build",
    "prerelease:beta": "npm run test -- --run && npm run build",
    "prerelease:latest": "npm run test -- --run && npm run build",
    "publish:alpha": "npm run publish:latest -- --publishTag alpha",
    "publish:beta": "npm run publish:latest -- --publishTag beta",
    "publish:latest": "changelogen gh release && changelogen --publish",
    "release:alpha": "npm run release -- --prerelease alpha",
    "release:beta": "npm run release -- --prerelease beta",
    "release:latest": "changelogen --bump --output --no-tag",

    // cspell
    "spellcheck": "cspell .",
    "spellcheck:ci": "npm run spellcheck -- --no-progress",
    "test": "vitest -c ./vite.config.ts"
  }
}
```