Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

nameCoding Guidelines

Language

We use TypeScript as much as we can. We only resort to vanilla JavaScript when there are dependencies that do not work well with Typescript enabled.

Naming guidelines see Google TypeScript Style Guide

Vue

We use the Vue.js 3 composition API together with TypeScript. See the Vue.JS docs for details. In a nutshell our components will look like this.

Code Block
languagetypescript
<template>

</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
    props: {
        // Type-Safe properties! 
        myComplexProperty: {
          type: Object as PropType<MyInterface>,
          required: true,
        }
    }, 
    emits: [
        
    ],
    setup(props, { emit }) {

    },
})
</script>

<style scoped>

</style>

We also use the Vue.js style guide that can be found here

ESLint & Prettier

After the patented schnick schnack schnuck procedure, we were able to choose between the style guides from Google Microsoft and Airbnb. It was Airbnb!

WebStorm/PHPStorm

Upload the xml Airbnb Schema on Code Style

...

View file
nameAirbnb_copy.xml

Set EsLint to “Automatic ESLint configuration“

...

Enable Typescript language service

...

Auto Save

...

Links

https://www.jetbrains.com/help/phpstorm/prettier.html

https://prettier.io/

https://github.com/airbnb/javascript

https://eslint.org/