Add and apply eslint rule to always use semicolons
authorFrank Bessou <frank.bessou@logilab.fr>
Wed, 03 May 2017 17:11:02 +0200
changeset 170 94800ba78d15
parent 169 714955dfe4c4
child 171 12203e38d2b9
Add and apply eslint rule to always use semicolons
.eslintrc.yml
src/components/App.js
src/components/Attribute.js
src/components/BaseViews.js
src/components/Entities.js
src/components/Entity.js
src/components/Form.js
src/components/Root.js
src/index.js
src/jsonaryutils.js
src/services/hypermedia.js
src/utils.js
test/index.js
webpack/paths.js
webpack/test.config.js
--- a/.eslintrc.yml	Tue May 02 17:51:43 2017 +0200
+++ b/.eslintrc.yml	Wed May 03 17:11:02 2017 +0200
@@ -42,6 +42,7 @@
   quotes: [0]
   react/jsx-indent-props: [2, 4]
   react/no-multi-comp: off
+  semi: ["error", "always"]
   space-before-function-paren: ["error", "never"]
 plugins:
   - react
--- a/src/components/App.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/App.js	Wed May 03 17:11:02 2017 +0200
@@ -31,7 +31,7 @@
                 </div>
             </div>
         </nav>
-   )
+   );
 }
 
 export function NotFound() {
--- a/src/components/Attribute.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/Attribute.js	Wed May 03 17:11:02 2017 +0200
@@ -1,10 +1,10 @@
 import React from 'react';
-import {PropTypeJsonaryWrapper} from '../jsonaryutils'
+import {PropTypeJsonaryWrapper} from '../jsonaryutils';
 import intersperse from 'intersperse';
 
 const ATTRIBUTE_VALUE_PROPTYPES = {
     attribute: PropTypeJsonaryWrapper.isRequired,
-}
+};
 
 export function AttributeValue({attribute}) {
     const value = attribute.value();
@@ -18,7 +18,7 @@
     } else {
         attrView = '<unspecified>';
     }
-    return (<span>{attrView}</span>)
+    return (<span>{attrView}</span>);
 }
 AttributeValue.propTypes = ATTRIBUTE_VALUE_PROPTYPES;
 
@@ -26,8 +26,8 @@
     let attributeValue =  attribute.mapItems( (item) => {
         return (<ArrayItemValue attribute={item} key={item.uniqueId} />);
     });
-    attributeValue = intersperse(attributeValue, ', ')
-    return <span>{attributeValue}</span>
+    attributeValue = intersperse(attributeValue, ', ');
+    return <span>{attributeValue}</span>;
 }
 ArrayValue.propTypes = ATTRIBUTE_VALUE_PROPTYPES;
 
@@ -35,7 +35,7 @@
     if (attribute.schemas().title !== undefined) {
         return <span>{attribute.schemas().title()}</span>;
     } else {
-        return <AttributeValue attribute={attribute}/>
+        return <AttributeValue attribute={attribute}/>;
     }
 }
 ArrayItemValue.propTypes = ATTRIBUTE_VALUE_PROPTYPES;
--- a/src/components/BaseViews.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/BaseViews.js	Wed May 03 17:11:02 2017 +0200
@@ -54,7 +54,7 @@
 ActionsDropDown.propTypes = {
     target: PropTypesResourceModel.isRequired,
     ignore: PropTypes.arrayOf(PropTypes.string),
-}
+};
 
 export function ActionLink({target, action}) {
     let {route} = target;
@@ -108,4 +108,4 @@
     title: PropTypes.string.isRequired,
     style: PropTypes.string,
     children: PropTypes.arrayOf(PropTypes.object),
-}
+};
--- a/src/components/Entities.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/Entities.js	Wed May 03 17:11:02 2017 +0200
@@ -51,7 +51,7 @@
 
         return <div className="text-mutted">
             no {props.entities.etype} entity yet
-        </div>
+        </div>;
     }
 
     return (
--- a/src/components/Entity.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/Entity.js	Wed May 03 17:11:02 2017 +0200
@@ -7,7 +7,7 @@
 
 import Api from '../Api';
 import HypermediaClient from '../services/hypermedia';
-import {createResource, PropTypeJsonaryWrapper} from '../jsonaryutils'
+import {createResource, PropTypeJsonaryWrapper} from '../jsonaryutils';
 import {PropTypesEntityModel} from '../model';
 import {buildFormData, appendPath} from '../utils';
 import {ActionsDropDown, CollectionItemLink} from './BaseViews';
@@ -263,7 +263,7 @@
 
 Entity.contextTypes = {
     router: PropTypes.object.isRequired,
-}
+};
 export class EntityView extends React.Component {
 
     renderTitle() {
@@ -287,7 +287,7 @@
         const links = this.props.entity.data.links('related');
         if (links.length > 0) {
             return Array.prototype.map.call(links, (link) => {
-                return <RelatedResources key={link.title} link={link} />
+                return <RelatedResources key={link.title} link={link} />;
             });
         }
         return null;
@@ -444,7 +444,7 @@
     }
 
     onSubmit({formData}) {
-        const path = `/${this.etype}/${this.targetEid}`
+        const path = `/${this.etype}/${this.targetEid}`;
         Api.relateEntity(this.etype, this.targetEid, this.rtype, formData)
             .then(this.context.router.history.push(path));
     }
--- a/src/components/Form.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/Form.js	Wed May 03 17:11:02 2017 +0200
@@ -7,7 +7,7 @@
     // Sanitize schema in order to render it with
     // react-jsonschema-form Form component
     fromSchema(schema) {
-        return this.adaptRecursively(cloneDeep(schema))
+        return this.adaptRecursively(cloneDeep(schema));
     }
 
     adaptRecursively(obj) {
@@ -69,4 +69,4 @@
 FormWrapper.propTypes = {
     schema: PropTypes.object.isRequired,
     adapterFactory: PropTypes.object,
-}
+};
--- a/src/components/Root.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/components/Root.js	Wed May 03 17:11:02 2017 +0200
@@ -17,7 +17,7 @@
 
     render() {
         if (this.state.resource === null) {
-            return (<p>loading...</p>)
+            return (<p>loading...</p>);
         }
         return <RootView resource={this.state.resource} />;
     }
@@ -43,4 +43,4 @@
 
 RootView.propTypes = {
     resource: PropTypes.object.isRequired,
-}
+};
--- a/src/index.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/index.js	Wed May 03 17:11:02 2017 +0200
@@ -7,7 +7,7 @@
 import Entities from './components/Entities';
 import {Entity, EntityCreationForm, AddRelated} from './components/Entity';
 
-import "script-loader!jsonary/super-bundle/jsonary-super-bundle.js"
+import "script-loader!jsonary/super-bundle/jsonary-super-bundle.js";
 
 const appElement= document.getElementById('app');
 
--- a/src/jsonaryutils.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/jsonaryutils.js	Wed May 03 17:11:02 2017 +0200
@@ -13,7 +13,7 @@
 
 function mapItems(callback) {
     const result = [];
-    this.items((index, item) => {result.push(callback(item, index))});
+    this.items((index, item) => {result.push(callback(item, index));});
     return result;
 }
 
--- a/src/services/hypermedia.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/services/hypermedia.js	Wed May 03 17:11:02 2017 +0200
@@ -70,7 +70,7 @@
     extractSchemaRoute(response) {
         const linkHeader = response.headers.get("Link");
         if (linkHeader === null) {
-            throw new Error(`"Link" header does not exist on resource's HTTP header`)
+            throw new Error(`"Link" header does not exist on resource's HTTP header`);
         }
         try {
             const links = LinkParser.parse(linkHeader);
--- a/src/utils.js	Tue May 02 17:51:43 2017 +0200
+++ b/src/utils.js	Wed May 03 17:11:02 2017 +0200
@@ -55,7 +55,7 @@
         });
 
         const filteredProperties = properties.filter( property => {
-            return property.defined() && property.value() !== null
+            return property.defined() && property.value() !== null;
         });
 
         for (const property of filteredProperties) {
--- a/test/index.js	Tue May 02 17:51:43 2017 +0200
+++ b/test/index.js	Wed May 03 17:11:02 2017 +0200
@@ -8,7 +8,7 @@
 import {assert} from 'sinon';
 import React from 'react';
 import {PropTypes} from 'prop-types';
-import createRouterContext from 'react-router-test-context'
+import createRouterContext from 'react-router-test-context';
 import {merge} from 'lodash/object';
 
 import {buildFormData, appendPath} from '../src/utils';
@@ -122,7 +122,7 @@
             ],
         };
         const resource = createResource(entity, userEditionSchema);
-        const formData = buildFormData(resource)
+        const formData = buildFormData(resource);
         expect(formData).to.deep.equal(expected);
     });
 
@@ -184,7 +184,7 @@
         allowedActions: ["view", "create", "edit", "delete"],
         url: "/here/",
         data: {},
-    }
+    };
 
     it('renders a dropdown button with actions from target', () => {
         const wrapper = shallow(<ActionsDropDown target={targetResource}/>);
@@ -245,14 +245,14 @@
     it('Use the schema title of an attribute when it exists', () => {
         const instance = {
             name: 'A_NAME',
-        }
+        };
         const schema = {
             properties: {
                 name: {type: 'string', title: 'Title'},
                 description: {type: 'string', title: 'Description'},
             },
             type: 'object',
-        }
+        };
         const resource = createResource(instance, schema);
         const wrapper = render(<EntityAttributes data={resource} />);
         expect(wrapper.find('th').eq(0).text()).to.be.equal('Title');
@@ -277,7 +277,7 @@
     const dataWithDates = {
         created_at: '2017-10-21T00:00:00.000Z',
         updated_at: '2015-07-15T00:00:00.000Z',
-    }
+    };
 
     const schemaWithDatesWithoutTitles = {
         properties: {
@@ -463,7 +463,7 @@
 
             client.getResource(resourceRoute).then( resource => {
                 expect(resource.data.value()).to.deep.equal(resourceData);
-                done()
+                done();
             }).catch(done);
 
         });
@@ -474,7 +474,7 @@
                 schema : {type: 'object'},
                 schemaRoute : '/schema/any',
 
-            }
+            };
             const client = configureBackend(config);
 
             client.getResource(config.resourceRoute).then(resource => {
@@ -523,7 +523,7 @@
                 expect(fetch.calledOnce).to.be.true;
             });
         });
-    })
+    });
 });
 
 describe('Api', () => {
@@ -679,7 +679,7 @@
 
             expect(enumNames).lengthOf(expectedLength);
             expect(enumValues).lengthOf(expectedLength);
-        })
+        });
     });
 
     describe('schemaToConstant', () => {
--- a/webpack/paths.js	Tue May 02 17:51:43 2017 +0200
+++ b/webpack/paths.js	Wed May 03 17:11:02 2017 +0200
@@ -1,6 +1,7 @@
-const path = require('path')
+const path = require('path');
+
 module.exports = {
     output: path.resolve(path.join(__dirname, '../dist')),
     source: path.resolve(path.join(__dirname, '../src')),
     test: path.resolve(path.join(__dirname, '../test')),
-}
+};
--- a/webpack/test.config.js	Tue May 02 17:51:43 2017 +0200
+++ b/webpack/test.config.js	Wed May 03 17:11:02 2017 +0200
@@ -10,4 +10,4 @@
     'react/lib/ReactContext': 'react',
 });
 
-config.devtool = 'inline-source-map'
+config.devtool = 'inline-source-map';