{"id":19971,"library":"eslint-plugin-use-macros","title":"ESLint Plugin Use Macros","description":"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.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/wantedly/frolint#master","tags":["javascript","eslint","eslint-plugin","eslintplugin"],"install":[{"cmd":"npm install eslint-plugin-use-macros","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-use-macros","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-use-macros","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; required for the plugin to function","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v4","wrong":"const useMacros = require('eslint-plugin-use-macros')","symbol":"default","correct":"import useMacros from 'eslint-plugin-use-macros'"},{"note":"Named export for accessing rule definitions directly","wrong":"const { rules } = require('eslint-plugin-use-macros')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-use-macros'"},{"note":"Available for flat config","wrong":null,"symbol":"configs","correct":"import { configs } from 'eslint-plugin-use-macros'"}],"quickstart":{"code":"import pluginUseMacros from 'eslint-plugin-use-macros';\n\nexport default [\n  {\n    plugins: {\n      'use-macros': pluginUseMacros,\n    },\n    rules: {\n      'use-macros/styled-components': 'error',\n      'use-macros/graphql-tag': 'error',\n    },\n  },\n];","lang":"typescript","description":"Flat ESLint configuration that enables both styled-components and graphql-tag macro rules."},"warnings":[{"fix":"Use import syntax instead of require(). Ensure your project is configured to support ES modules.","message":"ESM-only since version 4.0.0","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"List 'use-macros' first in the plugins array in flat config.","message":"Place the plugin before other plugins in the plugins array to avoid conflicts","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use only 'error' or 'warn' as severity; do not pass options object.","message":"Rule options are not supported; all rules are binary (error/warn/off)","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Migrate to flat config as shown in the README.","message":"Legacy config (.eslintrc) is deprecated and may be removed in future versions","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-plugin-use-macros --save-dev and ensure it is listed in plugins array","cause":"Plugin not installed or not correctly referenced in config","error":"ESLint couldn't find the plugin \"eslint-plugin-use-macros\""},{"fix":"Use dynamic import or switch to flat config with import","cause":"Using require() in an ESM context or missing default export","error":"Error: Plugin 'use-macros' was not found"},{"fix":"Remove options; rules only accept severity: 'error' or 'warn'","cause":"Attempting to pass options to use-macros rules","error":"A plugin is trying to access options, but flat config doesn't support it"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}