Skip to content

About

Shareable ESLint config for Availity projects

Topics

Resources

Stars

6 stars

Watchers

30 watching

Forks

Repository files navigation

eslint-config-availity

Shareable ESLint flat config for Availity projects designed to be used with Prettier and TypeScript

License NPM Link

Installation

Requires Node 22+ and ESLint 9+.

yarn add --dev eslint-config-availity

If you need TypeScript support, also include typescript as a devDependency. TypeScript 5.2+ and 6.0.x are supported.

Profiles

This package provides three ESLint flat config profiles, each targeting a different environment:

Base (eslint-config-availity)

For Node.js and CLI projects. Includes airbnb-base, Prettier compatibility, and plugins for promises and unicorn. Uses ESM (sourceType: 'module') with ecmaVersion: 'latest'. If typescript is installed, TypeScript recommended rules are automatically applied to .ts/.tsx files. Enforces explicit file extensions in imports (required for Node ESM).

import base from 'eslint-config-availity';

export default [...base];

Browser (eslint-config-availity/browser)

For React + TypeScript browser applications. Extends the full Airbnb config (including React and JSX a11y rules), adds react-hooks, and uses the TypeScript parser. Includes all shared rules from the base profile without duplicating airbnb-base. TypeScript recommended rules are applied to .ts/.tsx files, react/prop-types is disabled for .tsx files, and unicorn/prefer-module is enforced. Import extensions are set to 'never' (bundlers handle resolution).

import browser from 'eslint-config-availity/browser';

export default [...browser];

Workflow (eslint-config-availity/workflow)

For projects scaffolded with @availity/workflow. Extends the browser profile and adds workflow-specific configuration: the @/ root-import resolver (mapped to project/app) and webpack DefinePlugin globals (__DEV__, __TEST__, __PROD__, __STAGING__). Vitest rules are included automatically since workflow projects use Vitest as their test runner.

import workflow from 'eslint-config-availity/workflow';

export default [...workflow];

Test Runner Support

Test runner rules are opt-in via named exports. Add the appropriate export for your test runner alongside your base config:

Jest

import base, { withJest } from 'eslint-config-availity';

export default [...base, ...withJest];

Requires jest and eslint-plugin-jest to be installed:

yarn add --dev jest eslint-plugin-jest

Vitest

import base, { withVitest } from 'eslint-config-availity';

export default [...base, ...withVitest];

Requires @vitest/eslint-plugin to be installed:

yarn add --dev @vitest/eslint-plugin

Node.js built-in test runner (node:test)

import base, { withNodeTest } from 'eslint-config-availity';

export default [...base, ...withNodeTest];

Requires eslint-node-test to be installed as a peer dependency, and ESLint >=10.4:

yarn add --dev eslint-node-test eslint@^10

Each runner export can also be imported directly from eslint-config-availity/test-runners if you prefer not to import from the main entry.

Usage

This package exports ESLint flat configs. Create an eslint.config.js in your project root.

Adding project-specific rules

import workflow from 'eslint-config-availity/workflow';

export default [
    ...workflow,
    {
        rules: {
            'no-console': 'warn',
        },
    },
    {
        ignores: ['**/static/*'],
    },
];

Migrating from .eslintrc

If upgrading from a previous version, see the @availity/workflow upgrade guide. The @availity/workflow-upgrade tool automates the migration from .eslintrc to eslint.config.js.

Included Configs and Plugins

Configs

Plugins

Prettier

Recommended settings:

{
    "printWidth": 120,
    "singleQuote": true,
    "trailingComma": "es5"
}

Contributing

Setup

yarn          # Install dependencies
yarn lint     # Run ESLint
yarn test     # Run tests

Development workflow

  1. Create a branch from master
  2. Make changes to config files (base.js, browser.js, workflow.js, testRunners.js)
  3. If adding or modifying a rule, add corresponding test coverage in tests/rules.test.js and the relevant fixture file
  4. Run yarn lint && yarn test to verify
  5. Run yarn eslint-check to ensure no rules conflict with Prettier
  6. Commit using conventional commits (enforced by commitlint)
  7. Push and open a PR

Commit conventions

  • feat: — New rules or features (triggers minor version bump)
  • fix: — Bug fixes (triggers patch version bump)
  • feat!: or BREAKING CHANGE: — Breaking changes like enabling new error-level rules (triggers major version bump)
  • chore: — Dependency updates, CI changes (no version bump)

Release process

Releases are fully automated via Release Please:

  1. Commits merged to master are analyzed by Release Please, which maintains an open release PR that accumulates changes and updates CHANGELOG.md and the version in package.json.
  2. When you're ready to release, merge the Release Please PR.
  3. Merging triggers Release Please to create a GitHub Release and tag automatically.
  4. The publish workflow runs on the new release: installs dependencies, runs lint and tests, then publishes to npm with provenance via npm publish --provenance.

No manual npm publish or tagging is needed. Commit message format (conventional commits) directly controls the version bump — this is why commit conventions are enforced.

If the automated release ever fails, the Publish Release (Manual) workflow in GitHub Actions can be triggered manually from the Actions tab as a fallback.

License

MIT

About

Shareable ESLint config for Availity projects

Topics

Resources

Stars

6 stars

Watchers

30 watching

Forks

Releases

Used by

Contributors

Languages