Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.
/ config Public archive

DEPRECATED! Our sharable configurations and code standards

License

Notifications You must be signed in to change notification settings

azimutlabs/config

Repository files navigation

azimutlabs config logo /config azimutlabs/config repository license DEPRECATED! Visit https://github.com/azimutlabs/eslint instead.

Our sharable configurations and code standards

ESLint configurations used in our projects

We assume that you already have eslint package installed.

$ npm i -D @azimutlabs/eslint-config

Available configurations

  • legacy - default lint rules with some plugin extensions.
    • required libs: babel-eslint eslint-plugin-import, eslint-plugin-array-func, eslint-plugin-functional, eslint-plugin-simple-import-sort
    • required libs for typescript: @typescript-eslint/parser, @typescript-eslint/eslint-plugin
    • download command: npm i -D babel-eslint eslint-plugin-import eslint-plugin-array-func eslint-plugin-functional eslint-plugin-simple-import-sort @typescript-eslint/parser @typescript-eslint/eslint-plugin
  • prettier - prettier config for eslint.
    • required libs: prettier, eslint-config-prettier, eslint-plugin-prettier
    • download command: npm i -D prettier eslint-config-prettier eslint-plugin-prettier
  • jest - jest specific rules.
    • required libs: eslint-plugin-jest
    • download command: npm i -D eslint-plugin-jest
  • react - react specific rules with extensions.
    • required libs: eslint-plugin-react, eslint-plugin-react-hooks
    • download command: npm i -D eslint-plugin-react eslint-plugin-react-hooks
  • a11y - jsx accessibility.
    • required libs: eslint-plugin-jsx-a11y
    • download command: npm i -D eslint-plugin-jsx-a11y

Recommended usage

Extending ALL configs via package.json:

{
  "eslintConfig": {
    "extends": [
      "@azimutlabs"
    ]
  }
}

Extending configs separately:

{
  "eslintConfig": {
    "extends": [
      "@azimutlabs/eslint-config/legacy",
      "@azimutlabs/eslint-config/prettier",
      "@azimutlabs/eslint-config/react"
    ]
  }
}
Next.js config extensions

We assume that you already have next package installed.

$ npm i -D @azimutlabs/next-config

Available extensions

  • withEslint - adds eslint-loader.

    • usage:
      // next.config.js
      module.exports = withEslint({
        disableLintForProd: true, // disables linting process for production build phase
        eslintOptions: {},        // options for eslint-loader
      });
    • required libs: eslint, eslint-loader, eslint-friendly-formatter.
    • download command: npm i -D eslint-loader eslint-friendly-formatter
  • withLodash - optimizes lodash dist size using lodash-webpack-plugin.

    • usage:
      // next.config.js
      module.exports = withLodash({
        lodashWebpackPluginOptions: {}, // lodash-webpack-plugin options.
      });
    • required libs: lodash-webpack-plugin.
    • download command: npm i -D lodash-webpack-plugin

Recommended usage

Combine by compose functions:

module.exports = compose(
  withEslint,
  withLodash,
)({
  poweredByHeader: false, // pass here all your next config options
  eslintOptions: {},      // as well as extensions specific options
});