question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use with `prettier-eslint`.

See original GitHub issue

When reporting an issue, please include the following information in your post:

  • Explain the Issue and Expected Behavior
  • Prettier version
  • JsPrettier Plug-in Version
  • Platform Details
  • Generated Prettier command line arguments
  • Is the same behavior observed when run against Prettier directly?
  • The contents of your User/JsPrettier.sublime-settings file
  • The contents of your <project_name>.sublime-project file (if applicable)
  • Steps to reproduce the behavior

Explain the Issue and Expected Behavior

I would like to use prettier-eslint in a project that only has an eslint config, but I get an error about editorconfig when using that, even with editorconfig set to false.

Prettier version

λ prettier-eslint --version
5.0.0

JsPrettier Plug-in Version

The JsPrettier Sublime Text Plug-in version is located in the package.json file.

...
"name": "sublime-js-prettier",
"version": "1.36.0",
...

Platform Details

Provide your Sublime Text version and Platform details.

Example

- Sublime Text Version: 3.2.2
- Sublime Text Build: 3211
- Sublime Text Architecture: x64
- Operating System Name: Mac OS
- Operating System Version: 10.15.x
- Operating System Architecture: x64

Generated Prettier command line arguments

To view the generated prettier command line arguments you need to enable JsPrettier’s debug setting and open the Sublime Text Console after a file/section formatting attempt.

Example

[JsPrettier DEBUG]: Could not resolve Prettier config file, will use options defined in Sublime Text.

-----------------------------------------
 JsPrettier DEBUG - Prettier CLI Command 
-----------------------------------------

/usr/local/bin/prettier-eslint --no-config --print-width 80 --tab-width 2 --single-quote false --trailing-comma es5 --bracket-spacing true --jsx-bracket-same-line false --parser json --semi true --require-pragma false --prose-wrap preserve --arrow-parens always --html-whitespace-sensitivity css --quote-props as-needed --vue-indent-script-and-style false --embedded-language-formatting auto --jsx-single-quote false --editorconfig true --use-tabs false --stdin-filepath /Users/rmcquen/Library/Application Support/Sublime Text 3/Packages/User/JsPrettier.sublime-settings --loglevel debug --cursor-offset 191

------------------
 JsPrettier ERROR 
------------------

Prettier reported the following output:

Usage: prettier-eslint <globs>... [--option-1 option-1-value --option-2]

Prefix an option with "no-" to set it to false, such as --no-semi to
disable semicolons and --no-eslint-ignore to disable default ignores.

Options:
  -h, --help               Show help                                   [boolean]
  --version                Show version number                         [boolean]
  --write                  Edit the file in-place (beware!)
                                                      [boolean] [default: false]
  --stdin                  Read input via stdin       [boolean] [default: false]
  --stdin-filepath         Path to the file to pretend that stdin comes from.
  --eslint-ignore          Only format matching files even if they are not
                           ignored by .eslintignore. (can use --no-eslint-ignore
                           to disable this)            [boolean] [default: true]
  --prettier-ignore        Only format matching files even if they are not
                           ignored by .prettierignore. (can use
                           --no-prettier-ignore to disable this)
                                                       [boolean] [default: true]
  --list-different         Print filenames of files that are different from
                           Prettier + Eslint formatting.
                                                      [boolean] [default: false]
  --eslint-path            The path to the eslint module to use
  --eslint-config-path     Path to the eslint config to use for eslint --fix
  --prettier-path          The path to the prettier module to use
  --config                 Path to the prettier config
  --ignore                 pattern(s) you wish to ignore (can be used multiple
                           times and includes **/node_modules/** automatically)
  --log-level, -l          The log level to use
        [choices: "silent", "error", "warn", "info", "debug", "trace"] [default:
                                                                         "warn"]
  --prettier-last          Run prettier last          [boolean] [default: false]
  --use-tabs               Indent lines with tabs instead of spaces.   [boolean]
  --print-width            Specify the length of line that the printer will wrap
                           on.                                          [number]
  --tab-width              Specify the number of spaces per indentation-level.
                                                                        [number]
  --trailing-comma         Print trailing commas wherever possible.

                           Valid options:
                           - "none" - no trailing commas
                           - "es5" - trailing commas where valid in ES5
                           (objects, arrays, etc)
                           - "all" - trailing commas wherever possible (function
                           arguments)   [string] [choices: "none", "es5", "all"]
  --bracket-spacing        Print spaces between brackets in object literals.
                           Can use --no-bracket-spacing for "false" to disable
                           it.

                           Valid options:
                           - true - Example: { foo: bar }
                           - false - Example: {foo: bar}               [boolean]
  --jsx-bracket-same-line  Put the > of a multi-line JSX element at the end of
                           the last line instead of being alone on the next line
                                                                       [boolean]
  --parser                 Specify which parser to use.                 [string]
  --semi                   Print semicolons at the ends of statements.
                           Can use --no-semi.

                           Valid options:
                           - true - add a semicolon at the end of every
                           statement
                           - false - only add semicolons at the beginning of
                           lines that may introduce ASI failures       [boolean]
  --single-quote           Use single quotes instead of double quotes. [boolean]
  --arrow-parens           Include parentheses around a sole arrow function
                           parameter.

                           Valid options:
                           - "avoid" - Omit parens when possible. Example: x =>
                           x
                           - "always" - Always include parens. Example: (x) => x
                                                                        [string]
  --require-pragma         Prettier can restrict itself to only format files
                           that contain a special comment, called a pragma,
                           at the top of the file.
                           This is very useful when gradually transitioning
                           large, unformatted codebases to prettier.   [boolean]
  --insert-pragma          Prettier can insert a special @format marker at the
                           top of files specifying that the file has been
                           formatted with prettier. This works well when used in
                           tandem with the --require-pragma option.
                           If there is already a docblock at the top of the file
                           then this option will add a newline to it with the
                           @format marker.                             [boolean]
  --prose-wrap             By default, Prettier will wrap markdown text as-is
                           since some services use a linebreak-sensitive
                           renderer, e.g. GitHub comment and BitBucket.
                           In some cases you may want to rely on
                           editor/viewer soft wrapping instead, so this
                           option allows you to opt out with "never".

                           Valid options:

                           "always" - Wrap prose if it exceeds the print width.
                           "never" - Do not wrap prose.
                           "preserve" - Wrap prose as-is. available in v1.9.0+
                                                                       [boolean]

Unknown arguments: editorconfig, loglevel


Prettier process finished with exit code 1.

NOTE: The back-slashes (\) in the example above will not be printed to the Console… and only provided here for legibility purposes. The full prettier command will be output to the Console with no line-breaks.

Is the same behavior observed when run against Prettier directly?

No.

The contents of your User/JsPrettier.sublime-settings file

{
  "prettier_cli_path": "/usr/local/bin/prettier-eslint",
  "auto_format_on_save": true,
  "custom_file_extensions": [
    "sublime-settings"
  ],
  "editorconfig": false
}

The contents of your <project_name>.sublime-project file (if applicable)

N/A

Steps to reproduce the behavior

The steps one would take to reproduce and observe the problem.

1. Install `prettier-eslint` globally (`npm i -g prettier-eslint`).
2. Set JSPrettier to use `prettier-eslint`.
3. Try formatting the JSPrettier `sublime-settings` with JSPrettier.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Ryan-McLemoncommented, Jan 11, 2021

I think the fix here would be just not passing --editorconfig when it is set to false. It is strangely still passing with a value of true despite my sublime-settings.

0reactions
github-actions[bot]commented, Oct 13, 2021

This issue has been automatically locked due to inactivity. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier doesn't format based on my eslint config - Stack Overflow
1 Answer 1 · Open command pallette ctrl+shift+p ; · Select Format Document With... ; · Select Configure Document With... ; · Select...
Read more >
How to make ESLint work with Prettier avoiding conflicts and ...
First of all you have to install ESLint plugin in VS Code. Either you can use the extension tab in VS Code or...
Read more >
eslint-config-prettier - GitHub
Turns off all rules that are unnecessary or might conflict with Prettier. This lets you use your favorite shareable config without letting its...
Read more >
Integrating with Linters - Prettier
Most stylistic rules are unnecessary when using Prettier, but worse – they might conflict with Prettier! Use Prettier for code formatting concerns, and...
Read more >
Using Prettier and ESLint to automate formatting and fixing ...
Learn how to use ESLint and Prettier together to automatically format and fix JavaScript code in your projects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found