Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curly rule is not disabled #185

Closed
rhys-vdw opened this issue Sep 12, 2018 · 1 comment
Closed

curly rule is not disabled #185

rhys-vdw opened this issue Sep 12, 2018 · 1 comment
Labels

Comments

@rhys-vdw
Copy link

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...

@ikatyang
Copy link
Member

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();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants