Giter Site home page Giter Site logo

Comments (5)

hudochenkov avatar hudochenkov commented on May 12, 2024

Currently, I set up project-specific settings override as a workaround for this issue:

{
    "folders":
    [
        {
            "path": "."
        }
    ],
    "settings": {
        "ESLint-Formatter": {
            "eslint_path": {
                "osx": "/Users/aleks/project/node_modules/.bin/eslint"
            }
        }
    }
}

from eslint-formatter.

TheSavior avatar TheSavior commented on May 12, 2024

@ramiel, how should this be handled?

from eslint-formatter.

ramiel avatar ramiel commented on May 12, 2024

I'll look at this tomorrow. We should stop at the project root instead of the first package.json probably.

from eslint-formatter.

ramiel avatar ramiel commented on May 12, 2024

The problem can be a bit complex. At the moment we go up, starting from the current directory, and we stop at the first package.json we find. Then we suppose that is the point were eslint is installed. Setup like the one from @hudochenkov show that this is not always the case. We have so two possibilities.

  • Look if the package.json reference eslint among its dependencies
  • Look if a .eslint.* file is present

The latter is not affordable because eslint allow to have more than one file and do not enforce you to put "root": true in the top one.
Reading the content of the package.json file instead is heavy, considering that the plugin has no cache system and that this operation is performed everytime a file if linted (easily at every save).
It looks to me that using a per-project configuration for cases like this is the most viable solution.
@TheSavior have you any other idea?

from eslint-formatter.

ramiel avatar ramiel commented on May 12, 2024

Another idea is to look for the first path where is present node_modules/eslint. This rely on the structure of the node_modules folder itself, which should be reliable until npm change it again or another fancy package manager is used. But it's fast. I'll propose a PR and we continue to discuss there

from eslint-formatter.

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.