Add and apply eslint rule arrow-spacing
authorFrank Bessou <frank.bessou@logilab.fr>
Wed, 14 Jun 2017 14:02:16 +0200
changeset 233 1c01a26ea4b8
parent 232 f8c873a819d4
child 234 b25424970acf
Add and apply eslint rule arrow-spacing There must be spaces around arrows in arrow functions Valid: (a) => {} Error: (a)=>{}
.eslintrc.yml
src/services/hypermedia.js
test/index.js
--- a/.eslintrc.yml	Wed Jun 14 13:53:14 2017 +0200
+++ b/.eslintrc.yml	Wed Jun 14 14:02:16 2017 +0200
@@ -19,6 +19,7 @@
   es6: true
   node: true
 rules:
+  arrow-spacing: ["error"]
   comma-dangle: ["error", "always-multiline"]
   comma-spacing: ["error"]
   eqeqeq: [1]
--- a/src/services/hypermedia.js	Wed Jun 14 13:53:14 2017 +0200
+++ b/src/services/hypermedia.js	Wed Jun 14 14:02:16 2017 +0200
@@ -30,7 +30,7 @@
             resource.links = this.extractLinks(response);
             const schemaRoute = this.extractSchemaRoute(resource.links);
             const schemaPromise = this.getSchema(schemaRoute);
-            const dataPromise = response.json().catch(()=>null);
+            const dataPromise = response.json().catch(() => null);
 
             return Promise.all([dataPromise, schemaPromise]).then(
                     ([data, schema]) => {
--- a/test/index.js	Wed Jun 14 13:53:14 2017 +0200
+++ b/test/index.js	Wed Jun 14 14:02:16 2017 +0200
@@ -379,7 +379,7 @@
         it('should map items ', () => {
             const wrappedArray = Jsonary.create(['one', 2, 4]);
 
-            const mapped = wrappedArray.mapItems((currentItem, index)=> currentItem.value() + index);
+            const mapped = wrappedArray.mapItems((currentItem, index) => currentItem.value() + index);
 
             expect(mapped).to.deep.equal(['one0', 3, 6]);
         });