Comments (11)
strange, what versions of prettier and prettier-loader do you use?
from prettier-loader.
and could you provide examples of code with comments?
from prettier-loader.
"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.
Could you please provide example of jsx code where you write comments
from prettier-loader.
I mean how you write comments inside jsx?
from prettier-loader.
Like this
http://take.ms/JbJ8w
Just at the top of the file.
from prettier-loader.
Thanks, I think I'll add test for this case today, and take a look what's going on
from prettier-loader.
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.
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.
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.
fixed in #12
npm version 2.1.0
from prettier-loader.
Related Issues (13)
- Webpack compile twice when js file changed HOT 14
- After build uglify plugin fires exception in every file HOT 8
- Please give me the npm package name 'prettier-loader' HOT 2
- No version 2.2.0 in the Npm software registry.
- How to use with the .prettierrc file HOT 1
- error with babel HOT 3
- prettier.config.js file spesify path webpack HOT 3
- Wrong engine version HOT 6
- Issue with prettier-loader and *.vue files HOT 1
- Disabling prettier-loader when webpack starts HOT 4
- Prettier shouldn't be a dependency HOT 2
- Detect parser automatically
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-loader.