Skip to content

beda-software/prettier-plugin-fhirpath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prettier-plugin-fhirpath

Prettier plugin for FHIRPath language using ANTLR4 grammar

Installation

yarn add --dev prettier-plugin-fhirpath

Configuration

In .prettierrc.js

    ...
    plugins: ["prettier-plugin-fhirpath"]
    ...

Formatting rules

There are no general rules are described for the moment anywhere, so based on the experience of writing quite long and complex expressions there are some rules of formatting introduced for better readability:

  • Parentheses content should be split by new lines if the content length is more than N characters or more than one argument is used in the function

Should not be formatted with new lines:

repeats(item)

(1 + 1)

where(code = 'value')

Should be formatted with new lines:

iif(
    %var > 1,
    1,
    2
)

where(
    code = %var.very.long.path.to.the.value
)
  • Binary operator should be split by new lines if the total length is more than N characters

Should not be formatted with new lines:

code in 'a' | 'b' | 'c'

Should be formatted with new lines:

code in 'very-long-code-first' | 
    'very-long-code-second' | 
    'very-long-code-third'
  • Spaces around operators and keywords always should be used
where(code = 'value1' or code = 'value2')

1 + 1 / 1

Supported extensions

  • .fhirpath
  • .yaml (embedded inside expression)

Future plans

  • .jsx?/.tsx? (embedded inside fhirpath template)
  • FHIRPath Mapping Language embedded support inside {{ }} and etc
  • FSH embedded support inside [[ ]]

Release Notes

0.0.1 (in development)

  • Initial release

About

Prettier plugin for FHIRPath language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published