prettier / tslint-config-prettier

Use TSLint with Prettier without any conflict

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

curly rule is not disabled

rhys-vdw opened this issue · comments

I just added prettier + tslint-config-prettier to our project and am getting loads of curly rule violations:

Errors:

ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/delete-response-modal/index.tsx[73, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/form/text-input/index.tsx[25, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/form/text-input/index.tsx[26, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/hitzone-editor/index.tsx[200, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/hitzone-editor/index.tsx[221, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/routes/test-form/question/question-option.tsx[24, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/routes/test-form/question/question.tsx[51, 5]: if statements must be braced
ERROR: /Users/rhys/Projects/usability-hub/usability_hub/app/assets/javascripts/components/routes/test-form/screenshots/screenshot-field.tsx[49, 5]: if statements must be braced
...

Config:

{
  "extends": [
    "tslint:recommended",
    // "tslint-eslint-rules", -- just turned these off for testing
    // "tslint-react",
    "tslint-config-prettier"
  ],
  "defaultSeverity": "error",
  "rules": {
    "interface-name": false,
    "jsx-boolean-value": [true, "never"],
    "max-classes-per-file": false,
    "member-access": [true, "no-public"],
    "member-ordering": [true, {
      "order": [
        "static-field",
        "static-method",
        "instance-field",
        "constructor",
        "instance-method"
      ]
    }],
    "no-console": [true, "log", "warn", "error", "dir"],
    "no-constant-condition": true,
    "no-debugger": true,
    "no-duplicate-switch-case": true,
    "no-var-requires": false,
    "no-switch-case-fall-through": true,
    "object-literal-sort-keys": false,
    "ordered-imports": false,
    "prefer-const": [true, { "destructuring": "all" }],
    "variable-name": {
      "options": [
        "allow-leading-underscore",
        "ban-keywords",
        "check-format",
        "allow-pascal-case"
      ]
    }
  },
  "linterOptions": {
    "exclude": [
      "./node_modules/**/*",
      "**/*.json"
    ]
  }
}

Not sure why I'm having this problem here, I'm using the same deps on another project. Perhaps I just didn't happen to have lines that end up breaking that rule...

commented

Hi, Prettier won't add/remove braces so we did not disable the curly rule.

Prettier 1.14.2
Playground link

--parser babylon

Input:

if (something) doSomething();

if (something) {
  doSomething();
}

Output:

if (something) doSomething();

if (something) {
  doSomething();
}