1.2.2 • Published 5 years ago

@dietlabs/eslint-config v1.2.2

Weekly downloads
103
License
MIT
Repository
github
Last release
5 years ago

DietLabs’s shared EsLint config

Setup

Install package with its’ peer dependencies

You will use the same command to upgrade to latest version.

npx install-peerdeps --dev @dietlabs/eslint-config@latest

Use the configuration

echo '{"extends": "@dietlabs"}' > .eslintrc.json

Add lint-js npm script and run it

npx add-npm-scripts lint-js "eslint --fixup --ext .js,.jsx ./" --warn
npm run lint-js

Lint while WebPackin’

npm install --save-dev eslint-loader

Then in webpack.config.js:

const lintingRules = require('eslint-config-dietlabs/webpack-rules');

module.exports = {
    rules: [
        // Your rules
    ].concat(lintingRules)
};

Lint while commitin’

You want something in the shape of:

#!/bin/bash

CODE=0
for FILE in $( git diff --cached --name-only --diff-filter=ACM HEAD -- '*.js' '*.jsx' )
do
    git show ":$FILE" \
        | ./node_modules/.bin/eslint --stdin --stdin-filename "$FILE" \
        || CODE=$?
done

return $CODE