From f6e1b61b7135a171b48b0edcd6cee73055e13620 Mon Sep 17 00:00:00 2001 From: redtang01 <tanguybonnet01@gmail.com> Date: Mon, 1 Feb 2021 14:49:36 +0100 Subject: [PATCH] A --- .prettierrc | 7 +++++++ .vscode/settings.json | 6 ++++++ package-lock.json | 6 ++++++ package.json | 7 +++++-- src/main.js | 14 +++++++++----- 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .prettierrc create mode 100644 .vscode/settings.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..24c0f50 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "endOfLine": "lf", + "useTabs": true, + "arrowParens": "avoid" +} 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/package-lock.json b/package-lock.json index b550b67..64290a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2433,6 +2433,12 @@ "dev": true, "optional": true }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", diff --git a/package.json b/package.json index 0056488..4c3d75d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "build": "babel src -d build", + "watch": "babel src -d build --verbose --watch --source-maps" }, "author": "Thomas Fritsch <thomas.fritsch@univ-lille.fr> (https://gitlab.univ-lille.fr/thomas.fritsch)", "homepage": "https://gitlab.univ-lille.fr/js", @@ -12,6 +14,7 @@ "devDependencies": { "@babel/cli": "^7.12.10", "@babel/core": "^7.12.10", - "@babel/preset-env": "^7.12.11" + "@babel/preset-env": "^7.12.11", + "prettier": "^2.2.1" } } diff --git a/src/main.js b/src/main.js index 9bc6f7a..06eb0ea 100644 --- a/src/main.js +++ b/src/main.js @@ -60,24 +60,27 @@ const data = [ base: 'tomate', price_small: 6.5, price_large: 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', }, { name: 'Napolitaine', base: 'tomate', price_small: 6.5, price_large: 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', }, { name: 'Spicy', base: 'crème', price_small: 5.5, price_large: 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', + }, ]; - +/* function render(pizzas) { const html = pizzas.reduce( (str, {image, name, price_small, price_large}) => str + `<article class="pizzaThumbnail"> @@ -129,3 +132,4 @@ render( data ); // render( data.filter( ({base}) => base == 'tomate' )) // render( data.filter( ({price_small}) => price_small < 6 )) // render( data.filter( ({name}) => name.match(/i/g).length === 2 )); +*/ -- GitLab