Git Product home page Git Product logo

Comments (2)

kentcdodds avatar kentcdodds commented on May 18, 2024 1

To be clear... The problem is that because you run prettier first, it removes the space between the function name sortPlacesByDistance and the open paren (. Because of this, prettier doesn't do anything more to the function assignment line (normally it would break it down to the next line). Then when you run eslint --fix it adds it because you've configured space-before-function-paren which will add the space back again and now it's breaking the rule. Because eslint isn't capable of auto-fixing that rule, it remains that way.

It's out of scope for this project to fix an issue like that I'm afraid. You'll just have to change the code so it doesn't do that. This is how you could write it:

module.exports = function (x) {
  function sortPlacesByDistance (place_a, place_b) {
    return place_a.distance - place_b.distance;
  };
  sortPlacesByDistance(x);
};

or even:

module.exports = function(x) {
  const sortPlacesByDistance = function sortPlacesByDistance (placeA, placeB) {
    return placeA.distance - placeB.distance;
  };
  sortPlacesByDistance(x);
};

Good luck! Sorry that this is a little too much of an edge case for us to do anything about :-(

from prettier-eslint.

slacktracer avatar slacktracer commented on May 18, 2024

@kentcdodds

this is a little too much of an edge case for us to do anything about

I understand. =)

Thank you.

from prettier-eslint.

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.