Skip to content

joggrdocs/eslint-config

Repository files navigation


ESLint configuration for Joggr projects.


npm version CodeQL Publish to npm CI
JS Semi-standard Style Prettier Style

Installation

Yarn

yarn add -D @joggr/eslint-config \
  eslint \
  @eslint/js \
  @types/eslint \
  @typescript-eslint/eslint-plugin \
  @typescript-eslint/parser \
  eslint-config-prettier \
  eslint-plugin-jest \
  eslint-config-standard-with-typescript \
  eslint-plugin-filenames-simple \
  eslint-plugin-import \
  eslint-plugin-n \
  eslint-plugin-promise

npm

npm install --save-dev @joggr/eslint-config \
  eslint \
  @eslint/js \
  @types/eslint \
  @typescript-eslint/eslint-plugin \
  @typescript-eslint/parser \
  eslint-config-prettier \
  eslint-plugin-jest \
  eslint-config-standard-with-typescript \
  eslint-plugin-filenames-simple \
  eslint-plugin-import \
  eslint-plugin-n \
  eslint-plugin-promise

Usage

.eslintrc.cjs

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ["@joggr/eslint-config"],
};

eslint@v9+

eslint.config.js

const { FlatCompat } = require("@eslint/eslintrc");

/** @type {import('eslint').Linter.Config} */
const config = {
  root: true,
  extends: ['@joggr/eslint-config'],
};

const compat = new FlatCompat();
module.exports = [
  ...compat.config(config)
];

React Project

Add additional packages.

yarn add -D eslint-plugin-react \
  eslint-plugin-react-hooks \
  eslint-plugin-react-refresh \
  eslint-plugin-storybook

.eslintrc.cjs

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ["@joggr/eslint-config/react"],
};

Node.js Project

.eslintrc.cjs

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ["@joggr/eslint-config/node"],
};

Adding Import Order Groups

You can add import order groups by extending the joggr config and overriding the import/order rule.

View File

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ['@joggr/eslint-config'],
  overrides: [
    {
      files: ['*'],
      rules: {
        'import/order': [
          'error',
          {
            pathGroups: [
              {
                pattern: '@lint/*',
                group: 'internal',
                position: 'before',
              },
            ],
          },
        ],
      },
    },
  ],
};

License

Licensed under MIT.



Want to sign up for Joggr?

We'd love to have you join, but we are in closed beta.
You can join our waitlist below.