0.0.2 • Published 2 years ago

@tesseract-crypto/code-style v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Code Style

Our TypeScript Style that is based on the google/gts project.

Usage

First, you need to install the package through Yarn:

$ yarn add -D @tesseract-crypto/code-style

Next add the following lint scripts:

"lint": "concurrently yarn:lint:*",
"lint:eslint": "eslint src",
"lint:prettier": "prettier --check src",
"lint:tsc": "tsc --noEmit",

Feel free to also add fix scripts:

"fix": "concurrently yarn:fix:*",
"fix:eslint": "eslint src --fix",
"fix:prettier": "prettier --write src",

Finally you need to create local configurations that extend the base configurations:

.eslintrc.json

{
  "extends": "./node_modules/@tesseract-crypto/code-style/.eslintrc.json"
}

.prettierrc.js

module.exports = {
  ...require('@tesseract-crypto/code-style/.prettierrc.json')
}

tsconfig.json

{
  "extends": "./node_modules/@tesseract-crypto/code-style/tsconfig.json"
}

Continous integration

You should also set up a GitHub Action to lint your code:

name: My project
on: push
jobs:
  lint:
    name: "Lint"
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Setup Node.js
      uses: actions/setup-node@v2
      with:
        node-version: 16
    - name: Install dependencies
      run: yarn install
    - name: Lint code
      run: yarn lint

Publishing

You can publish a new version of the library using Yarn:

$ yarn publish --access public