From c308afa91bfc374883c185324bc1f496845d6c62 Mon Sep 17 00:00:00 2001 From: abhijithvijayan <34790378+abhijithvijayan@users.noreply.github.com> Date: Fri, 25 Oct 2019 12:38:20 +0530 Subject: [PATCH] add lint scripts & apply lint fixes --- package.json | 4 +- src/scripts/background.js | 2 +- src/scripts/options.js | 2 +- src/scripts/popup.js | 2 +- webpack.config.js | 96 +++++++++++++++++++-------------------- 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 0b8e737..8fe2e1b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "license": "MIT", "scripts": { "build": "webpack", - "start": "webpack-dev-server" + "start": "webpack-dev-server", + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "devDependencies": { "@babel/core": "^7.6.4", diff --git a/src/scripts/background.js b/src/scripts/background.js index a1b5e82..b8bb883 100644 --- a/src/scripts/background.js +++ b/src/scripts/background.js @@ -1 +1 @@ -console.log("Hello World from background main file!"); +console.log('Hello World from background main file!'); diff --git a/src/scripts/options.js b/src/scripts/options.js index 95cadee..4e102cc 100644 --- a/src/scripts/options.js +++ b/src/scripts/options.js @@ -1 +1 @@ -console.log("Hello World from options main file!"); +console.log('Hello World from options main file!'); diff --git a/src/scripts/popup.js b/src/scripts/popup.js index 0206802..7f6c939 100644 --- a/src/scripts/popup.js +++ b/src/scripts/popup.js @@ -1 +1 @@ -console.log("Hello World from popup main file!"); +console.log('Hello World from popup main file!'); diff --git a/webpack.config.js b/webpack.config.js index bbbda79..90fe7ee 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -26,61 +26,61 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); */ module.exports = { - mode: 'development', + mode: 'development', - entry: { - background: './src/scripts/background.js', - popup: './src/scripts/popup.js', - options: './src/scripts/options.js' - }, + entry: { + background: './src/scripts/background.js', + popup: './src/scripts/popup.js', + options: './src/scripts/options.js', + }, - output: { - filename: '[name].[chunkhash].js', - path: path.resolve(__dirname, 'extension') - }, + output: { + filename: '[name].[chunkhash].js', + path: path.resolve(__dirname, 'extension'), + }, - plugins: [new webpack.ProgressPlugin(), new HtmlWebpackPlugin()], + plugins: [new webpack.ProgressPlugin(), new HtmlWebpackPlugin()], - module: { - rules: [ - { - test: /.(js|jsx)$/, - include: [path.resolve(__dirname, 'src/scripts')], - loader: 'babel-loader', + module: { + rules: [ + { + test: /.(js|jsx)$/, + include: [path.resolve(__dirname, 'src/scripts')], + loader: 'babel-loader', - options: { - plugins: ['syntax-dynamic-import'], + options: { + plugins: ['syntax-dynamic-import'], - presets: [ - [ - '@babel/preset-env', - { - modules: false - } - ] - ] - } - } - ] - }, + presets: [ + [ + '@babel/preset-env', + { + modules: false, + }, + ], + ], + }, + }, + ], + }, - optimization: { - splitChunks: { - cacheGroups: { - vendors: { - priority: -10, - test: /[\\/]node_modules[\\/]/ - } - }, + optimization: { + splitChunks: { + cacheGroups: { + vendors: { + priority: -10, + test: /[\\/]node_modules[\\/]/, + }, + }, - chunks: 'async', - minChunks: 1, - minSize: 30000, - name: true - } - }, + chunks: 'async', + minChunks: 1, + minSize: 30000, + name: true, + }, + }, - devServer: { - open: true - } + devServer: { + open: true, + }, };