BVB Source Codes

prettier Show issues.js Source code

Return Download prettier: download issues.js Source code - Download prettier Source code - Type:.js
  1. // Does not need to break as it fits in 80 columns
  2. this.call(a, /* comment */ b);
  3.  
  4. function f(
  5.   someReallyLongArgument: WithSomeLongType,
  6.   someReallyLongArgument2: WithSomeLongType,
  7.   // Trailing comment should stay after
  8. ) {}
  9.  
  10. // Comments should either stay at the end of the line or always before, but
  11. // not one before and one after.
  12. throw new ProcessSystemError({
  13.   code: acc.error.code, // Alias of errno
  14.   originalError: acc.error, // Just in case.
  15. });
  16.  
  17. // Adding a comment stops the pretty printing process and everything is
  18. // squished in a single line afterward
  19. export type BuckWebSocketMessage = {
  20.   // Not actually from Buck - this is to let the receiver know that the socket is connected.
  21.   type: 'SocketConnected',
  22. } | {
  23.   type: 'BuildProgressUpdated',
  24.   progressValue: number,
  25. } | {
  26.   type: 'BuildFinished',
  27.   exitCode: number,
  28. } | {
  29.   type: 'BuildStarted',
  30. } | {
  31.   type: 'ParseStarted',
  32. } | {
  33.   type: 'ParseFinished',
  34. } | {
  35.   type: 'RunStarted',
  36. } | {
  37.   type: 'RunComplete',
  38. };
  39.  
  40. // Missing one level of indentation because of the comment
  41. const rootEpic = (actions, store) => (
  42.   combineEpics(...epics)(actions, store)
  43.     // Log errors and continue.
  44.     .catch((err, stream) => {
  45.       getLogger().error(err);
  46.       return stream;
  47.     })
  48. );
  49.  
  50. // Two extra levels of indentation because of the comment
  51. export type AsyncExecuteOptions = child_process$execFileOpts & {
  52.   // The contents to write to stdin.
  53.   stdin?: ?string,
  54.   dontLogInNuclide?: ?boolean,
  55. };
  56.  
  57. // optional trailing comma gets moved all the way to the beginning
  58. const regex = new RegExp(
  59.   '^\\s*' + // beginning of the line
  60.   'name\\s*=\\s*' + // name =
  61.   '[\'"]' + // opening quotation mark
  62.   escapeStringRegExp(target.name) + // target name
  63.   '[\'"]' + // closing quotation mark
  64.   ',?$', // optional trailing comma
  65. );
  66.  
  67. // The comment is moved and doesn't trigger the eslint rule anymore
  68. import path from 'path'; // eslint-disable-line nuclide-internal/prefer-nuclide-uri
  69.  
  70. // Comments disappear in-between MemberExpressions
  71. Observable.of(process)
  72.   // Don't complete until we say so!
  73.   .merge(Observable.never())
  74.   // Get the errors.
  75.   .takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors)
  76.   .takeUntil(exit);
  77.  
  78. // Comments disappear inside of JSX
  79. <div>
  80.   {/* Some comment */}
  81. </div>;
  82.  
  83. // Comments in JSX tag are placed in a non optimal way
  84. <div
  85.   // comment
  86. />;
  87.  
  88. // Comments disappear in empty blocks
  89. if (1) {
  90.   // Comment
  91. }
  92.  
  93. // Comments trigger invalid JavaScript in-between else if
  94. if (1) {
  95. }
  96. // Comment
  97. else {
  98.  
  99. }
  100.  
  101. // The comment makes the line break in a weird way
  102. const result = asyncExecute('non_existing_command', /* args */ []);
  103.  
  104. // The closing paren is printed on the same line as the comment
  105. foo({}
  106.   // Hi
  107. );
  108.  
downloadissues.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top