LintiNG @ DYTE

Extra steps on code homogeneization

eslint

Code style & linting

eslint

javascript Rules

  • extends
    • eslint recommended
    • import recommended
  • added / customized / enforcement
    • consistent-return
    • eslint-comments/no restricted-disable
    • eslint-comments/no unused-disable
    • eslint-comments/require-description
    • import/no-unresolved
    • no-restricted-globals (global event, setInterval)
    • no-restricted-properties (global event, setInterval)
    • no-shadow

typescript Rules

  • extends
    • @typescript-eslint/recommended
    • @typescript-eslint/recommended-requiring-type-checking
  • import typescript
  • added / customized / enforcement
    • @typescript-eslint/ban-ts-comment
    • @typescript-eslint/no-unsafe-*
    • no-restricted-syntax (private keyword)

style Rules

  • class-methods-use-this
  • import/order
  • import/prefer-default-export
  • indent
  • max-classes-per-file
  • max-len
  • no-console
  • no-multiple-empty-lines
  • no-unused-private-class-members
  • no-unused-vars
  • no-void
  • quote-props
  • quotes

how to use

{
  "extends": ["@dyte-in"]
}
npm install --save-dev @dyte-in/eslint-config

Semantic release

Automatic packaging of new versions

semantic release

  • unified in semantic-release-config package
  • shareable config
    • same configuration as before
    • includes and install all dependencies
  • enforced explicit install of semantic-release CLI
    • cleaner and more reliable than use npx

semantic release Rules

how to use

{
  "extends": ["@dyte-in/semantic-release-config"]
}
npm install --save-dev semantic-release @dyte-in/semantic-release-config
{
  "scripts": {
    "semanic-release": "semantic-release"
  }
}

Releases in Github Actions

Automatic publishing of new packages versions

releases in github actions

  • updated Actions versions
  • removal of custom NPM_TOKEN environment variable
    • NODE_AUTH_TOKEN environment variable on Github Actions
    • npm global config on local usage
    • explicit config on .npmrc file inside Dockerfile
RUN echo //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN >> .npmrc

Bonus

Print secrets in Github Actions

Print secrets in github actions

  • Github Actions detect printing secrets and replace them for ***
  • Modify printed output to bypass the sanitizier
  • Don't do it with production secrets
run: echo ${{secrets.YOUR_SECRET }} | sed 's/./& /g'

Linting @ Dyte

By Jesús Leganés-Combarro