Coder Social home page Coder Social logo

Comments (11)

iamolegga avatar iamolegga commented on June 12, 2024

strange, what versions of prettier and prettier-loader do you use?

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

and could you provide examples of code with comments?

from prettier-loader.

DrBoria avatar DrBoria commented on June 12, 2024
"prettier": "^1.10.2",
"prettier-loader": "^2.0.1",
"webpack": "^3.10.0",

Well. I user prettier loader with webpack-dev-server. And I'v got file with react routes. Each route is longer, than 120 symbols (that I set in prettier-loader config), but event after adding 'ignore', 'disable' etc. comments it changes file with routes.

Config for prettier loader in webpack
{ test: /\.jsx?$/, use: { loader: 'prettier-loader', options: { useTabs: false, tabWidth: 2, singleQuote: true, printWidth: 120, trailingComma: 'all', bracketSpacing: true, arrowParens: 'always' }, } }

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

Could you please provide example of jsx code where you write comments

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

I mean how you write comments inside jsx?

from prettier-loader.

DrBoria avatar DrBoria commented on June 12, 2024

Like this
http://take.ms/JbJ8w
Just at the top of the file.

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

Thanks, I think I'll add test for this case today, and take a look what's going on

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

Sorry for so long waiting, as @rchaser53 just wrote in another issue, his own version of prettier-loader does support of .prettierignore files, so you can try it:
https://github.com/rchaser53/prettier-loader, or wait for a week (I hope so) until I’ll fix it in this package

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

So, I just added test for ignoring prettier using comments, and it works, see this commit, because it's the same as if you just tried to run prettier-cli on your code.
The next thing is to check/fix work with .prettierignore file, working on it

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

What about trying to prevent formatting with comment, I think the problem that

A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting.

And the next node in the abstract syntax tree in your example is // prettier-disable and all next code will be formatted.

So yes, if you want to ignore the whole file it's better to keep it in .prettierignore

from prettier-loader.

iamolegga avatar iamolegga commented on June 12, 2024

fixed in #12

npm version 2.1.0

from prettier-loader.

Related Issues (13)

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.