- Always use latest npm via
npm install -g npm@latest - Make distinction between dependencies and devDependencies
- Use reproducible builds via
npm ci(requires lockfiles on all projects) - Exclude devDependencies from production builds using
npm ci --production - Regularly review
npm auditreports and make production issues a release blocker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const thing = (obj && obj.thing && obj.thing.stuff) || ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]; | |
| const fibonacci = [0, 1, 1, 2, 3, 5, 8, 13]; | |
| const duplicates = numbers.filter(number => fibonacci.indexOf(number) !== -1); | |
| console.log(duplicates); // [1, 2, 3, 5, 8] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "node", | |
| "request": "attach", | |
| "name": "Attach to Docker", | |
| "port": 5100, | |
| "address": "localhost", | |
| "restart": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const obj = { | |
| prop: 'val' | |
| }; | |
| const clone = JSON.parse(JSON.stringify(obj)); |
// Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { mount, createLocalVue } from "vue-test-utils"; | |
| import { actions, mutations } from "~/test/mocks/store-actions-mutations.mock"; | |
| import Component from "~/pages/index.vue"; | |
| import Vuex from "vuex"; | |
| const localVue = createLocalVue(); | |
| localVue.use(Vuex); | |
| const store = new Vuex.Store({ state, mutations, actions }); | |
| const cmp = mount(Component, { | |
| store, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { background-color: rgba(255,0,0,.2); } | |
| * * { background-color: rgba(0,255,0,.2); } | |
| * * * { background-color: rgba(0,0,255,.2); } | |
| * * * * { background-color: rgba(255,0,255,.2); } | |
| * * * * * { background-color: rgba(0,255,255,.2); } | |
| * * * * * * { background-color: rgba(255,255,0,.2); } | |
| * * * * * * * { background-color: rgba(255,0,0,.2); } | |
| * * * * * * * * { background-color: rgba(0,255,0,.2); } | |
| * * * * * * * * * { background-color: rgba(0,0,255,.2); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| root: true, | |
| env: { | |
| node: true | |
| }, | |
| extends: [ | |
| "plugin:vue/recommended", | |
| "eslint:recommended", | |
| "prettier/vue", | |
| "plugin:prettier/recommended" |