@sentryhealth/eslint-config

yarn add -D eslint prettier husky lint-staged @sentryhealth/eslint-config

Usage no npm install needed!

<script type="module">
  import sentryhealthEslintConfig from 'https://cdn.skypack.dev/@sentryhealth/eslint-config';
</script>

README

Sentry ESLint

Installation

yarn add -D eslint prettier husky lint-staged @sentryhealth/eslint-config

Use

  1. Copy the following files to the root of the new project, this way it will ensure formatting by your editor.

    • .editorconfig
    • .huskyrc
    • .lintstagedrc
    • .prettierrc
  2. Add a lint script in your package.json, this needs to be only run when adding formatting the first time, the following times husky will create a pre-commit hook linting only changed files and enforcing the formatting.

    {
      "lint": "prettier --write '**/*.{yaml,yml,json,md,html,css}' && eslint '**/*.{js,vue,gql}' --fix"
    }
    
  3. Create a file .eslintrc.js and add the following

    module.exports = {
      root: true,
      extends: ['@sentryhealth/eslint-config'],
    };
    

    By default this configuration has disabled both node and browser environments besides the assumptions made below, turn them on/off accordangly with overrides.


Assumptions

This configuration tries to fit the sentryhealth project standard, so there are some assumptions made, you can always override them in case they don't fit right.

  1. client/* Files inside have access to the browser variables and the variable process, to read variable environments.
  2. api/* Files inside have access to node variables.
  3. tests/* Files inside have access to node, browser and mocha variables.
  4. dist/* Files inside are ignored
  5. *.config.js Files that end with .config.js, have access to node variables; even inside the client folder

VSCode

To ensure the best experience while developing, use the following extensions:

  • dbaeumer.vscode-eslint
  • editorconfig.editorconfig
  • esbenp.prettier-vscode
  • jcbuisson.vue
  • prisma.vscode-graphql

They will use the files you copied as configuration.


Publish

This project uses a .npmrc file as authorization, so there's no need to login. In case there are changes you want across all packages, do the changes here in .eslintrc.js, bump the version inside package.json, then:

npm publish --access=public

You will need to update the package across all the consumer projects, using:

yarn add -D @sentryhealth/eslint-config@latest