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.

unexpected new line has been added within example

See original GitHub issue

reproduce:

  1. npm i prettier-plugin-jsdoc@latest
  2. VScode reload window
  3. write some code
/**
 * ABCCCC
 *
 * @example <caption>DDDD</caption>
 *
 *   const MyHook = () => {
 *     const config useConfig(state => state.config)
 *     return <span></span>
 *   }
 *
 *   const useMyHook = () => {
 *     const config useConfig(state => state.config)
 *     return config
 *   }
 *
 * @example <caption>AAAA</caption>
 *   const config = useConfig.getState().config
 */
  1. save
  2. it’s become
/**
 * ABCCCC
 *
 * @example <caption>DDDD</caption>
 *
 *                                                    <------here, a new line has been added
 *   const MyHook = () => {
 *   const config useConfig(state => state.config)
 *   return <span></span>
 *   }
 *
 *   const useMyHook = () => {
 *   const config useConfig(state => state.config)
 *   return config
 *   }
 *
 * @example <caption>AAAA</caption>
 *   const config = useConfig.getState().config
 */

video

context

  1. node -v v14.16.0

  2. .prettierrc.js

// @ts-check

/**
 * @type{{ overrides: { files: string | string[], options: import('prettier').Options }[] }}
 */
const overrides = {
  overrides: [
    {
      files: '*.js',
      options: {
        parser: 'babel',
        printWidth: 100,
      },
    },
    {
      files: ['*.json', '.*rc'],
      options: {
        parser: 'json',
        printWidth: 100,
      },
    },
    {
      files: '*.vue',
      options: {
        parser: 'vue',
        printWidth: 100,
      },
    },
    {
      files: '*.htmlx',
      options: {
        htmlWhitespaceSensitivity: 'strict',
        parser: 'html',
        printWidth: 100,
      },
    },
    {
      files: '*.scss',
      options: {
        parser: 'scss',
        printWidth: 100,
      },
    },
  ],
}

/**
 * @type{import('prettier').Options}
 */
const config = {
  arrowParens: 'avoid',
  bracketSpacing: true,
  insertPragma: false,
  jsxBracketSameLine: false,
  jsxSingleQuote: true,
  parser: 'typescript',
  proseWrap: 'preserve',
  requirePragma: false,
  semi: false,
  singleQuote: true,
  tabWidth: 2,
  trailingComma: 'all',
  useTabs: false,
  printWidth: 100,
}

module.exports = { ...config, ...overrides }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hosseinmdcommented, Apr 27, 2021

Unexpected new line fixed version: 0.3.21

0reactions
Aqzhyicommented, Apr 29, 2021

@hosseinmd, do you have PayPal? I want to buy you coffee.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bash: syntax error near unexpected token `newline
What is the reason for this problem? I am running the command as root. bash · syntax · newline · token.
Read more >
How to fix the “syntax error near unexpected token `newline ...
Oftentimes when we are using Bash scripting or the git add command, we can run into this error “syntax error near unexpected token...
Read more >
ERROR newline unexpected · Issue #221 · Ultimaker/cura-build
A newline is a character that tells the computer that a new line is starting. Basically the character that it stores when you...
Read more >
syntax error near unexpected token `newline - 华为云
Symptom. The message syntax error near unexpected token `newline' is displayed after the git add command is executed.
Read more >
Getting an unexpected newline in my while loop line-by-line ...
I'm trying to get a line returned as is from the below input. csv file in Bash in Linux, and somehow I get...
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