From d73a91232e2f43de168cd361e676d6e2192d6c65 Mon Sep 17 00:00:00 2001 From: Kirill Glebov Date: Thu, 27 Sep 2018 13:40:08 +0200 Subject: [PATCH] Add eslint tasks and README Closes #47 --- README.md | 17 +++++++++++++++++ package.json | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d8c1328..1f408d0 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,23 @@ ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit After changing the code and running `make` again, reload the Cockpit page in your browser. +# Running eslint + +Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check +JavaScript code style in `.jsx` and `.es6` files. + +The linter is executed within every build as a webpack preloader. + +For developer convenience, the ESLint can be started explicitly by: + + $ npm run eslint + +Violations of some rules can be fixed automatically by: + + $ npm run eslint:fix + +Rules configuration can be found in the `.eslintrc.json` file. + # Automated Testing Run `make check` to build an RPM, install it into a standard Cockpit test VM diff --git a/package.json b/package.json index 473cf29..ae2f5a8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "author": "", "license": "LGPL-2.1", "scripts": { - "build": "webpack" + "build": "webpack", + "eslint": "eslint --ext .jsx --ext .es6 src/", + "eslint:fix": "eslint --fix --ext .jsx --ext .es6 src/" }, "devDependencies": { "@babel/core": "^7.0.0",