Member Ordering FixerFix 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
RequirementsYour project must have an ESLint configuration that enables The extension currently processes UsageOpen a TypeScript file, right-click anywhere in its code, and select:
You can also right-click a 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 saveThe extension provides the
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 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 preservedThe 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 When field initialization order creates a direct 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 TroubleshootingOpen 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:
Development
Open the The fixer algorithm and its runtime dependencies are bundled into the extension during compilation. |