diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000000000000000000000000000000..807982c804372179f7b24d911e3f54a5ce0bf283 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "endOfLine": "lf", + "useTabs": true +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..cfa3c4b30a33353682927627476e80cbfd403908 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[javascript]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/js/main.js b/js/main.js index e611a3004252ccbf721f2ac46c6f7a2ed21f6654..02d6c4f28ff5303e44c16e8fcecb4bcee715b9d0 100644 --- a/js/main.js +++ b/js/main.js @@ -4,44 +4,45 @@ const data = [ base: 'tomate', prix_petite: 6.5, prix_grande: 9.95, - image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300' + image: + 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300', }, { nom: 'Napolitaine', base: 'tomate', prix_petite: 6.5, prix_grande: 8.95, - image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300' + image: + 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300', }, { nom: 'Spicy', base: 'crème', prix_petite: 5.5, prix_grande: 8, - image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300' - } + image: + 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300', + }, ]; class Component { tag; children; - constructor( tag, children ){ + constructor(tag, children) { this.tag = tag; this.children = children; } render() { return `<${this.tag} ${ - this.children ? - `>${this.children}</${this.tag}>` : - ' />' + this.children ? `>${this.children}</${this.tag}>` : ' />' }`; } } -const title = new Component( 'h1', 'La carte' ); +const title = new Component('h1', 'La carte'); document.querySelector('.pageTitle').innerHTML = title.render(); -const img = new Component( 'img' ); -document.querySelector( '.pizzasContainer' ).innerHTML = img.render(); \ No newline at end of file +const img = new Component('img'); +document.querySelector('.pizzasContainer').innerHTML = img.render(); diff --git a/package-lock.json b/package-lock.json index a9499ca5ed81e6d3b8e705c0fb2431f73f6045b9..99827076aaecec0464b8d86e9d86335639d4511f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2796,6 +2796,12 @@ "dev": true, "optional": true }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", diff --git a/package.json b/package.json index 334a953aa896f3f69e3430f65a60aa67b09ec933..bda2b97df87d065c0e5dc4d4f61240e793b0891f 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@babel/cli": "^7.8.4", "@babel/core": "^7.8.4", "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/preset-env": "^7.8.4" + "@babel/preset-env": "^7.8.4", + "prettier": "^1.19.1" } }