Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
| const trafficLightMachine = Machine({ | |
| id: "trafficLight", | |
| initial: "green", | |
| states: { | |
| green: { | |
| on: { TO_YELLOW: "yellow" } | |
| }, | |
| yellow: { | |
| on: { TO_RED: "red" } | |
| }, |
| // useCounter.js | |
| import { ref, computed } from 'vue' | |
| const useCounter = () => { | |
| const count = ref(0) | |
| const double = computed(() => count.value * 2) | |
| const increment = () => count.value++ | |
| return { | |
| count, | |
| double, |
| upload(files) { | |
| const config = { | |
| onUploadProgress: function(progressEvent) { | |
| var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) | |
| console.log(percentCompleted) | |
| } | |
| } | |
| let data = new FormData() | |
| data.append('file', files[0]) |
| # Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/ | |
| # GitLab uses docker in the background, so we need to specify the | |
| # image versions. This is useful because we're freely to use | |
| # multiple node versions to work with it. They come from the docker | |
| # repo. | |
| # Uses NodeJS V 9.4.0 | |
| image: node:9.4.0 | |
| # And to cache them as well. |
| name: demo github actions | |
| on: push | |
| jobs: | |
| build-and-publish: | |
| name: build & publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@master | |
| - name: npm install | |
| uses: actions/npm@master |
| https://www.typescriptlang.org/docs/handbook/generics.html | |
| https://stackoverflow.com/questions/15877362/declare-and-initialize-a-dictionary-in-typescript | |
| https://stackoverflow.com/questions/42211175/typescript-hashmap-dictionary-interface/42211573 |
| interface IPerson<T> { | |
| name: T; | |
| age: T; | |
| [Key: string]: T; | |
| } | |
| const Arum: IPerson<string | number> = { | |
| name: "Arum", | |
| age: 21, | |
| status: "I Don't Know" |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Anime</title> | |
| </head> | |
| <body> | |
| <div id="anime"> | |
| <p class="name"> dsds </p> |
| import { shallowMount } from '@vue/test-utils' | |
| import TestComponent from '@/components/TestComponent.vue' | |
| describe('TestComponent.vue', () => { | |
| it('Merender judul text', () => { | |
| const wrapper = shallowMount(TestComponent, { | |
| data() { | |
| return { | |
| title: 'Input Data' | |
| } |