Skip to content

Add format checker for .ui files #3026

@RasmiaKulan

Description

@RasmiaKulan

Current Behaviour

We currently do not have a format checker for the .ui files. Previously when trying to add format checker for .ui files through prettier it did not work as expected where it did not check for any .ui file changes and ran successfully when changes were made to those files without throwing any errors. This is because prettier does not automatically recognise .ui files as XML, and using --parser xml alone is not sufficient as the XML plugin is not loaded by default.

Things to Investigate

  • Is it possible to add .ui file checker through prettier? If not is there any other formatter than can be used instead?

  • Changes that were made but didnt work as expected (suggestive starting point for investigation):

    • Adding the following to the u18_testing workflow:
     - name: ui
        uses: ./.github/actions/test
        with:
          command: npx prettier --check --plugin=@prettier/plugin-xml --parser=xml "**/*.ui"
          label: ubuntu18
    
    • Adding .ui files to the prettier check in pre-commit-config :
      - repo: https://github.com/pre-commit/mirrors-prettier
         rev: v3.0.0
         hooks:
             - id: prettier
               files: \.(json|ya?ml|ui)$
               exclude: ^conda/
               additional_dependencies:
                -   '@prettier/plugin-xml@0.12.0'
    

Desired Behaviour

Format checking against .ui files through pre-commit run -v --all-files and u18_testing workflow is successful.

Potential Pitfalls or Risks to Avoid

Importance of Feature

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions