Pages

Sunday, May 2, 2021

Preferred Prettier configuration for JavaScript/ECMAScript

For JavaScript based apps, 
  • The code must be formatted with the Prettier engine with the following configuration
    • prettierrc file (YAML)
      • arrowParens: avoid
      • bracketSpacing: true
      • insertPragma: false
      • jsxBracketSameLine: false
      • printWidth: 120
      • proseWrap: preserve
      • requirePragma: 'false'
      • semi: false
      • singleQuote: true
      • tabWidth: 2
      • trailingComma: none
      • useTabs: false
  • The code must be linted with the standardjs linter: https://standardjs.com/
    • Recommend using prettier-eslint plus the appropriate plugins to get both standard and eslint processing done at the same time. Here is the configuration we use for prettier-eslint: .eslintrc.yml.
    • This will give you both prettier and standard configuration that adheres to the above.
  • Prefer simple functional style over class heavy designs

No comments:

Post a Comment