Coder Social home page Coder Social logo

Improve `not` error messages about ow HOT 9 CLOSED

sindresorhus avatar sindresorhus commented on May 18, 2024
Improve `not` error messages

from ow.

Comments (9)

alexnoz avatar alexnoz commented on May 18, 2024 1

@kainiedziela the project's structure has changed since the PR was opened, so it's slightly outdated, I'll revisit the PR and update it tomorrow.

from ow.

SamVerschueren avatar SamVerschueren commented on May 18, 2024

From #71 (comment)

When I started implementing not, I was thinking about rephrasing messages automatically. I thought, If I always use to be, we could change that to not be. But then I had error messages where I couldn't use to be. So if we want clean messages for not, we might want to add an invertedMessage property to the validation object.

from ow.

sindresorhus avatar sindresorhus commented on May 18, 2024

I think we can automate most of it by creating helpers for the most common cases, like to be, and support an invertedMessage option for the few cases we can't automate.


Expected bar to be of type string but received type number

Could be automated to something like:

expectToBeOfType('bar', 'string', 'number');

from ow.

SamVerschueren avatar SamVerschueren commented on May 18, 2024

Good idea! I'll take a look when I find some time.

from ow.

erdahuja avatar erdahuja commented on May 18, 2024

@SamVerschueren @sindresorhus Can you help getting me started here. i want to start my first OS contribution.

from ow.

IssueHuntBot avatar IssueHuntBot commented on May 18, 2024

@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt

from ow.

alexnoz avatar alexnoz commented on May 18, 2024

AFAIU in almost all cases it's enough to just put not after the first to, like Expected 'value' to not be/have/match ..., and for the cases where this approach won't work, e.g. min/max length, we can add invertedMessage, right? If so, I'm halfway there 🙂

from ow.

kainiedziela avatar kainiedziela commented on May 18, 2024

Any further work being done on this issue? The proposed PR doesn't pass tests. I'm inclined to pick this up.

from ow.

issuehunt-oss avatar issuehunt-oss commented on May 18, 2024

@sindresorhus has rewarded $54.00 to @alexnoz. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00

from ow.

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.