mantoni / eslint_d.js Goto Github PK
View Code? Open in Web Editor NEWMakes eslint the fastest linter on the planet
License: MIT License
Makes eslint the fastest linter on the planet
License: MIT License
I just want to use eslint_d like "./node_modules/.bin/eslint . --ext .vue"
Can you tell me how ?
Hello,
I would like to use nc
to pass stdin into eslint_d
. Is this possible?
I tried using
cat file.js | cat <(echo "$TOKEN $PWD --stdin") - | nc -q 0 localhost $PORT
as seen here, but it only prints
RangeError: "size" argument must not be larger than 2147483647
# exit 1
Thanks
I tried using this with a SSH Box (pretty plain Ubuntu 16.04 setup) but it doesn't seem to be triggering. Is there anything special about getting it working on something other than the default Cloud 9 EC2 instance?
It seems like in version 2.2.0 eslint_d --help
outputs eslint
help without mentioning eslint_d
commands.
I am missing some documentation on how this thing works. Specifically:
--debug
did not really show anything.Hi,
I installed eslint_d globally npm i eslint_d -g
and tried to lint a file but when i run eslint_d app.js
nothing happens(more than 2min without anything) while the eslint app.js
cmd display the lint errors.
I tried eslint_d status
and i have this message could not connect
.
I checked the ~/.eslint_d
and the file has one line 53288 59a364a04c2ec7b5
.
The eslint_d --version
give me this v3.14.1 (eslint_d v4.2.1)
, the help cmd for eslint_d
works also(the same output of eslint --help
).
Is there a log file that i can take a look to understand why eslint_d could not connect ?
Thanks
As your software was created to improve eslint speed, you could maybe specify that to get an even better speed improvement, you can use --cache (which is an eslint option).
What do you think ?
I'm running [email protected]
on [email protected]
with [email protected]
on a Win7x64 box.
eslint_d test.js
just hangs forever, as does any other eslint_d
command. Am I misunderstanding how to use this?
I don't see it creating a ~/.eslint_d_port
file, so I suspect something is failing somewhere and just never outputting.
It looks like bug with options
eslint_d src/1.js --config ./.eslintrc
... // some errors
/Users/roadhump/Projects/xx/src/1.js: line 5, col 1, Error - Multiple blank lines not allowed. (no-multiple-empty-lines)
/Users/roadhump/Projects/xx/.eslintrc: line 2, col 13, Error - Line X: Unexpected token
7 problems
Thank you.
flycheck-eslint now uses --print-config
to verify that a file has a config. This doesn't work in eslint_d
, effectively disabling it.
Having something like this, fails with eslint_d but works with eslint.
@observer
export default class MyComponent extends Component {
...
}
// throws
error Parsing error: Unexpected character '@'
I am using the babel-eslint
parser.
// .babelrc
{
"presets": ["es2015", "react", "stage-1"],
"plugins": ["transform-decorators-legacy"]
}
I am a bit confused why eslint works but eslint_d does not.
Hey man, thanks for making sublime linting great again! Your eslint_d.js is a joy to use.
However while testing, i was playing with moar speed, it works and it's great but I get a performance hit when i use that option.
Since i have no clue how to use nc
, i can't revert back to previous state. Can you please update your README detailing how to revert back . Thanks anyways!
In the screenshot, it shows 1.3GB RAM consumption but i have seen it's memory consumption way above.
I have the following options in my .eslintrc
{
"parserOptions": {
"ecmaVersion": 2016
}
}
This is valid when I use the eslint
command directly. My eslint --version
is v3.19.0
. It is correctly linting my files.
However, when I use eslint_d
instead, I get this error instead:
/Users/andy/Desktop/ipmask.js
0:0 error Parsing error: ecmaVersion must be 3, 5, 6, or 7
โ 1 problem (1 error, 0 warnings)
The eslint_d --version
says v3.19.0 (eslint_d v4.2.5)
. So the eslint version is the same but parsing fails when it should be valid. I tried reinstalling eslint_d
and I ran eslint_d restart
but no luck.
eslint_d --config "c:\space-containing path\.eslintrc"
gives
Error: Cannot read config file: c:\space-containing
Error: ENOENT, no such file or directory 'c:\space-containing'
At least on Windows.
First of all, this project is really usually to me, so, thanks! I've been testing it and faced the following issues:
If it's a misconfiguration from my side, sorry.
At the moment, --fix
writes to the file. This makes it difficult to add as a pre-save hook in editors. There is no official support for writing the fixed output to stdout via the cli (see eslint/eslint#6612) but it can be done w/ the api.
It'd be great to have eslint_d
support that for the added speed boost, but it'd be a non-standard flag. Would you be up for having that in eslint_d
?
here is my vimrc file ,i wanna to autofix eslint file
" settings for Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_check_on_w = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exec = 'eslint_d'
"let g:syntastic_javascript_eslint_args = '--fix-to-stdout'
g:syntastic_javascript_eslint_args
g:syntastic_javascript_eslint_tail
seems not work
I have a .eslintrc.json
in my home directory and a package.json
in my project directory with eslint configs, but when running eslint_d test.js
for some file in the project directory eslint_d ignores package.json
and proceeds to use the config from the home directory. eslint
doesn't have this problem.
Any plans to extend support to Atom? I'm currently liniting on save via linter & linter-eslint.
Currently it exits w/ 0.
Hey @mantoni I've recently started trying out prettier
along with prettier-eslint
. It'd be great to somehow be able to have eslint_d run code through prettier before passing it to fix.
I could build it in as an explicit feature (is it weird to couple eslint_d to a completely different tool?) or I could make some sort of prefilter plugin interface... Ideally I could use something like eslint-plugin-prettier
but I have rules that disagree w/ prettier, so it won't work int hat way.
Thoughts?
ESLint now offers a --fix-dry-run
option. I think it would be a good idea to alias --fix-dry-run
to the existing --fix-to-stdout
option in eslint_d
. Then it will be easier to swap out ESLint commands with eslint_d
for use in various editor plugins.
My machine was, by default, attempting to connect to eslint_d over IPv6 before trying IPv4, which caused a considerable slowdown. It'd be nice if this ran, by default, on both 127.0.0.1 and ::1
Hi @mantoni, first of all, many thanks for the brilliant work on eslint_d
๐
I have stumbled upon an issue when working on eslintme that is the default value for the format
option. The problem is that vim and probably other editors will expect a non-styled output, e.g. compact
format.
To work around that limitation, my quick n'dirt solution was to point to a forked branch that replaces the default value of the compact option, as you can see here: ruyadorno@f7d4746
While the solution is working well for me, I don't feel like it's a proper solution in the long term. What I think would be a much better solution is to add the format option to eslint_d start
command and store this value for every subsequent linting.
I would like to hear your thoughts about it, is it something that you would like to see on eslint_d
? Would you be open to merge a PR introducing these changes? There could be better ways to achieve the same functionality?
sorry for the long message ๐ thanks again!
When using eslint-plugin-flowtype-errors
in Windows, eslint executes flow
to determine FlowJS errors. When running eslint_d
, this causes a visible command window to appear and steal focus from the editor. This happens when executing eslint_d
from a command window also.
This behavior does not happen when executing eslint
from the command line.
I would be happy to send a PR, but I need a pointer in the right direction. I glanced through the code and the solution was not obvious to me.
eslint_d
does not resolve local plugins in project's node_modules
as eslint
does
It means
npm install eslint eslint_d babel-eslint --save-dev
// .eslintrc
{"parser": "babel-eslint"}
$ ./node_modules/.bin/eslint_d src/1.js
/Users/roadhump/Projects/xx/src/1.js
0:0 error Cannot find module 'babel-eslint'
$ ./node_modules/.bin/eslint_d src/1.js
// no errors
Hi! I'm a vim user and experience blocking lag with eslint, and still do with eslint_d. I've noticed that my project setup seems to be part of the problem, but since changing my project directory organization isn't an option I'm looking for a solution.
The problem is that I have two javascript projects, an api in node and a react app that consumes that api. So I have a structure like:
- project
-- api
-- frontend
I open vim and and run eslint_d from the project directory but there are unique .eslintrc and node_modules
files in the api/react directories. I'm guessing that eslint_d is having to do some work to reconcile the fact that it's one directory above the node_modules and figure out which eslint bin to use?
This tool is fairly stable which leads to a situation where the daemon process is running for several weeks or even month. It keeps all instances of eslint cached in memory that have been used with no eviction mechanism, leading to quite a bit of ram being "wasted".
It should be fairly straight forward to implement a periodic check for instances that have not been used for a couple of hours and remove those.
Just putting this out as an idea. If you feel like implementing, go for it! ๐
Hi,
linter.js in eslint_d does not pass the directories from NODE_PATH into resolve.sync, so it's running into browserify/resolve#39
This is manifested in the form of
Error: Cannot find module 'eslint' from '$eslint_d_parent/eslint_d/lib'
where $eslint_d_parent is eslint_d's parent directory and eslint is present elsewhere in $NODE_PATH.
Problematic lines in linter.js:
module.exports = function (cwd, args, text) {
process.chdir(cwd);
var cwdDeps = eslintMap[cwd];
if (!cwdDeps) {
var eslintPath;
try {
eslintPath = resolve.sync('eslint', { basedir: cwd });
} catch (e) {
// module not found
eslintPath = resolve.sync('eslint');
}
cwdDeps = eslintMap[cwd] = {
eslint: require(eslintPath),
// use chalk from eslint
chalk: require(resolve.sync('chalk', {
basedir: path.dirname(eslintPath)
}))
};
}
Suggested fix -- looking up NODE_PATH from Module.globalPaths and passing that as resolve.sync's paths option:
var globalPaths = require('module').globalPaths;
module.exports = function (cwd, args, text) {
process.chdir(cwd);
var cwdDeps = eslintMap[cwd];
if (!cwdDeps) {
var eslintPath;
try {
eslintPath = resolve.sync('eslint', { basedir: cwd, paths: globalPaths });
} catch (e) {
// module not found
eslintPath = require.resolve('eslint');
}
cwdDeps = eslintMap[cwd] = {
eslint: require(eslintPath),
// use chalk from eslint
chalk: require(resolve.sync('chalk', {
basedir: path.dirname(eslintPath),
paths: globalPaths,
}))
};
}
Hi! Love this thing.
So, I've been running into lots of projects that use standard, which means there's no eslint config files in the project, which means eslint_d doesn't know what rules to use. ( you run the linter with standard foo.js
instead of eslint foo.js
)
I was bugging the nice people at eslintd-fix about it and trying to figure out how to get emacs to use the right linter, but then I got to thinking, maybe here would be a better place to address?
Curious what you'all think about detecting standard
in package.json or node_modules, and spinning that up instead of eslint? I guess it's awkward to special-case stuff in like this, but on the other hand, standard is so widely used.
Right now the order to find eslint is
I prefer to use a global eslint installation to save space and avoid updating micromanagement. Would it be possible to have a loading order like this?
Take this .eslintrc
{
"rules": {
"space-infix-ops": 2
}
}
and this js
var foo=function (bar) {
return bar;
};
eslint .
and eslint_d .
both produce the same output :
/tmp/eslint_t/bootstrap.js
1:8 error Infix operators must be spaced space-infix-ops
However
eslint . --fix
does modify the file
eslint_d . --fix
doesn't modify the file
eslint_d doesn't work with vim if eslint
and eslint plugins like 'eslint-plugin-react' are not installed locally. While use eslint
, the linting works even eslint
and it's plugins are installed globally.
I think the emacs section about auto-fixing grabs too much land in the README. I would like that to live elsewhere and be cross-linked into the README to have this as one or two line bullet point.
@aaronjensen You mentioned you would like to move this into a separate project, but we can also just enable the Wiki for this project. Alternatively, it could be a snippet that lives in a separate file in this repository if we find a good place for it. What do you think?
This project needs test cases. It started off as a quick hack, but as more features are added and bugs are fixed, test cases would be great to ensure the existing functionality does not break.
I prefer Mocha tests with simple not assert
s. The implementation is already split up into testable units.
Currently eslint_d
cannot be used as a drop-in replacement for eslint
because the return status is always 0 ๐ข
Hello,
I am seeing a strange problem in eslint_d v3.1.0. It does not seem to include the rule "no-prototype-builtins" which is included in the same version of eslint (v2.11.1, http://eslint.org/docs/rules/no-prototype-builtins)
Please note I also tried to include debug information for you (eslint_d --debug index.js
) but the --debug command line argument does not seem to do anything.
Environment
> node --version
v4.4.4
> npm --version
3.9.5
> eslint_d --version
v2.11.1 (eslint_d v3.1.0)
Configuration
module.exports = {
"extends": "eslint:recommended",
"env": {
"es6": true
},
"rules": {
// Disallow use of Object.prototypes builtins directly
"no-prototype-builtins": [
"error"
]
}
};
Error
> eslint_d index.js
/Users/bruces/Projects/eslint-config-blacksun1/index.js
1:1 error Definition for rule 'no-prototype-builtins' was not found no-prototype-builtins
โ 1 problem (1 error, 0 warnings)
I was able to see this error in Sublime text using the Sublime Linter plugin and from the command line.
Thanks in advance,
Hi, I am impressed by eslint_d's performance, can I use it on VSCode? I couldn't find anything related from the doc.
Hi, I still the problem of eslint
which is installed globally. Currently, if eslint_d cannot found eslint
under working dir, it will load the eslint
which installed under eslint_d
.
Everything works just fine until I need to load eslint-plugin-*
. these plugins are installed globally also. And they are loaded by eslint
.
eslint
seems not looking for global plugins
if it's installed and loaded as a local module. An issue may relevant to this: eslint/eslint#4472
I am just thinking that would it makes more sense for eslint_d
to load global eslint
instead of local eslint
under eslint_d
?
I made a small change to the way of loading eslint
, and I tested it with eslint_d cli
and vim
. It works just fine.
I will make a pull request for this :)
I've been having some intermittent issues with eslint_d, and I had a couple questions.
I didn't know if eslint_d needed to be supplemented with a config similar to mtscout6/syntastic-local-eslint.vim to ensure it always resolves the local project config modules.
I'm encountering intermittent issues where I have to run eslint_d restart
in order to get eslint_d to work again with Syntastic. After enabling g:syntastic_debug
and determining the eslint_d command being used, I found there were errors similar to this:
eslint_d -f compact src/config/env.js
Error: standard:
Configuration for rule "no-labels" is invalid:
Value "2,[object Object]" has more items than allowed.
Referenced from: tribou
Referenced from: /Users/tribou/dev/project/.eslintrc
The error is from the eslint-config-standard
module, but it's associated with using eslint v1.x, so I'm not sure what to do with that. However, after running eslint_d restart
in the project directory, the issue appears to resolve itself. Any ideas?
v2.8.0 (eslint_d v3.1.0)
Hi!
Awesome work, love the speed =)
Let me first specify the version I get when running eslint_d -v
:
v2.10.2 (eslint_d v3.1.0)
Say I have a folder which contains a node_modules folder with eslint installed.
There is no .eslintrc in that folder, but there is one in my home directory ~/myHome/.eslintrc
The .eslintrc extends some config, or uses a certain plugin, lets say eslint-config-angular that is installed globally but not in myProject.
Now, if I would run eslint src/**/*js
inside myProject, it all works fine. It searches up the tree to my home, finds the .eslintrc and tries to find eslint and its plugins etc from the global installed packages. So basicly it seems to search relative to the .eslinrc, and since its in home it uses global installed packages.
If I run eslint_d src/**/*.js
however I get an error Error: Cannot find module 'eslint-config-angular' from '/home/myHome/myProject/node_modules'
. It seems that eslint_d searches for eslint and companions relative to the folder its executed in, not relative to the .eslintrc it uses.
It would be nice to have all possible options of eslint
in eslint_d
call: config
, format
, no-ignore
, etc.
E.g
eslint_d lint --config some/config file.js
Hey,
An otherwise very useful daemon, but please, ASAP, stop listening on 0.0.0.0 or, better yet, listen through a file based socket that is only accessible to the current user!
I'd like to use eslint 2.7.0 -- it seems that because it's specified in dependencies
here, that's not possible when using eslint_d?
What would speak against putting it into peerDeps?
While I'm trying
" Autofix entire buffer with eslint_d:
nnoremap <leader><leader>f mF:%!eslint_d --stdin --fix-to-stdout<CR>`F
" Autofix visual selection with eslint_d:
vnoremap <leader><leader>f :!eslint_d --stdin --fix-to-stdout<CR>gv
I got the errors of some modules or plugins can't find
"Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react' โ
So I know it means I need change the config to locale instead of global
But I don't know how
Here is my eslintrc.json :
{
"extends": "airbnb"
}
eslint_d
should work with stdin as eslint
does, it is almost critical for IDE integrations.
Eslint is now at version 2.2.0
Any reason for not updating to that version of eslint ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.