fresh icon indicating copy to clipboard operation
fresh copied to clipboard

#475 Add warnings to terminal for possible route conflicts.

Open nhc opened this issue 2 years ago • 1 comments

Hi All.

I'm new to Deno and Fresh so please go easy on me ! This is my first attempt and contributing to this project. As it is quite new I was not able to find a comprehensive guide to contributing (I could help with that too if there are plans?) so I might have got quite a bit wrong. For example I've not written any tests.

This is my first attempt at solving issue/475 and I might have completely missed the point completely.

I'm looking for feedback and help on how to improve what I've done.

What it does do

  • in a function called routeWarnings in dev/mod.ts it looks at all the routes from the manifest
  • if there is a dynamic route and a static route in the same directory it adds them to a list
  • thenconsole.logs in red the following message from the list we've built up.
Screenshot 2022-07-23 at 21 09 39
  • if there are conflicts in a number of places it lists these out

I realise some things will need changing and improving (like I've used any as a type on line 153)

(totals: any, p) => ({ ...totals, [p.dir]: (totals[p.dir] || 0) + 1 }),

But I was hoping for some feedback in terms of if I'm in the right direction etc?

Also I have these questions

  1. Why is there no .gitignore ?
  2. Are there any plans or style guide / design system for the docs ?
  3. Is there a contributors guide that I'm missing?
  4. Why is my prettier working differently ? It has formatted a few exisiting things differently? Dont we need a prettier config file in the root of Fresh?

Thank you all feedback welcomed.

nhc avatar Jul 23 '22 20:07 nhc

@xstevenyung - Thank you so much for taking the time to answer my questions. I will fix this up some more. Makes a lot of sense about custom formatter etc, it just didnt cross my mind.

nhc avatar Jul 24 '22 19:07 nhc