eslint-config-exp

    0.0.9 • Public • Published

    eslint-config-exp

    Test application

    Basic ESLint rules used by Expressen. The test-config (eslint-config-exp/test) is adapted to testing using mocha, mocha-cakes-2 and chai.

    Usage

    Install eslint and eslint-config-exp:

    npm install --save-dev eslint eslint-config-exp

    Add the following to your .eslintrc.json-file:

    {
      "root": true,
      "extends": ["eslint-config-exp"]
    }

    Add the following to your test/.eslintrc.json-file:

    {
      "extends": ["eslint-config-exp/test"]
    }

    Run with:

    npx eslint .

    Usage in an existing project

    • We advice to remove any husky hooks that uses libraries such as pretty-quick from your package.json
    • Subsequently remove any use of pretty-quick if possible.
    • Remove any previous use of sharable ESLint configs from package.json, i.e.:
      • eslint-config-airbnb
      • eslint-config-google
      • eslint-config-prettier
    • Remove eslint-plugin-prettier from package.json
    • If you get errors similar to the ones below, please update the eslint dependancy.
      • Definition for rule 'no-nonoctal-decimal-escape' was not found
      • Definition for rule 'no-unsafe-optional-chaining' was not found
    • If you still have issues; try updating npm (if you use nvm nvm install-latest-npm) & prettier as-well
    • Remove any 'eslint-disable-line no-unused-expressions' directives added because of chai assertions, they are not needed anymore (eslint-plugin-chai-friendly is used in test).
    • Remove any globals and special rules related to mocha-cakes-2 in your test/.eslintrc.json, they already exist in eslint-config-exp/test.

    Once you complete the steps above run the following:

    npx eslint . --fix

    Usage with Prettier

    If you want to use Prettier, run it before eslint. ESLint should be the final judge, i.e. run:

    npx prettier --save .
    npx eslint . --fix

    This will format the entire code base according to the rules of Prettier and the config.

    Enable format on save

    Changelog

    Can be found here.

    License

    Released under the MIT license.

    Install

    npm i eslint-config-exp

    DownloadsWeekly Downloads

    95

    Version

    0.0.9

    License

    MIT

    Unpacked Size

    12.5 kB

    Total Files

    7

    Last publish

    Collaborators

    • expgripen
    • andolf
    • markusn
    • linuss
    • joelabrahamsson
    • paed01
    • jonaswalden
    • indeedshouts
    • marcusgronblad