Skip to content

Inconsitent formatting for one specific line (always the same line) #5898

@jisuo

Description

@jisuo

Prettier 1.16.4
Playground link

# Options (if any):
{
  "arrowParens": "avoid",
  "bracketSpacing": true,
  "htmlWhitespaceSensitivity": "css",
  "insertPragma": false,
  "jsxBracketSameLine": false,
  "jsxSingleQuote": false,
  "parser": "babylon",
  "printWidth": 80,
  "proseWrap": "preserve",
  "requirePragma": false,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "useTabs": false
}

Input:

export const testComponent = {
  template,
  controller: class TestComponent {
    constructor($ngRedux) {
      'ngInject';

      this.unsubscribe = $ngRedux.connect(this.mapState, {})(this);
    }
    
    mapState(state) {
      return {
        test: state.test,
      };
    }
  }
}

Output:

export const testComponent = {
  template,
  controller: class TestComponent {
    constructor($ngRedux) {
      'ngInject';

      this.unsubscribe = $ngRedux.connect(this.mapState, {})(this);
    }
    
    mapState(state) {
      return {
        test: state.test,
      };
    }
  }
}

Expected behavior:

Using VS Code and using prettier-vscode extension 1.8.1 I get inconsistent results

sometimes this line:

this.unsubscribe = $ngRedux.connect(this.mapState, {})(this); is formatted exactly like that

sometimes it is formatted like this instead:

this.unsubscribe = $ngRedux.connect(
  this.mapState,
  {}
)(this);

The lines always has the same width and same indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:awaiting responseIssues that require answers to questions from maintainers before action can be taken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions