{"id":15537486,"url":"https://github.com/nullvoxpopuli/eslint-plugin-decorator-position","last_synced_at":"2025-05-16T11:05:08.450Z","repository":{"id":37030004,"uuid":"249245166","full_name":"NullVoxPopuli/eslint-plugin-decorator-position","owner":"NullVoxPopuli","description":"ESLint plugin for enforcing decorator position","archived":false,"fork":false,"pushed_at":"2025-05-12T03:26:19.000Z","size":3225,"stargazers_count":52,"open_issues_count":15,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-16T11:04:59.812Z","etag":null,"topics":["decorators","eslint","eslint-plugin","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NullVoxPopuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-22T18:19:26.000Z","updated_at":"2025-05-11T23:03:38.000Z","dependencies_parsed_at":"2023-09-21T18:49:49.421Z","dependency_job_id":"3a9add91-6611-4108-a1ba-3bcb5d414408","html_url":"https://github.com/NullVoxPopuli/eslint-plugin-decorator-position","commit_stats":{"total_commits":720,"total_committers":17,"mean_commits":42.35294117647059,"dds":0.5027777777777778,"last_synced_commit":"2cdb1a5ddd9eed0b3948807d48533f229e554fa7"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Feslint-plugin-decorator-position","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Feslint-plugin-decorator-position/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Feslint-plugin-decorator-position/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Feslint-plugin-decorator-position/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NullVoxPopuli","download_url":"https://codeload.github.com/NullVoxPopuli/eslint-plugin-decorator-position/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518384,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decorators","eslint","eslint-plugin","hacktoberfest"],"created_at":"2024-10-02T11:57:40.420Z","updated_at":"2025-05-16T11:05:03.435Z","avatar_url":"https://github.com/NullVoxPopuli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-decorator-position\n\n[![NPM version](https://img.shields.io/npm/v/eslint-plugin-decorator-position.svg?style=flat)](https://npmjs.org/package/eslint-plugin-decorator-position)\n[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-decorator-position.svg?style=flat)](https://npmjs.org/package/eslint-plugin-decorator-position)\n\n\u003e An ESlint plugin that provides set of rules enforcing consistent decorator positions\n\n## ❗️Requirements\n\n- [ESLint](https://eslint.org/) `\u003e= 6`\n- [Node.js](https://nodejs.org/) `\u003e= 12`\n\n## 🚀 Usage\n\n### 1. Install plugin\n\n```shell\npnpm add -D eslint-plugin-decorator-position\n```\n\nOr\n\n```shell\nyarn add --dev eslint-plugin-decorator-position\n```\n\nOr\n\n```shell\nnpm install --save-dev eslint-plugin-decorator-position\n```\n\n### 2. Modify your eslint config\n\nFor modern 'flat config', append the eslint-plugin-decorator-position config to your `eslint.config.js` file:\n\n```diff\nmodule.exports = [\n+ ...require('eslint-plugin-decorator-position/config/recommended'),\n  {\n    languageOptions: {\n      parser: require('@babel/eslint-parser'),\n      parserOptions: {\n        requireConfigFile: false,\n        babelOptions: {\n          plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],\n        },\n      },\n    },\n  },\n];\n```\n\nOr for the legacy eslint config format, extend the base config provided by eslint-plugin-decorator-position:\n\n```javascript\n// .eslintrc.js\nmodule.exports = {\n  parser: '@babel/eslint-parser',\n  // parser: '@typescript-eslint/parser',\n  plugins: ['decorator-position'],\n  extends: [\n    'plugin:decorator-position/ember' // or other configuration\n  ],\n  rules: {\n    // override rule settings from extends config here\n    // 'decorator-position/decorator-position': ['error', { /* your config */ }]\n  }\n};\n```\n\n### 3. Using with Prettier\n\nSince eslint 8, the printWidth option must be specified to be compatible\nwith the eslint-plugin-prettier rule `prettier/prettier`\n\n```diff\n// eslint.config.js\nmodule.exports = [\n  ...require('eslint-plugin-decorator-position/config/recommended'),\n  {\n    languageOptions: {\n      parser: require('@babel/eslint-parser'),\n      parserOptions: {\n        requireConfigFile: false,\n        babelOptions: {\n          plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],\n        },\n      },\n    },\n  },\n+ rules: {\n+   'decorator-position/decorator-position': ['error', { printWidth: 100 }],\n+   'prettier/prettier': ['error', { printWidth: 100 }]\n+ }\n]\n```\n\nor\n\n```javascript\n// .eslintrc.js\nmodule.exports = {\n  parser: '@babel/eslint-parser',\n  plugins: ['decorator-position'],\n  extends: [\n    'plugin:decorator-position/ember' // or other configuration\n  ],\n  rules: {\n    'decorator-position/decorator-position': ['error', { printWidth: 100 }],\n    'prettier/prettier': ['error', { printWidth: 100 }]\n  }\n};\n```\n\nIf there is a `.prettierrc.js` file, that will be read instead, and `printwidth` is not needed.\n\n## 🧰 Configurations\n\n'Flat' configurations:\n|    | Name | Description |\n|:---|:-----|:------------|\n| | [`/config/base`](./lib/config/base.js) | Only installs the plugin. You can use it to configure rules as you wish. |\n| | [`/config/rules`](./lib/config/rules.js) | Only configures the rules. Expects the plugin to be installed. |\n| | [`/config/recommended`](./lib/config/recommended.js) | Installs the plugin and configures the rules |\n\nLegacy configurations:\n|    | Name | Description |\n|:---|:-----|:------------|\n| | [base](./lib/config-legacy/base.js) | contains no rules settings, but the basic eslint configuration suitable for any project. You can use it to configure rules as you wish. |\n| :hamster: | [ember](./lib/config-legacy/ember.js) | extends the `base` configuration by enabling the recommended rules for ember projects. |\n\n## Manual plugin installation\n\nIf you prefer to manage the config yourself, the plugin can be installed like this:\n\n```diff\n// eslint.config.js\nmodule.exports = [\n  // ... your existing config\n  plugins: {\n+   \"decorator-position\": require(\"eslint-plugin-decorator-position\"),\n  },\n  rules: {\n+   'decorator-position/decorator-position': 'error',\n  }\n]\n```\n\n## 🍟 Rules\n\nRules are grouped by category to help you understand their purpose. Each rule has emojis denoting:\n\n- What configuration it belongs to\n- :wrench: if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option\n\n\u003c!--RULES_TABLE_START--\u003e\n\n### Style\n\n|    | Rule ID | Description |\n|:---|:--------|:------------|\n| :white_check_mark::wrench: | [decorator-position](./docs/rules/decorator-position.md) | enforce consistent decorator position on properties and methods |\n\n\u003c!--RULES_TABLE_END--\u003e\n\nFor the simplified list of rules, [go here](./lib/index.js).\n\n## 🍻 Contribution Guide\n\nIf you have any suggestions, ideas, or problems, feel free to [create an issue](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/new), but first please make sure your question does not repeat [previous ones](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues).\n\n### Creating a New Rule\n\n- [Create an issue](https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/new) with a description of the proposed rule\n- Create files for the [new rule](https://eslint.org/docs/developer-guide/working-with-rules):\n  - `lib/rules/new-rule.js` (implementation, see [no-proxies](lib/rules/no-proxies.js) for an example)\n  - `docs/rules/new-rule.md` (documentation, start from the template -- [raw](https://raw.githubusercontent.com/NullVoxPopuli/eslint-plugin-decorator-position/master/docs/rules/_TEMPLATE_.md), [rendered](docs/rules/_TEMPLATE_.md))\n  - `tests/lib/rules/new-rule.js` (tests, see [no-proxies](tests/lib/rules/no-proxies.js) for an example)\n- Run `yarn update` to automatically update the README and other files (and re-run this if you change the rule name or description)\n- Make sure your changes will pass [CI](.travis.yml) by running:\n  - `yarn test`\n  - `yarn lint` (`yarn lint:js --fix` can fix many errors)\n- Create a PR and link the created issue in the description\n\nNote that new rules should not immediately be added to the [recommended](./lib/recommended-rules.js) configuration, as we only consider such breaking changes during major version updates.\n\n### Running smoke tests and creating reproductions\n\nTo run smoke tests:\n\n```shell\n./scripts/smoke-test.sh\n```\n\nit will prompt you with which test to run.\n\nTo create a reproduction,\n\n1. first make sure there is an open issue describing the problem your encountering.\n2. then create a folder in `smoke-tests/issue-reproductions/` named ofter the issue number.\n   example: `smoke-tests/issue-reproductions/196/`\n3. The minimum required files are:\n   - package.json - for declaring which dependencies are being tested (or `*` if it doesn't matter for your particular test)\n   - a js or ts file to demonstrate the \"correct\" state. After a smoke-test runs, a git diff is checked to ensure 0 changes.\n   - .eslintrc.js - to define what configuration / rules / plugins / etc may be relevant.\n\n## SemVer Policy\n\nHow does this project interpret patch / minor / breaking changes?\n\n- **patch**: a change that fixes currently broken behavior. Does not cause formatting to change when people update unless a previous patch/feature accidentally broke formatting in a **breaking** way.\n- **minor**: a change that does not impact formatting\n- **breaking**: a major change that is not backwards compatible and would intentionally cause formatting changes to occur\n\n## 🔓 License\n\nSee the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullvoxpopuli%2Feslint-plugin-decorator-position","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullvoxpopuli%2Feslint-plugin-decorator-position","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullvoxpopuli%2Feslint-plugin-decorator-position/lists"}