Skip to main content

ESLint driver

Provides ESLint support by dynamically generating a .eslintrc.js config file.

Requirements#

  • ESLint ^7.0.0

Events#

Can be listened to on the ESLintDriver instance.

EventArgumentsDescription
onCreateIgnoreFilecontext: ConfigContext, path: Path, config: { ignore: string[] }Called before the ignore file is written.

Installation#

In your configuration module, install the driver, ESLint, and any plugins.

yarn add @beemo/driver-eslint eslint eslint-config-airbnb

Create a file at configs/eslint.ts (or js) in which to house your ESLint configuration.

configs/eslint.ts
import { ESLintConfig } from '@beemo/driver-eslint';
const config: ESLintConfig = {
extends: ['airbnb'],
// ...
};
export default config;

Integration#

In your consuming project, enable the driver by adding eslint to your drivers config.

.config/beemo.ts
import { BeemoConfig } from '@beemo/core';
const config: BeemoConfig = {
module: '<config-module>',
drivers: ['eslint'],
};
export default config;

Ignoring paths#

Instead of using an .eslintignore dotfile, you can define an ignore property in your configuration module's configs/eslint.ts file, or a project's .config/beemo/eslint.ts file. This property accepts an array of strings. For example:

.eslintignore
lib/
*.min.js
*.map

Becomes...

.config/beemo/eslint.ts
import { ESLintConfig } from '@beemo/driver-eslint';
const config: ESLintConfig = {
// ...
ignore: ['lib/', '*.min.js', '*.map'],
};
export default config;

This feature follows the same configuration lifecycle as .eslintrc.js, with the added benefit of conditional logic, and being generated at runtime!