@dietlabs/eslint-config

1.2.2 • Public • Published

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

/@dietlabs/eslint-config/

    Package Sidebar

    Install

    npm i @dietlabs/eslint-config

    Weekly Downloads

    7

    Version

    1.2.2

    License

    MIT

    Unpacked Size

    5.02 kB

    Total Files

    6

    Last publish

    Collaborators

    • jedrzejczak
    • saji
    • tgalczynski