Prettier-eslint: Rule "quotes": ["error", "backtick"] causes errors

Created on 28 Apr 2017  ยท  6Comments  ยท  Source: prettier/prettier-eslint

If I use this rule

"quotes": ["error", "backtick"]

I get errors like this

prettier-eslint [ERROR]: prettier formatting failed due to a prettier error
prettier-eslint-cli [ERROR]: There was an error formatting "packages/gatsby/lib/utils/webpack.config.js": 
    โ— Validation Error:

      Option "singleQuote" must be of type:
        boolean
      but instead received:
        string

      Example:
      {
        "singleQuote": false
      }

Using prettier-eslint-cli 3.4.2

Most helpful comment

Merged. Thanks!

And I wonder if the long stack traces are necessary? They pollute the output quite a bit.

That's kind of the point though. You can also use debug instead of trace. Thanks for the feedback. I added a note about only running it on one :)

Thanks again!

All 6 comments

this shouldn't have happened, let me install eslint and check

I added a section in the README that should help you find out what the problem is: debugging

Thank you!!

I ran it with trace. The inferred eslint options contain

"quotes": Array [
        "error",
        "backtick",
      ],

But the options then passed to prettier by prettier-eslint are

"prettierOptions": Object {
    "bracketSpacing": false,
    "parser": "babylon",
    "printWidth": 80,
    "semi": false,
    "singleQuote": "backtick",
    "tabWidth": 2,
    "trailingComma": "es5",
    "useTabs": false,
  },

Since prettier expects a boolean for singleQuote this breaks like the error suggested. I'll quickly see if I can spot where this happens.

I created this PR #76

Although I can't figure out how to test it in the wild. If I install it from my github branch the binary doesn't seem to pick up the new code.

BTW The trace mode brings my computer to its knees when I use it on a glob pattern matching a bunch or files. Might be worth mentioning that it's better run on a single file. And I wonder if the long stack traces are necessary? They pollute the output quite a bit.

Merged. Thanks!

And I wonder if the long stack traces are necessary? They pollute the output quite a bit.

That's kind of the point though. You can also use debug instead of trace. Thanks for the feedback. I added a note about only running it on one :)

Thanks again!

Was this page helpful?
0 / 5 - 0 ratings