Registry / testing / eslint-plugin-decorator-position

eslint-plugin-decorator-position

JSON →
library6.1.0jsnpmunverified

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.

npm install eslint-plugin-decorator-position
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-DECO
E
eslint-plugin-decorator-position
testingjavascriptv6.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

plugin (default)
✓ import plugin from 'eslint-plugin-decorator-position'
✗ const plugin = require('eslint-plugin-decorator-position')
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').
rules
✓ import { rules } from 'eslint-plugin-decorator-position'
✗ const { rules } = require('eslint-plugin-decorator-position')
Named export; not available as a default property. Use for custom rule configuration.
configs (flat)
✓ import recommended from 'eslint-plugin-decorator-position/config/recommended'
✗ import recommended from 'eslint-plugin-decorator-position/config/recommended.js'
Config paths for flat configs are under /config/. Do not append .js extension; Node ESM resolves correctly.
ember (legacy config)
✓ module.exports = { extends: ['plugin:decorator-position/ember'] }
✗ module.exports = { extends: ['plugin:decorator-position/config-legacy/ember'] }
Legacy configs use the 'plugin:' prefix with the config name (e.g., /ember). Direct path import is for flat configs only.

Flat config setup with recommended preset, Babel parser, and custom printWidth.

// eslint.config.js import plugin from 'eslint-plugin-decorator-position'; import recommended from 'eslint-plugin-decorator-position/config/recommended'; import babelParser from '@babel/eslint-parser'; export default [ ...recommended, { languageOptions: { parser: babelParser, parserOptions: { requireConfigFile: false, babelOptions: { plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]], }, }, }, rules: { 'decorator-position/decorator-position': ['error', { printWidth: 100 }], }, }, ];
Debug
Known issues
breakingESLint 6 compatibility dropped. Plugin v6 requires ESLint >=7.
fix
Upgrade ESLint to version 7 or later (8/9/10 supported).
affects: >=6.0.0
breakingNode.js <12 support dropped. Plugin v3+ requires Node >=12.
fix
Upgrade Node.js to version 12 or higher.
affects: >=3.0.0
breakingESM-only plugin exports starting in v6.0.0. CommonJS require() fails with 'ERR_REQUIRE_ESM'.
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.
affects: >=6.0.0
deprecatedLegacy configs (e.g., 'plugin:decorator-position/ember') are deprecated in favor of flat configs.
fix
Migrate to flat config using 'eslint-plugin-decorator-position/config/recommended'.
affects: >=6.0.0
gotchaWhen 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.
fix
Set 'decorator-position/decorator-position': ['error', { printWidth: 100 }] and matching printWidth in prettier/prettier rule.
affects: >=5.0.0
gotchaThe package always requires '@babel/eslint-parser' as parser; '@typescript-eslint/parser' is only partially supported and may cause false positives for TypeScript decorators.
fix
Use @babel/eslint-parser with @babel/plugin-proposal-decorators. For TypeScript, ensure babelOptions are set accordingly.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module .../eslint-plugin-decorator-position/index.js from ... not supported.
Using CommonJS require() on the ESM-only v6+ entry point.
fix
Use import() or switch to ESM. For legacy configs, use 'eslint-plugin-decorator-position/config-legacy/ember' which is still CJS.
ESLint configuration error: Cannot find module 'eslint-plugin-decorator-position/config/recommended'
Importing with .js extension or wrong path for flat config.
fix
Use 'eslint-plugin-decorator-position/config/recommended' (no .js). Ensure package is installed.
Parsing error: Unexpected character '@'
Parser is not configured to handle decorators (missing @babel/eslint-parser or plugin).
fix
Set parser to '@babel/eslint-parser' and add '@babel/plugin-proposal-decorators' with legacy: true in parserOptions.
Rule "decorator-position/decorator-position" was not found.
Plugin not loaded or misconfigured in legacy eslintrc format.
fix
Ensure plugins array includes 'decorator-position' and rules are prefixed correctly. For flat config, add the plugin object.
Upgrade
Version history
6.1.0latest on npm
Audit
Dependencies
@babel/eslint-parseroptionalRequired as parser in most configs to support decorator syntax; commonly used with @babel/plugin-proposal-decorators.
eslintoptionalPeer dependency, required to run the plugin; version 7 or higher (8, 9, 10 supported).
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-decorator-position — npm install eslint-plugin-decorator-position · libregistry