Git Product home page Git Product logo

Comments (9)

jfaissolle avatar jfaissolle commented on May 17, 2024

I first need an answer to eslint/eslint#1450

from linter-eslint.

killercup avatar killercup commented on May 17, 2024

+1

Any progress so far? It's blocking me using any eslint plugins since linter-eslint crashes trying to read my .eslintrc

from linter-eslint.

jfaissolle avatar jfaissolle commented on May 17, 2024

I am sorry to say that I did not make any progress recently. For now, I have no idea of how to do it properly because of how plugins are loaded. I must think about it a bit more.

from linter-eslint.

killercup avatar killercup commented on May 17, 2024

I can imagine the difficulties: The plugins (incl. versions) are defined in a project (directory) and can't be known beforehand, so you'd have to install them when reading a project's .eslintrc and even store them per-project. That's not easy and probably a bad solution anyway.

Is there a chance you might parsing the .eslintrc a bit more robust, e.g. by stripping/ignoring all unknown rules. This is not a good solution for eslint itself but for an editor plugin, it might ensure future compatibility (and prevent crashes on unknown plugins).

That being said, there are currently only a handful of eslint plugins. You might want to decide to include a few of them in linter-eslint (I would certainly welcome it).

from linter-eslint.

jfaissolle avatar jfaissolle commented on May 17, 2024

The problem is that the config (.eslintrc) loading and merging is delegated to the eslint API to ensure a consistent behaviour with the command line. So at the moment I see the following options:

  • add all existing plugins like you propose (easy but not future-proof)
  • ask the eslint team for a change in their API to avoid error when plugin is not found (difficult to obtain)
  • use something like https://www.npmjs.org/package/app-module-path to add additional module directories to the node module path (dangerous, can be a bad behaviour for an atom plugin)
  • use the previous solution but in an external process to avoid polluting atom

from linter-eslint.

killercup avatar killercup commented on May 17, 2024

Sounds like the best option for now would be option 2, i.e. adding a silent error option to eslint.

From a quick code search, it looks like this else branch is all that needs to change for missing rule errors to be silent.


Wait—you wrote that "loading and merging is delegated to the eslint API". But that just means that you retrieve the config from eslint, to then pass that config object to linter.verify. I added a breakpoint to this line, got the config and was able to modify it before passing it on to linter.verify:

# Line 43
config = engine.getConfigForFile(origPath)
config.plugins = _.omit(config.rules, (val, key) -> _.contains(key, '/'))

result = linter.verify @editor.getText(), config
# ...

If I'm not mistaken, this is all you need to remove plugin-based rules.

from linter-eslint.

jfaissolle avatar jfaissolle commented on May 17, 2024

You are right. I think this is the best option at the moment. Would you mind submitting a PR ?

from linter-eslint.

killercup avatar killercup commented on May 17, 2024

Sure thing: #18

from linter-eslint.

jfaissolle avatar jfaissolle commented on May 17, 2024

Should not break anymore but real plugin support would be cool.

from linter-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.