eslint-plugin-gamut
raw JSON → 2.4.3 verified Sat Apr 25 auth: no javascript
ESLint plugin for Codecademy's Gamut design system, version 2.4.3 (stable, maintained). Provides rules and configurations tailored for Gamut applications, enforcing best practices for gamut-styles, gamut-icons, and other Codecademy libraries. Ships with TypeScript definitions. Part of the larger Gamut monorepo with regular releases. Differentiators: built-in presets for Gamut-specific patterns, seamless integration with Codecademy's design system.
Common errors
error Error: Failed to load plugin 'gamut' declared in '.eslintrc': Cannot find module 'eslint-plugin-gamut' ↓
cause Plugin not installed or ESLint cannot resolve it.
fix
Run
npm install eslint-plugin-gamut --save-dev and ensure node_modules is present. error TypeError: plugin.rules is not an iterable ↓
cause Using CJS `require` on an ESM-only package without default interop.
fix
Use
const plugin = require('eslint-plugin-gamut').default; or switch to ESM imports. error ESLint: 'plugin:gamut/recommended' configuration is deprecated. Use 'extends: ['eslint-plugin-gamut/configs/recommended']'. ↓
cause Old string-based extends syntax no longer supported since v2.3.0.
fix
Use the config object:
extends: [require('eslint-plugin-gamut').configs.recommended] or the new plugin prefix syntax: 'plugin:gamut/recommended' if supported. Warnings
breaking In v2, the plugin switched from CommonJS to ESM-only exports. Requires ESLint 8+ with ESM support or bundler. ↓
fix Update ESLint to 8+ and set `type: 'module'` in package.json, or use a bundler that handles ESM. For CJS projects, use dynamic import.
breaking Removed support for deprecated gamut-styles v16 rules. Existing configurations referencing v16-specific rules will break. ↓
fix Update to gamut-styles v17 and adjust rules accordingly. Remove or replace any rules targeting gamut-styles v16.
deprecated Rule `gamut/no-deprecated-gamut-illustrations` is deprecated in favor of a more general rule covering all deprecated Gamut assets. ↓
fix Replace with `gamut/no-deprecated-assets` and update the configuration.
Install
npm install eslint-plugin-gamut yarn add eslint-plugin-gamut pnpm add eslint-plugin-gamut Imports
- plugin wrong
const plugin = require('eslint-plugin-gamut')correctimport plugin from 'eslint-plugin-gamut' - configs wrong
import configs from 'eslint-plugin-gamut/configs'correctimport { configs } from 'eslint-plugin-gamut' - rules wrong
import rules from 'eslint-plugin-gamut/rules'correctimport { rules } from 'eslint-plugin-gamut' - configs.recommended wrong
import configs from 'eslint-plugin-gamut/recommended'correctimport { configs } from 'eslint-plugin-gamut'; // use configs.recommended
Quickstart
// .eslintrc.js
module.exports = {
plugins: ['gamut'],
extends: ['plugin:gamut/recommended'],
rules: {
'gamut/no-deprecated-gamut-components': 'error',
},
};