Skip to content

Spike Code formatting for typescript code #4023

Closed

Description

Prescribed Solution:

  • Format all of the extension code
  • Format on commit
  • Format on save (user settings, opt in using)
  • Recommend prettier extension in .vscode/extensions.json
  • Prettier Config settings
    • Prettier rc config (editor agnostic, also picked by CI)
    • .vscode/settings
  • CI check for all pipelines
    • PR pipeline
    • CI Pipeline
  • Update contributing guide
  • Configure prettier to use tslint (ensure this works on CI)
    • TIP - Look for prettier plugins (plenty good ones)

Activity

  1. changed the title [-]Code formatting for typescript code[/-] [+]Spike Code formatting for typescript code[/+] on Jan 16, 2019
  2. kimadeline commented on Jul 9, 2019

    @kimadeline

    How to integrate

    • npm i prettier --save-dev
    • vscode prettier extension: esbenp.prettier-vscode
    • extra rules:
      • .prettierrc: "singleQuote": true
      • workspace settings:
        • "prettier.tslintIntegration": true
        • "editor.formatOnSave": true
    • update the readme 📜

    npm scripts

    • formatting: "prettier:format": "prettier --write '{src,uitests}/**/*.{ts,tsx,js,css}'"
    • dry run: "prettier:check": "prettier --check '{src,uitests}/**/*.{ts,tsx,js,css}'"
    • either include folders in the run command, or specify files/folders to ignore in a .prettierignore file

    Committing

    📚 Precommit hooks documentation: https://prettier.io/docs/en/precommit.html

    CI checks

    See #6501 for an example of a formatting check job

    Code formatting

    • Doing a full pass at once
      • ✅ covers everything at once
      • ✅ CI command is simpler (can just do a sweep of the repo)
      • ❌ there will be one "formatting" commit in the commit history
      • ❌ may cause merge conflicts with people's current work (hopefully only once)
    • Checking only changed files
      • ✅ no commit history pollution and no merge conflicts when integrating it in people's daily workflow
      • ❌ requires an extra tool for CI to only verify changed files (use one of the pre-commit hook solutions)
      • ❌ noise in PRs
  3. kimadeline commented on Jul 9, 2019

    @kimadeline

    Work to be done listed here: #2012

  4. ghost removed on Jul 9, 2019
  5. locked as resolved and limited conversation to collaborators on Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtCode quality issues

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions