Registry / testing / eslint-plugin-use-macros

eslint-plugin-use-macros

JSON →
library4.0.1jsnpmunverified

ESLint plugin that enforces the use of babel macros for specific libraries like styled-components and graphql-tag. Version 4.0.1, released as part of the frolint monorepo. Primarily used to automatically detect and correct imports from styled-components and graphql-tag to their macro equivalents. Differentiator: simple, focused rules for a common refactoring pattern; maintained by Wantedly.

npm install eslint-plugin-use-macros
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-USE-
E
eslint-plugin-use-macros
testingjavascriptv4.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import useMacros from 'eslint-plugin-use-macros'
const useMacros = require('eslint-plugin-use-macros')
ESM-only since v4
rules
import { rules } from 'eslint-plugin-use-macros'
const { rules } = require('eslint-plugin-use-macros')
Named export for accessing rule definitions directly
configs
import { configs } from 'eslint-plugin-use-macros'
Available for flat config

Flat ESLint configuration that enables both styled-components and graphql-tag macro rules.

import pluginUseMacros from 'eslint-plugin-use-macros'; export default [ { plugins: { 'use-macros': pluginUseMacros, }, rules: { 'use-macros/styled-components': 'error', 'use-macros/graphql-tag': 'error', }, }, ];
Debug
Known issues
breakingESM-only since version 4.0.0
fix
Use import syntax instead of require(). Ensure your project is configured to support ES modules.
affects: >=4.0.0
gotchaPlace the plugin before other plugins in the plugins array to avoid conflicts
fix
List 'use-macros' first in the plugins array in flat config.
affects: >=0.0.0
gotchaRule options are not supported; all rules are binary (error/warn/off)
fix
Use only 'error' or 'warn' as severity; do not pass options object.
affects: >=0.0.0
deprecatedLegacy config (.eslintrc) is deprecated and may be removed in future versions
fix
Migrate to flat config as shown in the README.
affects: >=4.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-use-macros"
Plugin not installed or not correctly referenced in config
fix
npm install eslint-plugin-use-macros --save-dev and ensure it is listed in plugins array
Error: Plugin 'use-macros' was not found
Using require() in an ESM context or missing default export
fix
Use dynamic import or switch to flat config with import
A plugin is trying to access options, but flat config doesn't support it
Attempting to pass options to use-macros rules
fix
Remove options; rules only accept severity: 'error' or 'warn'
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; required for the plugin to function
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-use-macros — npm install eslint-plugin-use-macros · libregistry