Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Member Ordering FixerNew to Visual Studio Code? Get it now.
Member Ordering Fixer

Member Ordering Fixer

Piotruch88

|
5 installs
| (0) | Free
Fix @typescript-eslint/member-ordering from in-memory TypeScript documents, with safe initializer relocation and a source action on save.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Member Ordering Fixer

Fix @typescript-eslint/member-ordering violations without reformatting the rest of your TypeScript file.

Member Ordering Fixer reads the effective ESLint configuration for each file and rearranges members of classes, class expressions, interfaces, and type literals to match it. The fixer is deterministic and uses the TypeScript AST—no AI service or global CLI installation is required.

Features

  • Run Member Ordering Fixer: ✨ Fix TypeScript Member Ordering by right-clicking inside a TypeScript editor.
  • Run the same command from an editor tab or from the Explorer for a file, multiple selections, or an entire directory.
  • Run member ordering through the standard VS Code editor.codeActionsOnSave setting.
  • Process the current in-memory document, including unsaved edits, without saving manual-command results automatically.
  • Save safe codeActionsOnSave fixes normally, while leaving a newly generated constructor as an unsaved change for review.
  • Use the effective ESLint configuration of the file, including per-file overrides.
  • Move unsafe field initializers into an existing or generated constructor, infer their types, and add a required Angular Signal type import.
  • Preserve comments, JSDoc, decorators, line endings, BOM, and the final newline.
  • Validate the generated TypeScript and the @typescript-eslint/member-ordering rule before applying changes.
  • Display processing details and errors in the Member Ordering Fixer Output channel.

Requirements

Your project must have an ESLint configuration that enables @typescript-eslint/member-ordering for the file being fixed. Both flat configuration (eslint.config.js, .mjs, .cjs, or .ts) and legacy .eslintrc* configuration are supported, subject to the ESLint version installed by the project.

The extension currently processes .ts files. It does not process .tsx, .mts, or .cts files.

Usage

Open a TypeScript file, right-click anywhere in its code, and select:

Member Ordering Fixer: ✨ Fix TypeScript Member Ordering

You can also right-click a .ts file or directory in Explorer. Directories are scanned recursively, and multi-selection is supported.

The command is also available from the Command Palette and the context menu of a TypeScript editor tab. When started from the Command Palette, it processes the active TypeScript file.

The command always uses the current in-memory document text, including unsaved edits. Its result is applied as an editor change and is not saved automatically; review it and save the affected files yourself.

Fix on save

The extension provides the source.fixAll.memberOrderingFixer source action. Add it to your user or workspace settings alongside any other save actions:

{
  "editor.codeActionsOnSave": {
    "source.organizeImports": "explicit",
    "source.fixAll.memberOrderingFixer": "explicit"
  }
}

On save, VS Code requests the action for the current in-memory TypeScript document. The fixer starts only when the VS Code Problems collection already contains an @typescript-eslint/member-ordering diagnostic for that document. It then checks the effective member-ordering configuration and validates the reordered result. A compliant file does not start the fixer worker.

When no constructor must be generated, the workspace edit remains part of the save operation and is saved normally. This includes fixes that do not move an initializer and fixes that reuse an existing constructor. If the fixer must generate a new constructor, it lets the current save finish first and then applies the validated fix, leaving the document dirty for review and a later manual save.

This diagnostic gate requires an ESLint integration that publishes the rule violation to VS Code Problems before the save begins. With the VS Code ESLint extension, keep validation enabled while typing; if ESLint is configured to validate only after saving, the new problem arrives too late for that same save action and will be handled on the next explicit save.

No extension-specific save setting is required.

What is preserved

The extension moves original source fragments rather than printing the entire AST again. This preserves formatting within members and keeps attached comments, JSDoc, and decorators with their declarations. It does not reorder imports or format unrelated code.

Before any result is returned, it is parsed by TypeScript and linted again; the change proceeds only when @typescript-eslint/member-ordering violations are gone. The manual command applies a WorkspaceEdit without saving the document. Other ESLint rules do not block the change.

When field initialization order creates a direct this.field dependency conflict, the fixer can move the conflicting initializer into the constructor and infer a missing field type with the TypeScript type checker. Calls, aliases, and dynamic property access are not treated as inferred dependencies.

The Member Ordering Fixer: Move Initializers To Constructor setting controls this behavior and is enabled by default. The fixer adds a constructor only when the class does not already have an implementation; otherwise it inserts the assignments into the existing constructor (after super(), when present).

Troubleshooting

Open View → Output and choose Member Ordering Fixer to see the file, discovered ESLint configuration, applied rule, member counts, validation result, and any error.

Common causes of failure are:

  • no ESLint configuration was found above the file;
  • no change is made because @typescript-eslint/member-ordering is missing or disabled for that file;
  • the project's ESLint configuration cannot be loaded by its installed ESLint version;
  • a TypeScript syntax or unsafe initializer dependency prevents a validated rewrite.

Development

npm install
npm run compile

Open the extenstion directory in VS Code and press F5 to launch an Extension Development Host. Run npx @vscode/vsce package to create a VSIX package.

The fixer algorithm and its runtime dependencies are bundled into the extension during compilation.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft