From 40cab083925d1f886cf00b72c375e7c35b7a4970 Mon Sep 17 00:00:00 2001 From: gohabereg Date: Mon, 3 Sep 2018 23:32:10 +0300 Subject: [PATCH] Set up linter for frontend part --- .eslintignore | 1 + .gitignore | 1 + frontend/js/app.js | 10 +++++++--- package.json | 5 +++-- webpack.config.js | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.eslintignore b/.eslintignore index c2658d7..e509f34 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ node_modules/ +public/dist/ diff --git a/.gitignore b/.gitignore index 9982c9f..6d2f6ab 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ db/ # Cache of babel and others .cache/ +.eslintcache diff --git a/frontend/js/app.js b/frontend/js/app.js index 248d5fc..ac5f86b 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -1,8 +1,12 @@ +// No inspection for unused var `css` because it's used for css bundle +// eslint-disable-next-line no-unused-vars import css from '../styles/main.pcss'; module.exports = class Docs { - constructor(){ + /** + * @constructor + */ + constructor() { console.log('CodeX Docs initialized'); - } -} +}; diff --git a/package.json b/package.json index df65093..da9cc68 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "start": "nodemon ./bin/www", "test": "mocha --recursive ./test", - "lint": "eslint --fix ./**/*.js", - "build": "webpack ./frontend/js/app.js --o='./public/dist/bundle.js' --output-library=Docs -d" + "lint": "eslint --fix --cache ./**/*.js", + "build": "webpack ./frontend/js/app.js --o='./public/dist/bundle.js' --output-library=Docs -d", + "precommit": "yarn lint && yarn test --exit" }, "dependencies": { "body-parser": "latest", diff --git a/webpack.config.js b/webpack.config.js index ad2c6eb..333e2cc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,7 +8,7 @@ const babelLoader = { options: { cacheDirectory: '.cache/babel-loader', presets: [ - "env" + 'env' ], plugins: [ /**