{"id":19721,"library":"eslint-plugin-decorator-position","title":"eslint-plugin-decorator-position","description":"ESLint plugin that enforces consistent positioning of decorators (e.g., same line vs. new line before the target). Current stable version is 6.1.0 (released 2026-04-16) with minor updates adding ESLint 10 support and bundled TypeScript typings. Maintained by NullVoxPopuli, with frequent releases (~monthly) and support for ESLint 7, 8, 9, and 10. Key differentiator: provides both flat configs and legacy configs tailored for Ember projects, integrates with Prettier, and is the only dedicated decorator-position linter. Requires @babel/eslint-parser as a parser.","status":"active","version":"6.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/NullVoxPopuli/eslint-plugin-decorator-position","tags":["javascript","eslint","ember","ember.js","plugin","styleguide","rules","decorators"],"install":[{"cmd":"npm install eslint-plugin-decorator-position","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-decorator-position","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-decorator-position","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as parser in most configs to support decorator syntax; commonly used with @babel/plugin-proposal-decorators.","package":"@babel/eslint-parser","optional":true},{"reason":"Peer dependency, required to run the plugin; version 7 or higher (8, 9, 10 supported).","package":"eslint","optional":true}],"imports":[{"note":"ESM-only since v6.0.0; if using CommonJS, use dynamic import or use legacy config paths (e.g., 'eslint-plugin-decorator-position/config-legacy/ember').","wrong":"const plugin = require('eslint-plugin-decorator-position')","symbol":"plugin (default)","correct":"import plugin from 'eslint-plugin-decorator-position'"},{"note":"Named export; not available as a default property. Use for custom rule configuration.","wrong":"const { rules } = require('eslint-plugin-decorator-position')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-decorator-position'"},{"note":"Config paths for flat configs are under /config/. Do not append .js extension; Node ESM resolves correctly.","wrong":"import recommended from 'eslint-plugin-decorator-position/config/recommended.js'","symbol":"configs (flat)","correct":"import recommended from 'eslint-plugin-decorator-position/config/recommended'"},{"note":"Legacy configs use the 'plugin:' prefix with the config name (e.g., /ember). Direct path import is for flat configs only.","wrong":"module.exports = { extends: ['plugin:decorator-position/config-legacy/ember'] }","symbol":"ember (legacy config)","correct":"module.exports = { extends: ['plugin:decorator-position/ember'] }"}],"quickstart":{"code":"// eslint.config.js\nimport plugin from 'eslint-plugin-decorator-position';\nimport recommended from 'eslint-plugin-decorator-position/config/recommended';\nimport babelParser from '@babel/eslint-parser';\n\nexport default [\n  ...recommended,\n  {\n    languageOptions: {\n      parser: babelParser,\n      parserOptions: {\n        requireConfigFile: false,\n        babelOptions: {\n          plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],\n        },\n      },\n    },\n    rules: {\n      'decorator-position/decorator-position': ['error', { printWidth: 100 }],\n    },\n  },\n];","lang":"javascript","description":"Flat config setup with recommended preset, Babel parser, and custom printWidth."},"warnings":[{"fix":"Upgrade ESLint to version 7 or later (8/9/10 supported).","message":"ESLint 6 compatibility dropped. Plugin v6 requires ESLint >=7.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade Node.js to version 12 or higher.","message":"Node.js <12 support dropped. Plugin v3+ requires Node >=12.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use dynamic import() in CommonJS, or switch to ESM. Alternatively, import legacy configs from 'eslint-plugin-decorator-position/config-legacy/ember' which remain CJS.","message":"ESM-only plugin exports starting in v6.0.0. CommonJS require() fails with 'ERR_REQUIRE_ESM'.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Migrate to flat config using 'eslint-plugin-decorator-position/config/recommended'.","message":"Legacy configs (e.g., 'plugin:decorator-position/ember') are deprecated in favor of flat configs.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Set 'decorator-position/decorator-position': ['error', { printWidth: 100 }] and matching printWidth in prettier/prettier rule.","message":"When using with Prettier, printWidth must be explicitly set in the decorator-position rule if not using a .prettierrc.js file; otherwise lint results may conflict with prettier/prettier rule.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Use @babel/eslint-parser with @babel/plugin-proposal-decorators. For TypeScript, ensure babelOptions are set accordingly.","message":"The package always requires '@babel/eslint-parser' as parser; '@typescript-eslint/parser' is only partially supported and may cause false positives for TypeScript decorators.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import() or switch to ESM. For legacy configs, use 'eslint-plugin-decorator-position/config-legacy/ember' which is still CJS.","cause":"Using CommonJS require() on the ESM-only v6+ entry point.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module .../eslint-plugin-decorator-position/index.js from ... not supported."},{"fix":"Use 'eslint-plugin-decorator-position/config/recommended' (no .js). Ensure package is installed.","cause":"Importing with .js extension or wrong path for flat config.","error":"ESLint configuration error: Cannot find module 'eslint-plugin-decorator-position/config/recommended'"},{"fix":"Set parser to '@babel/eslint-parser' and add '@babel/plugin-proposal-decorators' with legacy: true in parserOptions.","cause":"Parser is not configured to handle decorators (missing @babel/eslint-parser or plugin).","error":"Parsing error: Unexpected character '@'"},{"fix":"Ensure plugins array includes 'decorator-position' and rules are prefixed correctly. For flat config, add the plugin object.","cause":"Plugin not loaded or misconfigured in legacy eslintrc format.","error":"Rule \"decorator-position/decorator-position\" was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}