eslint-plugin-smarthr

raw JSON →
6.13.0 verified Sat Apr 25 auth: no javascript

A sharable ESLint plugin for SmartHR applications, providing a comprehensive set of accessibility (a11y), best-practice, and import-related lint rules. Version 6.13.0 is the latest stable, released in April 2026. Developed by KUFU (tamatebako), it includes auto-fixers for SmartHR UI migrations (e.g., v91→v92, v92→v93), barrel import enforcement, and over 30 rules. Requires ESLint 9 (peer dependency). Differentiates from generic eslint plugins by being specifically tailored to SmartHR's design system and conventions, with active maintenance (multiple releases per month) and a focus on accessibility and migration assistance.

error ESLint couldn't find the plugin 'eslint-plugin-smarthr'.
cause Plugin not installed or not in node_modules.
fix
Run: npm install --save-dev eslint-plugin-smarthr
error Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
cause Using require() to load the plugin (CommonJS).
fix
Change to import statement in an ES module: import smarthr from 'eslint-plugin-smarthr'
error Configuration for rule 'smarthr/a11y-anchor-has-href-attribute' is invalid: unknown rule.
cause Rule name misspelled or not defined in the plugin version.
fix
Check rule name in the plugin documentation. Example: 'smarthr/a11y-anchor-has-href-attribute' (note hyphenation).
breaking ESLint 9 peer dependency: eslint-plugin-smarthr v6 requires ESLint 9. Older ESLint versions (8.x) are not supported.
fix Upgrade ESLint to ^9.0.0 or use eslint-plugin-smarthr v5 if ESLint 8 is required.
breaking Flat config only: v6+ no longer supports .eslintrc config format. Using 'extends' in .eslintrc will not work.
fix Migrate to flat config using eslint.config.js. See quickstart example.
deprecated Rule 'a11y-delegate-element-has-role-presentation' removed in v14 of config (plugin still present).
fix Replace with 'best-practice-for-interactive-element' rule.
gotcha CommonJS require does not work: the plugin is ESM-only. Using require('eslint-plugin-smarthr') throws an error.
fix Use import syntax in an ES module (type: 'module' in package.json or .mjs extension).
gotcha Rule names are strings with 'smarthr/' prefix; direct named imports like import { a11yAnchorHasHrefAttribute } are not available.
fix Reference rules in config as 'smarthr/rule-name'.
npm install eslint-plugin-smarthr
yarn add eslint-plugin-smarthr
pnpm add eslint-plugin-smarthr

Shows how to install and configure eslint-plugin-smarthr using flat config, including recommended rules and custom rule settings.

// Install: npm install --save-dev eslint eslint-plugin-smarthr

// eslint.config.js (flat config)
import smarthr from 'eslint-plugin-smarthr'

export default [
  {
    ignores: ['dist/', 'node_modules/'],
  },
  ...smarthr.configs.recommended,
  {
    plugins: { smarthr },
    rules: {
      'smarthr/a11y-anchor-has-href-attribute': 'error',
      'smarthr/require-barrel-import': ['error', { additionalBarrelFileNames: ['index.ts'] }],
    },
  },
]

// Then run: npx eslint .