Comments (9)
I first need an answer to eslint/eslint#1450
from linter-eslint.
+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.
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.
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.
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.
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.
You are right. I think this is the best option at the moment. Would you mind submitting a PR ?
from linter-eslint.
Sure thing: #18
from linter-eslint.
Should not break anymore but real plugin support would be cool.
from linter-eslint.
Related Issues (20)
- Clicking link to rule HOT 3
- doesn't detect the same id using error and not showing the red dot in any of the errors HOT 1
- Invalid position given by 'prettier/prettier' HOT 2
- Uncaught Error: Cannot find module '$ATOM_HOME/packages\linter-eslint\node_modules\atom-package-d... HOT 1
- Option to point to Node executable HOT 1
- Vue.js: 'unable to resolve path to module' if using the `@` alias to `src` folder HOT 6
- Using yarn pnp - invalid .eslintrc.js HOT 2
- Support for ESLint 8 HOT 5
- Issue with eslint-plugin-import with eslint 8.2.0 HOT 7
- Invalid position given by 'func-call-spacing' HOT 2
- Cant get ESLINT to work with local eslint in node_modules HOT 1
- Linter messages not appearing when using NextJs extension in .eslintrc.json HOT 4
- TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined HOT 4
- Not working with `create-react-app` HOT 4
- Bug: .ts and .tsx Issue with eslint 8.0.0 or above. Works fine with 7.32.0 or below. #15659 HOT 1
- Fix on save has stopped working HOT 3
- Cannot find module HOT 2
- Cannot install package on Atom
- Linter is installed but essential package is not!
- Using eslint v8.x results in "Error while running ESLint: eslint.CLIEngine is not a constructor" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linter-eslint.