chanzuckerberg / single-cell-data-portal

The data portal supporting the submission, exploration, and management of projects and datasets to cellxgene.
MIT License
60 stars 12 forks source link

feat(pre-commit): add frontend check to pre-commit #4121

Open Bento007 opened 1 year ago

Bento007 commented 1 year ago

Need

Add the same checks frontend/package.json in the pre-commit file. This will allow the checks to run automatically on commit and save developers some time dealing with linting errors. This is quality of life change to clean code before it is committed.

Approach

We want to run these checks: https://github.com/chanzuckerberg/single-cell-data-portal/blob/c7c1f6e61ff2925007410360ec2f2eb8055c40b8/frontend/package.json#L115 and https://github.com/chanzuckerberg/single-cell-data-portal/blob/c7c1f6e61ff2925007410360ec2f2eb8055c40b8/frontend/package.json#L105 as part of a pre-commit Here is current pre-commit files. This is what the change might looks like.

repos:
  - repo: https://github.com/awebdeveloper/pre-commit-stylelint
    rev: ""
    hooks:
      - id: stylelint
        additional_dependencies:
          - stylelint@13.2.1
          - stylelint-config-standard@20.0.0
          - stylelint-config-recommended@3.0.0
          - stylelint-config-standard@20.0.0
          - typescript@4.8.4
          - prettier@2.4.1
          - prettier-plugin-organize-imports@2.3.3
        args: [--fix, "frontend/**/*.{js,ts,tsx,css}"]
  - repo: https://github.com/pre-commit/mirrors-eslint
    rev: ""
    hooks:
      - id: eslint
        args: [ --fix ]
        additional_dependencies:
          - eslint@8.22.0
          - eslint-config-next@12.2.5
          - eslint-config-prettier@8.3.0
          - eslint-plugin-flowtype@8.0.3
          - eslint-plugin-mdx@2.0.2
          - eslint-plugin-playwright@0.11.2
          - eslint-plugin-prettier@4.0.0
          - eslint-plugin-sonarjs@0.15.0
          - babel-eslint@10.1.0
          - "@typescript-eslint/eslint-plugin@5.33.1"
          - "@typescript-eslint/parser@5.33.1"
          - "@blueprintjs/eslint-plugin@2.2.0"
          - "@next/eslint-plugin-next@11.1.2"
          - typescript@4.8.4

Definition of Done

metakuni commented 1 year ago

@tihuan , @seve , @atarashansky : Your opinions?

tihuan commented 1 year ago

Ooh yes this looks perfect! Thanks so much for doing this, Trent 🙏

tihuan commented 1 year ago

Probably pointing out the obvious, but we'll need to remove the linter in npm and make sure it doesn't break VS Code eslint extension integration