Git Product home page Git Product logo

Comments (10)

anymaniax avatar anymaniax commented on May 13, 2024 2

Prettier is use as dev dependency at the moment. That's a new feature that can be added but should be config in the orval config file. Also could be good to try to find a prettier config in the project and not only apply a custom config.

from orval.

anymaniax avatar anymaniax commented on May 13, 2024 1

yep, it's a bug need to find a better solution for this

from orval.

Boorj avatar Boorj commented on May 13, 2024

Have some concerns about using hardcoded config instead of flexible user config. But as a default option - definitly.

p.s. @anymaniax, btw have you checked https://openapi.tools ? Orval deserves to be in the list.

from orval.

anymaniax avatar anymaniax commented on May 13, 2024

@Boorj I didn't know about https://openapi.tools could be interesting to add Orval there

from orval.

anymaniax avatar anymaniax commented on May 13, 2024

@Boorj We should only use the hardcoded config when we cannot find the user config in its own project. And what I meant is to add a property in the orval config to activate prettier or override the config found or the default one.

from orval.

melloware avatar melloware commented on May 13, 2024

I am having trouble with this feature. I have Orval and Prettier in my devDependencies

        "orval": "^6.5.3",
        "prettier": "^2.5.1",

When I run npm run codegen i get this output..

⚠️ authorization - Prettier not found
🎉 authorization - Your OpenAPI spec has been converted into ready to use orval!

from orval.

anymaniax avatar anymaniax commented on May 13, 2024

Probably because with this code it's only using the global installed prettier

from orval.

melloware avatar melloware commented on May 13, 2024

hmmm i dont have prettier installed globally.

from orval.

c0m1t avatar c0m1t commented on May 13, 2024

You can run prettier on pre-commit hook. Probably another solution could be to add prettier as a peer dependency.

Also, I made a pull request #459 where you can run a script (prettier, lint, etc...) when client is generated by orval.

from orval.

melloware avatar melloware commented on May 13, 2024

This is easy too..

"scripts": {
		"format": "prettier --write \"{src,__tests__}/**/*.{ts,tsx}\"",
		"codegen": "orval && npm run format",
		"start": "react-app-rewired start"

from orval.

Related Issues (20)

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.