Code Monkey home page Code Monkey logo

prettier-eslint-cli's Introduction

Prettier Banner

Opinionated Code Formatter

JavaScript · TypeScript · Flow · JSX · JSON
CSS · SCSS · Less
HTML · Vue · Angular
GraphQL · Markdown · YAML
Your favorite language?

Github Actions Build Status Github Actions Build Status Github Actions Build Status Codecov Coverage Status Blazing Fast
npm version weekly downloads from npm code style: prettier Follow Prettier on Twitter

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

Input

foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());

Output

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne(),
);

Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!


Documentation

Install · Options · CLI · API

Playground


Badge

Show the world you're using Prettiercode style: prettier

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Contributing

See CONTRIBUTING.md.

prettier-eslint-cli's People

Contributors

aaronjensen avatar aharris88 avatar benoitzugmeyer avatar bj00rn avatar bysabi avatar cef62 avatar denis-sokolov avatar diondirza avatar dirtyf avatar disquisition avatar dpwilhelmsen avatar fredrikekelund avatar gandem avatar github-actions[bot] avatar greenkeeper[bot] avatar gwhitney avatar idahogurl avatar jackfranklin avatar jmenglis avatar joelseq avatar jounqin avatar kylemh avatar mikeyburkman avatar moretti avatar morhetz avatar mrm007 avatar mvolkmann avatar sheerun avatar tunnckocore avatar zimme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prettier-eslint-cli's Issues

Pass in `fallbackPrettierOptions` instead of `prettierOptions`

Given the availability of fallbackPrettierOptions with prettier-eslint v6, it seems wise to pass that in instead of prettierOptions as is done today.

The underlying issue is that I want the comma-dangle eslint option to dictate how files are prettified rather than specifying --trailing-comma.

Doesn't save fixes

When running prettier-eslint "src/**/*.js" it displays the correct changes in the cli but does not save them. I get no error message.

change in use of --prettier.{option}?

Did something change with how Prettier options get passed from prettier-eslint to prettier?
The docs describe prefixing them with --prettier., but that isn't working for me in the current version. However, omitting prettier. does work. Here's a working npm script:

    "format": "prettier-eslint --no-bracket-spacing --single-quote --write src/**/*.js"

Here's one that doesn't work for me:

    "format": "prettier-eslint --prettier.no-bracket-spacing --prettier.single-quote --write src/**/*.js"

prettier-path & prettierPath

TL:DR;

Docs say prettier-path is an option.
prettier-eslint --help says prettierPath is the option.

Both options throw an error:

$ prettier-eslint --help

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

Options:
  # ...
  --prettierPath  The path to the prettier module to use
$ prettier-eslint index.js --prettierPath `which prettier`

Ignored unknown option: --prettierPath



$ prettier-eslint index.js --prettier-path `which prettier`

Ignored unknown option: --prettier-path

Question:

I take it some combination of these should be true:

  1. The README and --help should conform.
  2. Whatever the right way is should be a known option.

What's the right option? Incidentally, --write actually seems to work in both cases. Just throws an error.

To reproduce:

  1. npm i -g prettier-eslint-cli prettier // put the tools somewhere else
  2. git clone https://github.com/joefraley/test-prettier && cd test-prettier && npm i // get an mvp repo with an eslint config and a test file
  3. npm start // run cli with a defined path
  4. git diff // see that the file was changed

obsolete docs concerning --prettier option

In #59 a breaking change was introduced that removed --prettier option in favor of directly passing options to prettier.

Unfortunately, docs weren't updated to reflect changes in code.

What is even worse, this breaking change was first pushed as a minor patch 3.6.1 which puts people using 3.X.X version and --prettier option in a pretty bad situation.

Also 3.6.1 is the latest of 36 releases at https://www.npmjs.com/package/prettier-eslint-cli

Exit(1) with --list-different

From the prettier docs:

prettier with --list-different prints the filenames of files that are different from prettier formatting.
If there are differences the script errors out, which is useful in a CI scenario:

prettier --list-different '**/*.js'
file.js
error Command failed with exit code 1.

Unfortunately this doesn't seem to work with prettier-eslint:

prettier-eslint --list-different '**/*.js'
file.js
success formatting 1 file with prettier-eslint

(The exit code in this case is 0, should be > 0)

I'm happy to submit a PR if you think we should fix it.


  • prettier-eslint-cli version: 4.1.0
  • prettier version: 1.4.4
  • eslint version: 3.19.0

Breaking change in 3.4.2: trailing comma from prettier-eslint 6.0.0

In c5e802e, this project has upgraded its dependency prettier-eslint to 6.0.0. This introduced a backwards-compatibility breaking change, as prettier-eslint starting from 6.0.0 has a different default for trailing commas. Unlike prettier-eslint, however, this project released this change as a patch version 3.4.2. In our codebase, running [email protected] now generates a huge diff because it removes all trailing commas.

Seeing how there’s version 4.0.0 of prettier-eslint-cli that is cheerily moving forward, I would suggest releasing another version in the 3.x branch that reverts the breaking change only to maintain stability for users who have not upgraded yet.

#62 seems tangentially related.

eslint disable moves to next line

if (!global.__DEV__) { // eslint-disable-line
}

changes to

if (!global.__DEV__) {
  // eslint-disable-line
}

and hence shows error in eslint.

Have the equivalent of prettier -l option

Hi,
First, thanks for your work, this is very usefull !

Is there anyway to have a -l option equivalent to the one from prettier to know what are the file that are not prettier-eslint yet ?

See the PR from the prettier repos adding this option : prettier/prettier#854

It could be usefull to be able to launch prettier-eslint -l "src/**/*.js to check on CI if all the files have passed the prettier-eslint script.

P.S: we can't use the -l from prettier here because it doesn't rely on Eslint config.

Thanks

Kenny

Different glob results when running via npm script and CLI directly

I hacked the ./node_modules/.bin/prettier-eslint-cli/dist/index.js and added an console.log(argv); near the bottom, and it's showing some interesting results when running npm run prettier in my project, versus just running ./node_modules/.bin/prettier-eslint --single-quote --write src/**/*.js webpack.config.js directly.

$ ./node_modules/.bin/prettier-eslint --version # 1.0.3

$ npm run
Scripts available in pulse via `npm run-script`:
  build
    webpack
  lint
    eslint .
  prettier
    prettier-eslint --single-quote --write src/**/*.js webpack.config.js
  watch
    webpack
$ npm run prettier

> [email protected] prettier /Users/pdehaan/dev/github/mozilla/pulse
> prettier-eslint --single-quote --write src/**/*.js webpack.config.js

{ _: [ 'src/webextension/background.js', 'webpack.config.js' ],
  h: false,
  help: false,
  version: false,
  'single-quote': true,
  singleQuote: true,
  write: 'src/lib/log.js',
  stdin: false,
  eslintPath: '/Users/pdehaan/dev/github/mozilla/pulse/node_modules/eslint',
  log: false,
  sillyLogs: false,
  '$0': '/Users/pdehaan/dev/github/mozilla/pulse/node_modules/.bin/prettier-eslint',
  prettierPath: undefined }

success formatting 2 files with prettier-eslint

When running npm run prettier script, it says "success formatting 2 files with prettier-eslint". Oddly, it only finds two files: [ 'src/webextension/background.js', 'webpack.config.js' ]

Now, if I run the ./node_modules/.bin/prettier-eslint --single-quote --write src/**/*.js webpack.config.js script directly, it finds 5 files instead of 2:

$ ./node_modules/.bin/prettier-eslint --single-quote --write src/**/*.js webpack.config.js
{ _:
   [ 'src/lib/log.js',
     'src/webextension/background.js',
     'src/webextension/survey/lib/open.js',
     'src/webextension/survey/survey.js',
     'webpack.config.js' ],
  h: false,
  help: false,
  version: false,
  'single-quote': true,
  singleQuote: true,
  write: 'src/index.js',
  stdin: false,
  eslintPath: '/Users/pdehaan/dev/github/mozilla/pulse/node_modules/eslint',
  log: false,
  sillyLogs: false,
  '$0': 'node_modules/.bin/prettier-eslint',
  prettierPath: undefined }

success formatting 5 files with prettier-eslint

prettier-eslint-cli does not throw eslint's errors

  • prettier-eslint-cli version: 4.1.1
  • prettier-eslint version: 6.4.2
  • prettier version: 1.5.2
  • eslint version: 3.19.0

.eslintrc:

{
  "env": {
    "browser": true,
    "es6": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "extends": "defaults",
  "plugins": [
    "react"
  ],
  "rules": {
    "no-console": 2,
    "no-const-assign": 2,
    "no-unused-vars": 2,
    "prefer-const": 2,
    "semi": 2,
    "comma-dangle": 0,
    "react/jsx-uses-react": 2,
    "react/jsx-uses-vars": 2
  }
}

Problem description:

I have "no-console": 2 in my .eslintrc file.
I put a console.log in my code so when I run the command eslint it throws an error.

capture d ecran 2017-07-12 a 14 00 36

However when I run prettier-eslint it doesn't show this error (I have tried all the --log-level possible values).

If I am not missing something, it is supposed to show the error as it is mentioned in prettier-eslint

prettier-eslint will propagate errors when either prettier or eslint fails for one reason or another. In addition to propagating the errors, it will also log a specific message indicating what it was doing at the time of the failure.

What to do with "failure formatting 12 files with prettier-eslint"

Hello,

thanks a lot for this project :-)

A small question because I am unsure about what action to take after seeing that I have 12 files which fails to be written/formatted. I can't see any detail on the errors and I am not sure either if I shall expect eslint errors to be forwarded by prettier-eslint-cli.

This is the command I run:

prettier-eslint --write --log chapter*/**/*.js

Thanks for your help :-)

cc @DirtyF

Missing documentation

I am not able to tell through the documentation what the defaults for each option are. This would be nice to have so that I know whether I need to set that option or can just accept the default.

fix: update to eslint 4.0

  • prettier-eslint-cli version: 4.2.1
  • prettier version: 1.5.3
  • eslint version: 4.5.0

Relevant code/config.

  "indent": [ "error", 2, { "SwitchCase": 1, "ignoredNodes": [ "JSXElement", "JSXOpeningElement" ] } ]
prettier-eslint 'src/**/*.js' --eslint-config-path ./.eslintrc --trailing-comma all --single-quote --write

What you did:
run prettier eslint using eslintrc for current version of eslint

What happened:

1__tmux

Reproduction:

Add the above indent rule to your eslintrc. Run prettier-eslint-cli on a file

-- paste your link here --

Problem description:

The current version of prettier-eslint-cli uses a previous version of eslint. The current version of eslint has additional rules that are not available to prettier-eslint-cli, which causes it to fail.

Suggested solution:

  • Update internal version of eslint

This isn't critical for me as I believe I can just run prettier first then run eslint --fix consecutively.

I also see some indication that you are using greenkeeper yet I couldn't find a PR for version 4 of eslint.

Is the goal of this project to provide a drop-in replacement for prettier when working with eslint?

prettier-eslint-cli lacks a --stdin-filepath option. This is breaking prettier editor integrations because prettier-eslint-cli doesn't provide the same API, see the discussion here for details: prettier/prettier-emacs#10

I don't mind attempting a PR but I'd like to see what people think about this first.

Even if a change like this would be up for consideration I'm not sure what the behaviour of --stdin-filepath should be for prettier-eslint-cli considering that prettier uses it for parser inference and prettier-eslint-cli is focused on JS.

IMHO the least surprising result would be to defer to prettier for non-JS files, but I don't know if that is an option unless the allowed arguments for prettier-eslint-cli are a strict superset of those for prettier.

An in-range update of rxjs is breaking the build 🚨

Version 5.2.0 of rxjs just got published.

Branch Build failing 🚨
Dependency rxjs
Current Version 5.1.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As rxjs is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details

  • dependency-ci An error occured Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

When there is unchanged (file) it exits with 0 code

Hi again. I'm considering to change lint script directly to this CLI, because few reasons:

    1. have StandardJS installed
    1. have .eslintrc.json intentionally, which basically is {extends: standard}. so better IDE integration
    1. if this CLI works properly i should get exit code 1 if something fails (somehow, for example if some contributor dont have such editor integration and just use the npm lint script)

Problem is that if there is some error it exits with code 0, which will not stop the next scripts, like npm test and commit.

So, i believe more correct behavior would be to exit with code 1 when even only one file is not changed (using --write flag). But behavior should be the same even without the --write flag.

Breaks create-react-app's test script

  • prettier-eslint-cli version: 4.2.0
  • prettier version: 1.5.3
  • eslint version: 4.4.1
  • react-script version: 1.0.11

Relevant code/config.

What you did:

Just included prettier-eslint-cli in my package.json file.

What happened:

2017-08-18 10:56 node[9945] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-08-18 10:56 node[9945] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-08-18 10:56 node[9945] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1020:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1420:11)
error Command failed with exit code 1.

Reproduction:

-- paste your link here --

Problem description:

Suggested solution:

Validation Warning for options "semi" and "useTabs"

I upgraded to the latest versions of prettier and prettier-eslint-cli and am now getting Validation Warnings.

% prettier --version
1.2.2

% prettier-eslint --version
3.4.1

% cat .eslintrc.js
module.exports = {
    "rules": {
        "indent": [
            "error",
            4
        ],
        "semi": [
            "error",
            "always"
        ]
    }
};

% echo "function foo() {}" | prettier-eslint --stdin
● Validation Warning:

  Unknown option "semi" with value true was found.
  This is probably a typing mistake. Fixing it will remove this message.

● Validation Warning:

  Unknown option "useTabs" with value false was found.
  This is probably a typing mistake. Fixing it will remove this message.

function foo() {}

Doesn't recognize single-quote option of prettier

  • prettier-eslint-cli version: 4.0.0
  • prettier version: 1.3.1
  • eslint version: 3.19.0

With the last version, I tried to use this command
prettier-eslint --print-width 100 --single-quote --trailing-comma all --write

and it showed an error `Unknown argument: single-quote'. Does this option being replaced by another option?

Unexpected changes to formatted result after bumping to v4

  • prettier-eslint-cli version: 4.0.3
  • prettier version: 1.4.2
  • eslint version: 3.19.0

Relevant code/config.

// before
type foo = 'hello world';
type bar = { baz: null };

// after
type foo = "hello world";
type bar = {baz: null};

What you did: I bumped from 3.6.0 to 4.0.3 and ran the formatter. Reverting to 3.6.0 solves all of the below problems.

What happened:

  • Flow annotations' quotations changed to double quotes
  • Flow annotations lost bracket spacing
  • Many instances of going over max line length when it didn't before. These cases aren't the usual instance where prettier formats it in a way that is below line length but then eslint fixes it in a way that is longer, these are cases where prettier should have wrapped itself before it even got to the eslint step.

I can't be sure, but it seems as though the prettier eslint inference isn't working right or something? And eslint --fix is covering it up (except for these issues)?

Are off values being respected?

  • prettier-eslint-cli version: latest
  • prettier version: latest
  • eslint version: latest

Relevant code/config.

unlinted code ->

"use strict";
const {foo} = bar

linted code:

"use strict";
const { foo } = bar;

eslintrc.json

{
  "extends": ["eslint:recommended"],
  "rules": {
    "semi": 0,
    "object-curly-spacing": 0
  }
}

What you did:
I ran both node_modules\.bin\prettier-eslint *.js --write and node_modules\.bin\prettier-eslint *.js --write --eslint-config-path ./.eslintrc.json.

What happened:

Both returned successfully and changed file from unlinted code to linted code but didn't follow the eslint rules above. Which should have let the file unchanged for those specific rules. This could potentially be a prettier-eslint issue I will test later today.

Doesn't work when Prettier is only installed globally

I have prettier and prettier-eslint-cli installed globally because I want to use it in any JavaScript project with vim.

When I format a file, I get the text of the file replaced with this:

prettier-eslint-cli error: There was a problem trying to format the stdin text Error: Cannot find module '../../../../../../path/to/current/project/node_modules/prettier'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at prettify (/usr/local/lib/node_modules/prettier-eslint-cli/node_modules/prettier-eslint/dist/index.js:79:16)
    at format (/usr/local/lib/node_modules/prettier-eslint-cli/node_modules/prettier-eslint/dist/index.js:66:18)
    at _callee2$ (/usr/local/lib/node_modules/prettier-eslint-cli/dist/format-files.js:77:54)
    at tryCatch (/usr/local/lib/node_modules/prettier-eslint-cli/node_modules/regenerator-runtime/runtime.js:64:40)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/prettier-eslint-cli/node_modules/regenerator-runtime/runtime.js:355:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/prettier-eslint-cli/node_modules/regenerator-runtime/runtime.js:116:21)

But when I install prettier locally in the project, it works. I feel like it should work either way.

Different result compare to running `prettier` and `eslint --fix` seperately

  • prettier-eslint-cli version: 4.1.1
  • prettier version: 1.5.3
  • eslint version: 3.19.0

What you did:

./node_modules/.bin/prettier-eslint myfile.js

What happened:

export {
  func1,
  func2,
  func3,
}

becames

export { func1, func2, func3 }

If I ran prettier myfile.js then eslint --fix myfile.js, there was no transformation.
Is this the issue of prettier-eslint? or did I miss some settings?

Requires Node 4, should have engines listed in package.json

I tried installing this in one of our legacy projects, but had a runtime error because there are string templates in the code, and we're still stuck on node 0.12. (Yeah I know, it's ancient.)

The package.json file should probably have engines added to it, so it's enforced that it can't be installed on older node versions.

TypeError: prettier.resolveConfig.sync is not a function

It looks like there is a regression in 4.3.2:

$ node_modules/.bin/prettier-eslint path/to/file.js
prettier-eslint-cli [ERROR]: There was an error formatting "path/to/file.js":
    TypeError: prettier.resolveConfig.sync is not a function
        at getPrettierConfig (node_modules/prettier-eslint/dist/index.js:233:33)
        at format (node_modules/prettier-eslint/dist/index.js:90:51)
        at MapSubscriber.project (node_modules/prettier-eslint-cli/dist/format-files.js:275:55)
        at MapSubscriber._next (node_modules/rxjs/operator/map.js:77:35)
        at MapSubscriber.Subscriber.next (node_modules/rxjs/Subscriber.js:89:18)
        at AsyncSubject.Subject.next (node_modules/rxjs/Subject.js:55:25)
        at AsyncSubject.complete (node_modules/rxjs/AsyncSubject.js:46:35)
        at handlerFn (node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
        at tryToString (fs.js:456:3)
        at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)

This only happens with version 4.3.2, not with 4.3.1 versions 4.3.2 and 4.3.1, not with 4.3.0.
It also happens without a .prettierrc file.

  • prettier-eslint-cli version: 4.3.2
  • prettier-eslint version: 8.0.0
  • eslint version: 4.6.1

Alignment with the eslint cli

  • prettier-eslint-cli version: 4.1.1
  • prettier version: 1.4.4
  • eslint version: 3.19.0

What you did:

Replaced eslint with prettier-eslint-cli

What happened:

$ prettier-eslint-cli .
prettier-eslint-cli [ERROR]: There was an error formatting ".": 
    Error: EISDIR: illegal operation on a directory, read
failure formatting 1 file with prettier-eslint

Received the same output for

$ prettier-eslint-cli test

Running with a glob only changed one file, not the two files in my project (index.js and test/index.js)

$ prettier-eslint-cli **/*.js
1 file was changed

Problem description:

Coming from eslint I was hoping that prettier-eslint-cli would be a drop in replacement. A lot of the projects I work on run eslint on the src and test directories while using --ignore-path .gitignore. Other projects use eslint with ., allowing eslint to use the default --ext .js option.

Suggested solution:

I'm not sure which package this request falls into (prettier-eslint-cli or prettier-eslint), but it would be great if the cli options were closer to that of eslint cli.

Feature request: allow prettier options such as "--trailing-comma"

Hello !

First of all, I am actually using prettier-eslint with Neoformat in Vim, and it's awesome, thank you so much for these projects 😄

One problem I encountered is while using the cli in a small NodeJS project (that has no babel pipeline). The problem is that prettier add comma dangles in function arguments by default, and the latest version of Node does not yet support this feature. Prettier has a flag already implemented for that use case, which is "--trailing-commas es5".

I saw that there was a todo here that considered using "some" prettier configuration in prettier-eslint-cli.

One idea would be passing the flags prefixed : --prettier-trailing-commas es5 !

How do you think this should be done ? I would be glad to try to work on it, if possible :)

Edit: I saw that #26 aborded the same subject, but the issue is more focused on the inference between eslint and prettier. I don't know if it would best to talk about the issue there. If so, let me know, I would be glad to close this issue 😃

slow performance. How long should it take?

  • prettier-eslint-cli version: 4.1.1
  • prettier version: 0.22.0
  • eslint version: 4.2.0

Relevant code/config.

What you did:

prettier-eslint file.js

What happened:

the prettier command takes less than a second and the prettier-eslint command takes about 4-5 seconds on the same file. Is this a normal execution time?

Reproduction:

-- paste your link here --

Problem description:

Suggested solution:

eslint-ignore does not respect deeply nested node_modules folders

Given a directory structure like:

/
/node_modules/
/subfolder/node_modules/

And a .eslintignore like:

**/node_modules/**

Running prettier will attempt to format code within subfolder/node_modules. It's expected that it would not format this directory since eslint ignores it.

Trailing empty line problem

I'm using prettier-eslint-cli for vim and prettier-eslint for Atom right now. Everything works great and they gave me the same results except a tiny problem.

After formatting the code via Vim using this configuration:

autocmd FileType javascript.jsx,javascript setlocal formatprg=prettier-eslint\ --stdin\ --prettier.jsx-bracket-same-line\ --prettier.parser\ babylon\ --prettier.single-quote\ --prettier.trailing-comma\ none

prettier-eslint-cli formatter is adding a new empty line to the EOF.

Missing something on the tool configuration side?

Success format messages don't respect logLevel

I just noticed that the logging for the success/failure message (https://github.com/prettier/prettier-eslint-cli/blob/master/src/format-files.js#L128) doesn't respect the log level. I'd expect if I set --log-level silent that I would see literally no logging.

The reason I ask about this is because I'm writing a script to check Prettier against any JS files in git diff and the output right now looks a bit weird because prettier-eslint formats foo.js and outputs 'success formatting foo.js' but the actual script fails because the formatted foo.js doesn't match foo.js on disk.

Would you be open to a PR that made the logging above respect logLevel and just use log.info instead?

Add more logging

@xjamundx ran into an issue where the prettier module couldn't be found here and the error was cryptic. Having better logging would be nice.

Possible to override prettier options?

Unless I'm missing something, I'm not seeing a way to override prettier options w/ prettier-eslint-cli. It looks like it just uses prettier-eslint's inference, which doesn't quite work in my situation. Is there a way at the moment? Thanks!

An in-range update of prettier-eslint is breaking the build 🚨

Version 4.1.2 of prettier-eslint just got published.

Branch Build failing 🚨
Dependency prettier-eslint
Current Version 4.1.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As prettier-eslint is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • dependency-ci Dependencies checked Details

  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v4.1.2

4.1.2 (2017-02-23)

Bug Fixes

  • package: update prettier to version 0.19.0 (#33) (3be82cde)
Commits

The new version differs by 3 commits .

  • 3be82cd fix(package): update prettier to version 0.19.0 (#33)
  • 162a9f2 chore(package): update jest-cli to version 19.0.1 (#30)
  • 185378c chore(package): update cz-conventional-changelog to version 2.0.0 (#28)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Unable to find config

I followed the example of installing prettier-eslint-cli as a dev dependency, adding a format script in package.json, and I have a .eslintrc.json file in the root directory of my project, but when I run npm run format I get this:

> prettier-eslint "src/**/*.js"

prettier-eslint [ERROR]: Unable to find config
prettier-eslint [ERROR]: Unable to find config
failure formatting 2 files with prettier-eslint

I must be missing a step.

Success and error messages are printed to stdout when reading from a file

This makes it hard to use this tool as a drop-in replacement for prettier, for example when using Emacs editor integration https://github.com/prettier/prettier/tree/master/editors/emacs as it works using temporary files instead of --stdin.

I was able to fix this easily by using console.error instead of console.log in format-files.js, but couldn't send a quick PR as it breaks more than half of the tests.

$ echo "import      'foo'" > file.js
$ prettier-eslint file.js > formatted.js

formatted.js contents:

import 'foo'

success formatting 1 file with prettier-eslint

Version 4.x stopped inferring options from ESLint config

  • prettier-eslint-cli version: 4.0.1
  • prettier version: 1.3.1
  • eslint version: 3.19.0

Relevant code/config.
See example repo. Run with yarn start. There is a v3 branch for prettier-eslint-config@3.

What you did:

With prettier-eslint-config@4 the inferred options are:

  "prettierOptions": {
    "bracketSpacing": true,
    "parser": "babylon",
    "printWidth": 80,
    "semi": true,
    "singleQuote": false,
    "tabWidth": 2,
    "trailingComma": "none",
    "useTabs": false,
  },

The expected options are the ones obtained with prettier-eslint-config@3:

  "prettierOptions": {
    "bracketSpacing": true,
    "parser": "babylon",
    "printWidth": 120,
    "semi": true,
    "singleQuote": true,
    "tabWidth": 2,
    "trailingComma": "all",
    "useTabs": false,
  },

Problem description:

The new behaviour is caused by the changes in #59, specifically this change. Default options specified for yargs take precedence so the ESLint config getters never get called:

code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.