From e0902df7e4ae909491bd6011764d18ded5096a54 Mon Sep 17 00:00:00 2001
From: Thomas Fritsch <tf@kumquats.fr>
Date: Mon, 10 Feb 2020 00:05:14 +0100
Subject: [PATCH] A.2. Extensions de VSCodium

---
 .prettierrc           |  6 ++++++
 .vscode/settings.json |  6 ++++++
 js/main.js            | 23 ++++++++++++-----------
 package-lock.json     |  6 ++++++
 package.json          |  3 ++-
 5 files changed, 32 insertions(+), 12 deletions(-)
 create mode 100644 .prettierrc
 create mode 100644 .vscode/settings.json

diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..807982c
--- /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 0000000..cfa3c4b
--- /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 e611a30..02d6c4f 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 a9499ca..9982707 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 334a953..bda2b97 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"
   }
 }
-- 
GitLab