Skip to content

Linting ​

Install the ESLint plugin eslint-plugin-warp-drive

sh
pnpm add -E eslint-plugin-warp-drive@latest
sh
npm add -E eslint-plugin-warp-drive@latest
sh
yarn add -E eslint-plugin-warp-drive@latest
sh
bun add --exact eslint-plugin-warp-drive@latest

Rules ​

See the API docs for eslint-plugin-warp-drive

Template Rules ​

Template rules operate on the Glimmer template AST rather than the JS/TS AST. They require ember-eslint-parser (a dependency of eslint-plugin-warp-drive) to be configured as the parser for the files being linted, since that's what exposes template nodes to ESLint as Glimmer-prefixed selectors (e.g. GlimmerElementNode) for .gjs/.gts files, or ember-eslint-parser/hbs for classic .hbs files. This mirrors the approach eslint-plugin-ember uses for its own template-* rules, and the direction laid out in the First-Class Component Templates RFC for integrating template linting into ESLint.

React Rules ​

React rules operate on the JSX AST rather than the JS/TS AST or the Glimmer template AST used by the rules above. They don't require any special parser dependency beyond enabling JSX parsing -- ESLint's default parser (or @typescript-eslint/parser for .tsx files) already exposes plain JSX*-prefixed selectors (e.g. JSXElement, JSXOpeningElement) once parserOptions.ecmaFeatures.jsx is enabled.

Usage ​

Recommended Rules are available as a flat config for easy consumption:

ts
// eslint.config.js (flat config)
const WarpDriveRecommended = require('eslint-plugin-warp-drive/recommended');
const WarpDriveTemplateRecommended = require('eslint-plugin-warp-drive/recommended-templates');
const WarpDriveReactRecommended = require('eslint-plugin-warp-drive/recommended-react');

module.exports = [
  ...WarpDriveRecommended,
  ...WarpDriveTemplateRecommended,
  ...WarpDriveReactRecommended,
];

Released under the MIT License.