Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-14430

Add prettier config for UI development workflow in editor

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.0
    • Component/s: UI
    • Labels:
    • Rank:
      1|i00i87:

      Description

      Problem

      We still have comments in our pull requests for code formatting. We should avoid formatting code by hand and use tools that automatically formats code for us. 

      Solution

      Add prettier config file to be used by the code editor to auto format code for us based on chosen rules.

      Note:

      Since the entire UI team is using vscode we decided to use the config in editor while writing code to auto-format on save. We are not adding it as part of the git workflow or a separate npm script to run before committing code yet. If required, for developers not using vscode, we will add a yarn run script to format code.

      It is now part of eslint process. Mainly for two reasons

      1. If it's not part of build process developer would have to first save the file for linting changes before making actual code changes for bug/features
      2. Since prettier is integrated with eslint not fixing as part of build process will fail existing build

      Because of this the PR is huge and it is a one time thing . Subsequent pull request for UI should automatically format code and will be substantially small on linting 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ajai Ajai Narayan
                Reporter:
                ajai Ajai Narayan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: