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

Cannot use with prettier-eslint. #235

Closed
9 tasks done
Ryan-McLemon opened this issue Jan 11, 2021 · 5 comments
Closed
9 tasks done

Cannot use with prettier-eslint. #235

Ryan-McLemon opened this issue Jan 11, 2021 · 5 comments
Assignees
Labels

Comments

@Ryan-McLemon
Copy link

Ryan-McLemon commented Jan 11, 2021

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.
@Ryan-McLemon
Copy link
Author

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.

@Ryan-McLemon
Copy link
Author

Related issue:
prettier/prettier-eslint#479

@dvcrn
Copy link

dvcrn commented Feb 6, 2021

@Ryan-McLemon did you manage to find a workaround for this?

@Ryan-McLemon
Copy link
Author

Ryan-McLemon commented Feb 8, 2021

@dvcrn, I have not tried again. Let me know if you do!

@github-actions
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants