@knicola/dev-config

0.3.2 • Public • Published

@knicola/dev-config

Base configurations for typescript, eslint, typedoc and jest.

Install

npm i -D @knicola/dev-config typescript eslint

Setup

.eslintrc.js

require('@knicola/dev-config/eslint/patch')

module.exports = {
    extends: ['./node_modules/@knicola/dev-config/eslint/node'],
    parserOptions: { tsconfigRootDir: __dirname },
    settings: {
        'import/resolver': {
            typescript: { project: __dirname },
        },
    }
}

tsconfig.json

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "@knicola/dev-config/tsconfig/node",
  "compilerOptions": {
    "types": [ "node", "jest" ],
    "paths": {
      "@/*": ["./src/*"]
    },
    "baseUrl": "."
  },
  "include": [ "**/*.ts", "**/*.js" ]
}

tsconfig.build.json

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "@knicola/dev-config/tsconfig/node",
  "compilerOptions": {
    "removeComments": true,
    "noUnusedLocals": true,
    "outDir": "lib/",
    "paths": {
      "@/*": ["./src/*"]
    },
    "baseUrl": "."
  },
  "include": [ "src/**/*.ts" ]
}

jest.config.ts

import { JestConfigWithTsJest } from 'ts-jest'
import jestBaseConfig from '@knicola/dev-config/jest/base'

const config: JestConfigWithTsJest = {
  ...jestBaseConfig,
  // additional config
}

export default config

typedoc.json

{
  "$schema": "https://typedoc.org/schema.json",
  "extends": ["./node_modules/@knicola/dev-config/typedoc/base.json"],
}

package.json

{
  // ...
  "scripts": {
    "lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
    "build": "tsc -p ./tsconfig.build.json",
  }
}

/@knicola/dev-config/

    Package Sidebar

    Install

    npm i @knicola/dev-config

    Weekly Downloads

    20

    Version

    0.3.2

    License

    MIT

    Unpacked Size

    6.14 kB

    Total Files

    8

    Last publish

    Collaborators

    • knicola