Upgrade eslint to 4.x.x and fix new linting errors
authorFrank Bessou <frank.bessou@logilab.fr>
Fri, 30 Jun 2017 12:09:52 +0200
changeset 234 b25424970acf
parent 233 1c01a26ea4b8
child 235 5f915cb3dc34
Upgrade eslint to 4.x.x and fix new linting errors This version of eslint introduce stricter indentation checks. See the changelog for more information: http://eslint.org/blog/2017/06/eslint-v4.1.1-released
karma.conf.js
package.json
src/components/BaseViews.js
src/components/Resource.js
src/components/Root.js
src/services/hypermedia.js
webpack.config.js
--- a/karma.conf.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/karma.conf.js	Fri Jun 30 12:09:52 2017 +0200
@@ -9,30 +9,30 @@
     // base path that will be used to resolve all patterns (eg. files, exclude)
         basePath: '',
 
-    // frameworks to use
-    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+        // frameworks to use
+        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
         frameworks: ['mocha'],
 
-    // list of files / patterns to load in the browser
+        // list of files / patterns to load in the browser
         files: [
             'node_modules/babel-polyfill/dist/polyfill.js',
             path.join(paths.test, '*.js'),
         ],
 
-    // list of files to exclude
+        // list of files to exclude
         exclude: [
         ],
 
-    // preprocess matching files before serving them to the browser
-    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+        // preprocess matching files before serving them to the browser
+        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
         preprocessors: {
             '**/*.js': ['webpack', 'sourcemap'],
         },
 
         webpack: require("./webpack/test.config"),
-    // test results reporter to use
-    // possible values: 'dots', 'progress'
-    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+        // test results reporter to use
+        // possible values: 'dots', 'progress'
+        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
         reporters: ['mocha', 'junit'],
 
         junitReporter: {
@@ -45,29 +45,29 @@
             showDiff: true,
         },
 
-    // web server port
+        // web server port
         port: 9876,
 
-    // enable / disable colors in the output (reporters and logs)
+        // enable / disable colors in the output (reporters and logs)
         colors: true,
 
-    // level of logging
-    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+        // level of logging
+        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
         logLevel: config.LOG_INFO,
 
-    // enable / disable watching file and executing tests whenever any file changes
+        // enable / disable watching file and executing tests whenever any file changes
         autoWatch: true,
 
-    // start these browsers
-    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+        // start these browsers
+        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
         browsers: ['PhantomJS'],
 
-    // Continuous Integration mode
-    // if true, Karma captures browsers, runs the tests and exits
+        // Continuous Integration mode
+        // if true, Karma captures browsers, runs the tests and exits
         singleRun: false,
 
-    // Concurrency level
-    // how many browser should be started simultaneous
+        // Concurrency level
+        // how many browser should be started simultaneous
         concurrency: Infinity,
     });
 };
--- a/package.json	Wed Jun 14 14:02:16 2017 +0200
+++ b/package.json	Fri Jun 30 12:09:52 2017 +0200
@@ -26,7 +26,7 @@
     "chai-as-promised": "^6.0.0",
     "diff": "^3.2.0",
     "enzyme": "^2.8.2",
-    "eslint": "^3.11.1",
+    "eslint": "^4.0.0",
     "eslint-plugin-import": "^2.2.0",
     "eslint-plugin-react": "^6.7.1",
     "html-webpack-plugin": "^2.28.0",
--- a/src/components/BaseViews.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/src/components/BaseViews.js	Fri Jun 30 12:09:52 2017 +0200
@@ -27,7 +27,7 @@
                         <li className="list-group-item" key={item.getLink('item').href}>
                             <CollectionItemLink item={item} />
                         </li>
-                        )
+                    )
                 )
             }
         </ul>
--- a/src/components/Resource.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/src/components/Resource.js	Fri Jun 30 12:09:52 2017 +0200
@@ -106,7 +106,7 @@
             schema={this.state.schema}
             onSubmit={this.onSubmit}
             errors={this.state.errors}
-            />;
+        />;
     }
 }
 ResourceCreationForm.propTypes = {
--- a/src/components/Root.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/src/components/Root.js	Fri Jun 30 12:09:52 2017 +0200
@@ -28,16 +28,16 @@
         return resource.data.schemas().title();
     }
     return (
-            <div>
-                <h3>{renderTitle()}</h3>
-                <ul className="list-group">{
+        <div>
+            <h3>{renderTitle()}</h3>
+            <ul className="list-group">{
                 Array.prototype.map.call(resource.data.links(), link =>
                     <li className="list-group-item" key={link.href}>
                         <Link to={link.href}>{link.title}</Link>
                     </li>
-                    )
-                }</ul>
-            </div>
+                )
+            }</ul>
+        </div>
     );
 }
 
--- a/src/services/hypermedia.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/src/services/hypermedia.js	Fri Jun 30 12:09:52 2017 +0200
@@ -33,10 +33,10 @@
             const dataPromise = response.json().catch(() => null);
 
             return Promise.all([dataPromise, schemaPromise]).then(
-                    ([data, schema]) => {
-                        resource.data = mapToSchema(data, schema);
-                        return resource;
-                    });
+                ([data, schema]) => {
+                    resource.data = mapToSchema(data, schema);
+                    return resource;
+                });
         });
         return resourcePromise;
     }
@@ -114,7 +114,7 @@
                 }
                 const method = options.method || 'GET';
                 throw new Error(
-                        `Got "${response.statusText}" from ${method} request at ${fullUrl}`);
+                    `Got "${response.statusText}" from ${method} request at ${fullUrl}`);
             });
     }
 
@@ -149,7 +149,7 @@
             .then( response => response.status)
             .then( status => {
                 if (status !== 204 && status !== 404) {
-                    throw new Error(`Could not delete resource \'${url}\'`);
+                    throw new Error(`Could not delete resource '${url}'`);
                 }
             });
 
--- a/webpack.config.js	Wed Jun 14 14:02:16 2017 +0200
+++ b/webpack.config.js	Fri Jun 30 12:09:52 2017 +0200
@@ -16,26 +16,26 @@
         .value();
 
     config.plugins.push(
-            new webpack.optimize.UglifyJsPlugin(),
-            new webpack.DefinePlugin({
-                "process.env": {
-                    NODE_ENV: JSON.stringify('production'),
-                },
-            })
-            );
+        new webpack.optimize.UglifyJsPlugin(),
+        new webpack.DefinePlugin({
+            "process.env": {
+                NODE_ENV: JSON.stringify('production'),
+            },
+        })
+    );
 } else {
     // Create a page that connects to json schema.
     const defaultApiUrl = "http://localhost:6543/";
     const apiUrl = process.env.API_URL || defaultApiUrl;
     config.plugins.push(
-            new HtmlWebpackPlugin({
-                title: "Json Schema React Web Client",
-                template: path.join(paths.source, "index.ejs"),
-            }),
-            new webpack.DefinePlugin({
-                API_URL: JSON.stringify(apiUrl),
-            })
-            );
+        new HtmlWebpackPlugin({
+            title: "Json Schema React Web Client",
+            template: path.join(paths.source, "index.ejs"),
+        }),
+        new webpack.DefinePlugin({
+            API_URL: JSON.stringify(apiUrl),
+        })
+    );
 
     config.devServer = {
         contentBase: paths.output,