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.

Support // prettier-ignore

See original GitHub issue

Is it possible to support // prettier-ignore comment? So marked import won’t be reordered, e.g.

// prettier-ignore
import './polyfills';

import foo from 'foo'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:31
  • Comments:13

github_iconTop GitHub Comments

8reactions
nmay231commented, Aug 6, 2021

@ayusharma How about support for prettier-ignore-start/-end?

import 'lib4';
import 'lib2';
// prettier-ignore-start
import 'lib6';
import 'lib1';
// prettier-ignore-end
import 'lib5';
import 'lib3';

Becomes

import 'lib2';
import 'lib4';
// prettier-ignore-start
import 'lib6';
import 'lib1';
// prettier-ignore-end
import 'lib3';
import 'lib5';

In essence, blocks of imports before and after the comment get sorted in their own separate groups; notice how lib4 stays in the top group and lib3 stays in the bottom.

4reactions
ayusharmacommented, Aug 6, 2021

We do not know where to put the import with // prettier-ignore. Let’s imagine the situation:

import x from 'x';
// prettier-ignore
import y from 'y';
import z from 'z';

Now where to put this ignored import? I don’t think that this feature will make the majority of our users happy. Please feel free to open the issue for further discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier: support .prettierignore : WEB-32711 - YouTrack
prettierignore file will only be considered if it's in the same directory as the package.json file or is in the root directory of...
Read more >
Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
Read more >
Support .prettierignore · Issue #131 · sveltejs/prettier-plugin-svelte ...
Turns out this is actually a problem with the VSCode extension not taking into account .prettierignore . All reactions.
Read more >
how to disable prettier formatting for individual files or folders
To disable prettier formatting on a single file, open the .prettierignore file and ... so don't forget to connect with me on social...
Read more >
prettier ignore all files | The AI Search Engine You Control
prettierignore file, --ignore-path CLI option, /* prettier-ignore */ comments and so on help wanted We're a small group who can't get to every...
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