{"id":15067512,"url":"https://github.com/ducktordanny/eslint-plugin-ng-module-sort","last_synced_at":"2025-04-10T14:22:30.225Z","repository":{"id":152600694,"uuid":"625710024","full_name":"ducktordanny/eslint-plugin-ng-module-sort","owner":"ducktordanny","description":"Sort Angular and NestJS module imports, declarations, exports, controls, etc.","archived":false,"fork":false,"pushed_at":"2024-06-17T20:52:17.000Z","size":80,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T13:04:42.014Z","etag":null,"topics":["angular","angular-eslint","angular2","eslint","eslint-plugin","eslint-rule","eslint-rules","nestjs","sort"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-plugin-ng-module-sort","language":"TypeScript","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/ducktordanny.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-04-09T23:46:03.000Z","updated_at":"2024-07-26T16:40:46.000Z","dependencies_parsed_at":"2024-06-15T12:23:41.839Z","dependency_job_id":"344b7b29-f610-4a37-a71e-ec5dbfee92c7","html_url":"https://github.com/ducktordanny/eslint-plugin-ng-module-sort","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducktordanny%2Feslint-plugin-ng-module-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducktordanny%2Feslint-plugin-ng-module-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducktordanny%2Feslint-plugin-ng-module-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducktordanny%2Feslint-plugin-ng-module-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ducktordanny","download_url":"https://codeload.github.com/ducktordanny/eslint-plugin-ng-module-sort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233935,"owners_count":21069493,"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":["angular","angular-eslint","angular2","eslint","eslint-plugin","eslint-rule","eslint-rules","nestjs","sort"],"created_at":"2024-09-25T01:24:31.209Z","updated_at":"2025-04-10T14:22:30.207Z","avatar_url":"https://github.com/ducktordanny.png","language":"TypeScript","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Linting"],"readme":"# eslint-plugin-ng-module-sort\n\n\u003e Sort Angular and NestJS module imports, declarations, exports, controls, etc. Make it easier to find modules in the arrays by having an auto sort.\n\n## Installation\n\n[![NPM](https://img.shields.io/npm/v/eslint-plugin-ng-module-sort.svg)](https://www.npmjs.com/package/eslint-plugin-ng-module-sort)\n\nYou'll first need to install [ESLint](https://eslint.org/):\n\n```sh\nnpm i eslint --save-dev\n```\n\nNext, install `eslint-plugin-ng-module-sort`:\n\n```sh\nnpm install eslint-plugin-ng-module-sort --save-dev\n```\n\n## Usage\n\nAdd `ng-module-sort` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:\n\n```json\n{\n  \"plugins\": [\"ng-module-sort\"]\n}\n```\n\nThen configure the rules you want to use under the rules section.\n\n## Rules\n\n### decorator-array-items\n\nWith this rule you can detect unsorted arrays of imports, declarations, providers, exports, controllers and bootstrap in the following Angular and NestJS decorators:\n\n- NgModule\n- Component\n- Pipe\n- Decorator\n- Module\n\n```json\n{\n  \"rules\": {\n    \"ng-module-sort/decorator-array-items\": [\n      \"error\",\n      {\n        \"reverseSort\": false,\n        \"extraDecorators\": [],\n        \"extraProperties\": []\n      }\n    ]\n  }\n}\n```\n\nA few example of it:\n\n- Error\n\n```ts\nimport {Component} from '@angular/core';\n\n@Component({\n  selector: 'app-example',\n  template: '',\n  standalone: true,\n  imports: [ // Run `eslint --fix .` to sort the members of imports.\n    MatButtonModule,\n    SharedModule,\n    CommonModule,\n    MagicComponent,\n  ],\n})\n```\n\n- Fix with default options\n\n```ts\nimport {Component} from '@angular/core';\n\n@Component({\n  selector: 'app-example',\n  template: '',\n  standalone: true,\n  imports: [\n    CommonModule,\n    MagicComponent,\n    MatButtonModule,\n    SharedModule,\n  ],\n})\n```\n\n- With option `\"reverseSort\": true`\n\n```ts\nimport {Component} from '@angular/core';\n\n@Component({\n  selector: 'app-example',\n  template: '',\n  standalone: true,\n  imports: [\n    SharedModule,\n    MatButtonModule,\n    MagicComponent,\n    CommonModule,\n  ],\n})\n```\n\n- By using options `extraDecorator: ['YourDecorators']` and `extraProperties: ['yourProperties']` you can extend the default list that is used for the checks.\n\n```ts\nimport {Component} from '@angular/core';\n\n@YourDecorators({\n  yourProperties: [\n    Apple,\n    Banana,\n    Paprika,\n    SomethingElse,\n  ],\n})\n```\n\nThe default options can be found [here](./lib/constants.ts).\n\n### decorator-properties\n\nThis rule is still in progress, but basically it will check if the properties in the above decorators are sorted, and provide an autofix to sort them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducktordanny%2Feslint-plugin-ng-module-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fducktordanny%2Feslint-plugin-ng-module-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducktordanny%2Feslint-plugin-ng-module-sort/lists"}