oxlint-plugin-jest-dom-rules
v0.1.0
Published
oxlint plugin for jest-dom — port of eslint-plugin-jest-dom
Downloads
139
Maintainers
Readme
oxlint-plugin-jest-dom-rules
oxlint plugin that ports all 11 auto-fixable rules from eslint-plugin-jest-dom.
Installation
npm install -D oxlint oxlint-plugin-jest-dom-rulesUsage
In your oxlint.config.js:
import jestDomPlugin from 'oxlint-plugin-jest-dom-rules'
export default {
plugins: { 'jest-dom': jestDomPlugin },
rules: {
'jest-dom/prefer-checked': 'warn',
'jest-dom/prefer-empty': 'warn',
'jest-dom/prefer-enabled-disabled': 'warn',
'jest-dom/prefer-focus': 'warn',
'jest-dom/prefer-in-document': 'warn',
'jest-dom/prefer-required': 'warn',
'jest-dom/prefer-to-have-attribute': 'warn',
'jest-dom/prefer-to-have-class': 'warn',
'jest-dom/prefer-to-have-style': 'warn',
'jest-dom/prefer-to-have-text-content': 'warn',
'jest-dom/prefer-to-have-value': 'warn',
},
}Rules
All rules are auto-fixable — run oxlint --fix to apply.
| Rule | What it enforces |
|------|-----------------|
| jest-dom/prefer-checked | Use toBeChecked() instead of .checked |
| jest-dom/prefer-empty | Use toBeEmpty() instead of .innerHTML === '' |
| jest-dom/prefer-enabled-disabled | Use toBeDisabled()/toBeEnabled() instead of .disabled |
| jest-dom/prefer-focus | Use toHaveFocus() instead of document.activeElement |
| jest-dom/prefer-in-document | Use toBeInTheDocument() instead of not.toBeNull() |
| jest-dom/prefer-required | Use toBeRequired() instead of .required |
| jest-dom/prefer-to-have-attribute | Use toHaveAttribute() instead of getAttribute() |
| jest-dom/prefer-to-have-class | Use toHaveClass() instead of classList.contains() |
| jest-dom/prefer-to-have-style | Use toHaveStyle() instead of .style.* |
| jest-dom/prefer-to-have-text-content | Use toHaveTextContent() instead of .textContent |
| jest-dom/prefer-to-have-value | Use toHaveValue() instead of .value |
License
MIT
