/js-scripts

Set of custom scripts to handle precommit and linter actions

Primary LanguageJavaScript

JS Scripts

Created by Credijusto.com

Set of custom packages, eslint-config rules, stylelint-config rules and a set of two scripts to include at a JS project.

Packages

js-scripts

npm

Set of two scripts, to handle code linting and pre-commit actions.

The available scripts are:

  • js-scripts lint
  • js-scripts precommit

eslint-config-js-scripts

npm

This package includes a ESLint configuration that extends eslint-config-react-app and adds some extra rules

stylelint-config-js-scripts

npm

This package includes a StyleLint configuration that extends stylelint-config-standard and adds some extra rules

prettier-config-js-scripts

npm

Prettier configuration compatible with eslint-config-js-scripts

Setup

Install dependencies

> npm i js-scripts eslint-config-js-scripts stylelint-config-js-scripts
> npm i -D husky

Make sure you have the following properties in your package.json.

{
  "scripts": {
    ...,
+   "lint": "js-scripts lint"
  },
+ "eslintConfig": {
+   "extends": "js-scripts"
+ },
+ "stylelint": {
+   "extends": "stylelint-config-js-scripts"
+ },
+ "prettier": "prettier-config-js-scripts",
+ "husky": {
+   "hooks": {
+     "pre-commit": "js-scripts lint",
+   }
+ }
}

The js-scripts package works also with any eslint/stylelint rules, just add the previous rules in your package.json or in their custom configuration file.