Skip to content

Rules

The rules are the building blocks of each config. Every config is just a collection of these rule groups.

Base Rules

Rule GroupDescription
Best PracticesEnforces common best practices to improve code quality and maintainability.
ErrorsHelps catch runtime errors and unsafe patterns early.
ES6Provides rules specific to ES6+ syntax and features.
ImportsEnsures proper import/export usage with eslint-plugin-import.
Imports StrictSee Strict Imports.
StrictEnables strict mode rules.
StyleCovers general code style rules such as spacing, quotes, and semicolons.
StylisticUses @stylistic/eslint-plugin for consistent formatting.
VariablesValidates variable declarations, usage, and scoping rules.

Example

ts
import { rules } from 'eslint-config-airbnb-extended';

export default [
  // Best Practices
  rules.base.bestPractices,
  // Imports
  rules.base.imports,
];

Node Rules

Rule GroupDescription
BaseCore Node.js linting rules.
GlobalsEnforces using Node.js globals such as console and process directly without requiring them.
PromisesEnforces using promise based variants of core modules such as fs and dns variant.
No Unsupported FeaturesPrevents usage of Node features not supported in your target version.

Example

ts
import { rules } from 'eslint-config-airbnb-extended';

export default [
  // Promises
  rules.node.promises,
];

React Rules

Rule GroupDescription
BaseCore React rules for JSX and component structure.
JSX AccessibilityAccessibility rules via eslint-plugin-jsx-a11y for inclusive UIs.
HooksRules from eslint-plugin-react-hooks ensuring proper hook usage.
StylisticEnsures consistent styling inside JSX and React code.
React StrictSee Strict React.

Example

ts
import { rules } from 'eslint-config-airbnb-extended';

export default [
  // JSX Accessibility
  rules.react.jsxA11y,
  // Hooks
  rules.react.hooks,
];

Next.js Rules

Rule GroupDescription
BaseApplies general Next.js linting best practices.
Core Web VitalsEnforces performance and SEO improvements recommended by Next.js team.

Example

ts
import { rules } from 'eslint-config-airbnb-extended';

export default [
  // Base
  rules.next.base,
];

TypeScript Rules

Rule GroupDescription
BaseAdjusts ESLint by disabling rules covered by TypeScript and enabling ones that benefit from type-checking.
StylisticUses @stylistic/eslint-plugin to enforce consistent TypeScript code formatting.
TypeScript ESLintRules powered by typescript-eslint.
ImportsActivates eslint-plugin-import-x rules needed for TypeScript while disabling rules already covered by TypeScript to avoid redundancy.
TypeScript ESLint StrictSee Strict TypeScript ESLint.

Example

ts
import { rules } from 'eslint-config-airbnb-extended';

export default [
  // Base
  rules.typescript.base,
  // Imports
  rules.typescript.imports,
];

Released under the MIT License.