Naturally Processed Meals

    @hannohealth/eslint-config

    1.3.4 • Public • Published

    @hannohealth/eslint-config

    A global ESLint and Prettier configuration with opinionated defaults for Hanno's JavaScript projects.

    In addition to our base ESLint configuration, we also include variants for our Node, React and React Native projects.

    This repository is private, but the package itself is published on npm and includes this README.

    Installation

    yarn add -D @hannohealth/eslint-config
    npm install --save-dev @hannohealth/eslint-config
    

    Prettier

    In your prettier.config.js file, add the following:

    module.exports = require('@hannohealth/eslint-config/prettier.config');
    

    ESLint

    Base

    The base configuration provides a baseline set of rules that are mainly drawn from eslint:recommended, with a few modifications.

    Add the following to your .eslintrc.js file:

    module.exports = {
      extends: ['@hannohealth'],
    };
    

    It introduces the following plugins:

    We also include eslint-config-prettier for Prettier compatibility and eslint-plugin-prettier to notify any Prettier errors as ESLint errors in ESLint.

    Defensive programming rules

    These rules are designed to enforce defensive programming, but there's still room for improvement. The following scenarios haven't been covered yet, but might be re-considered in the future:

    Node

    The node configuration extends base, but is otherwise a relatively minimal configuration which sets the environment to Node and allows us to use console logs.

    To integrate, add the following to your .eslintrc.js file:

    module.exports = {
      extends: ['@hannohealth/eslint-config/node'],
    };
    

    React

    The react configuration extends base with some rules specific to React.

    To integrate, add the following to your .eslintrc.js file:

    module.exports = {
      extends: ['@hannohealth/eslint-config/react'],
    };
    

    It introduces the following plugins:

    React Native

    The react-native configuration extends base with some rules specific to React Native. Among other things, this enables the React Native globals and allows us to properly use the module resolver in a React Native codebase.

    To integrate, add the following to your .eslintrc.js file:

    module.exports = {
      extends: ['@hannohealth/eslint-config/react-native'],
    };
    

    It introduces the following plugins:

    Even though this configuration inherits the eslint-plugin-cypress from our React configuration, which is not suited for React Native, this shouldn't interfere with the React Native setup.

    Editors

    Visual Studio Code

    If you're VS Code user, you may find adding this config to your .vscode/settings.json helpful when you integrate the configuration into your project. This will ensure that linting happens on save and applies the appropriate settings:

    {
      "eslint.format.enable": true,
      "editor.formatOnSave": true
    }

    Install

    npm i @hannohealth/eslint-config

    DownloadsWeekly Downloads

    0

    Version

    1.3.4

    License

    MIT

    Unpacked Size

    20.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • hanno-bot