Eslint hanging for at least 10 seconds after linting the first file - eslint

I use eslint to lint a project with Typescript and Javascript, but in this case I only lint .js files. The issue is that whatever the amount of files i have to lint, it always takes at least 10 seconds, even for one single .js file.
>set TIMING=1 && set DEBUG=eslint:cli-engine && eslint test1.js test2.js
eslint:cli-engine Lint C:\Users\...\test1.js +0ms
eslint:cli-engine Lint C:\Users\...\test2.js +11s
eslint:cli-engine Linting complete in: 11992ms +53ms
Rule | Time (ms) | Relative
:---------------------------------|----------:|--------:
indent | 44.130 | 78.5%
#typescript-eslint/no-unused-vars | 6.263 | 11.1%
comma-dangle | 2.226 | 4.0%
object-curly-spacing | 1.566 | 2.8%
semi | 0.661 | 1.2%
no-trailing-spaces | 0.423 | 0.8%
no-mixed-spaces-and-tabs | 0.276 | 0.5%
quotes | 0.264 | 0.5%
prefer-template | 0.168 | 0.3%
no-console | 0.113 | 0.2%
Rule | Time (ms) | Relative
:----|----------:|--------:
Whatever the file come first, it always hang for at least 10 seconds on the second file :
>set TIMING=1 && set DEBUG=eslint:cli-engine && eslint test2.js test1.js
eslint:cli-engine Lint C:\Users\...\test2.js +0ms
eslint:cli-engine Lint C:\Users\...\test1.js +11s
eslint:cli-engine Linting complete in: 11979ms +58ms
Rule | Time (ms) | Relative
:---------------------------------|----------:|--------:
indent | 47.228 | 80.6%
#typescript-eslint/no-unused-vars | 5.335 | 9.1%
comma-dangle | 2.306 | 3.9%
object-curly-spacing | 1.451 | 2.5%
semi | 0.685 | 1.2%
no-trailing-spaces | 0.463 | 0.8%
no-mixed-spaces-and-tabs | 0.350 | 0.6%
quotes | 0.268 | 0.5%
prefer-template | 0.261 | 0.4%
no-console | 0.153 | 0.3%
Rule | Time (ms) | Relative
:----|----------:|--------:
If I lint a whole bunch of folders (.ts & .js), it does the same. It hangs after the first file for at least 10 seconds.
Here is my .eslintrc.json : http://textsharing.com/2047/

Related

Running commands on a remote Linux is not working

I'm running a CentOS 7 and I want to execute commands on a remote server like that:
mclaw#ALHTACSS01 /home/mclaw>
mclaw#ALHTACSS01 /home/mclaw>
mclaw#ALHTACSS01 /home/mclaw> ssh -q hadoop1 "ndaf-cluster-status"
ksh: ndaf-cluster-status: not found
mclaw#ALHTACSS01 /home/mclaw>
mclaw#ALHTACSS01 /home/mclaw>
But if I login into the remote server and execute the command, it works:
mclaw#ALHTACSS01.default.masterclaw [mclaw] /home/mclaw>
mclaw#ALHTACSS01.default.masterclaw [mclaw] /home/mclaw> ssh -q hadoop1
Last login: Tue Sep 13 14:33:20 2022 from 192.168.59.53
ULP 5.0.13 Platform for MC 8.0 (ISO version 5.0.13)
Setting up the MasterClaw environment...
mclaw#ALHTAHAD01.default.masterclaw [mclaw] /home/mclaw>
mclaw#ALHTAHAD01.default.masterclaw [mclaw] /home/mclaw> ndaf-cluster-status
2022-09-13 14:43:36,945 INFO [main] client.RMProxy (RMProxy.java:createRMProxy(98)) - Connecting to ResourceManager at ALHTAHAD01.default.masterclaw/192.168.79.172:8032
+-------------------------------+------------+-------+-------------------------+--------+-------+-------+
| Cluster | HDFS State | Nodes | HDFS Used / Total Space | Proc | Disk% | Proc% |
+-------------------------------+------------+-------+-------------------------+--------+-------+-------+
| ALHTAHAD01.default.masterclaw | ONLINE | 10 | 8.06 TB / 15.69 TB | 61/142 | 51% | 43% |
+-------------------------------+------------+-------+-------------------------+--------+-------+-------+
+-------------------------------+------------+-------------------------+------+-------+-------+
| Node | YARN State | HDFS Used / Total Space | Proc | Disk% | Proc% |
+-------------------------------+------------+-------------------------+------+-------+-------+
| ALHTAHAD01.default.masterclaw | RUNNING | 825.51 GB / 1.57 TB | 8/13 | 51% | 62% |
| ALHTAHAD02.default.masterclaw | RUNNING | 832.40 GB / 1.57 TB | 5/15 | 52% | 33% |
| ALHTAHAD03.default.masterclaw | RUNNING | 830.62 GB / 1.57 TB | 9/15 | 52% | 60% |
| ALHTAHAD04.default.masterclaw | RUNNING | 826.81 GB / 1.57 TB | 7/15 | 51% | 47% |
| ALHTAHAD05.default.masterclaw | RUNNING | 831.79 GB / 1.57 TB | 6/15 | 52% | 40% |
| ALHTAHAD06.default.masterclaw | RUNNING | 826.67 GB / 1.57 TB | 6/15 | 51% | 40% |
| ALHTAHAD07.default.masterclaw | RUNNING | 823.74 GB / 1.57 TB | 8/13 | 51% | 62% |
| ALHTAHAD08.default.masterclaw | RUNNING | 824.58 GB / 1.57 TB | 5/13 | 51% | 38% |
| ALHTAHAD09.default.masterclaw | RUNNING | 823.97 GB / 1.57 TB | 3/13 | 51% | 23% |
| ALHTAHAD10.default.masterclaw | RUNNING | 816.04 GB / 1.53 TB | 4/15 | 52% | 27% |
+-------------------------------+------------+-------------------------+------+-------+-------+
+-------------+---------+--------------+-----------+------+
| Queue | State | Jobs W/R/C/F | Capacity | Used |
+-------------+---------+--------------+-----------+------+
| ColdStore | RUNNING | - | 0%- 80% | 0% |
| DWH-Summary | RUNNING | - | 0%- 70% | 0% |
| default | RUNNING | - | 5%- 25% | 0% |
| eoFB-query | RUNNING | 0/0/9/0 | 15%- 80% | 0% |
| eoSearch | RUNNING | - | 0%- 50% | 0% |
| eoXdr | RUNNING | - | 0%-100% | 0% |
| ndaf-tools | RUNNING | - | 5%- 25% | 0% |
| eoFB-index | RUNNING | 1/2/8327/0 | 15%-100% | 8% |
| DWH | RUNNING | 0/3/1664/0 | 60%-100% | 36% |
+-------------+---------+--------------+-----------+------+
mclaw#ALHTAHAD01 [mclaw] /home/mclaw>
I have tried to write the full path but still unsuccessful behavior:
mclaw#ALHTAHAD01 [mclaw] /home/mclaw>
mclaw#ALHTAHAD01 [mclaw] /home/mclaw> ssh -q hadoop1 "/opt/anritsu/mclaw/bin/ndaf-cluster-status"
/opt/anritsu/mclaw/bin/ndaf-cluster-status[16]: q7java: not found [No such file or directory]
mclaw#ALHTAHAD01 [mclaw] /home/mclaw>
The command you're trying to start apparently needs an environment setup that isn't completed unless you log in interactively. You could try these variants:
Excplicitly run your command through an interactive shell (I'm guessing at the path to your ksh here, you should check):
ssh -q hadoop1 /bin/ksh -i -c ndaf-cluster-status
Force allocation of a tty with -t:
ssh -qt hadoop1 ndaf-cluster-status
You can also combine the two, and you could try dropping -i, it may be enough to force it through a shell, without forcing it to be interactive. Or '-i' might not be enough, in which case you can try replacing -i with -l to make it a login shell. Which, if any, of the -i and -l options are needed depends on how your server is set up.
Edit: From the error message you posted in the comment, there seems to be progress! The "Setting up the MasterClaw environment" message means it't running the correct initialization file. I guess it really wants a tty (aka terminal) too, though, so try this:
ssh -qt hadoop1 /bin/ksh -l -c ndaf-cluster-status
(You shouldn't need both -i and -l, a login shell is always considered interactive, I think.)
If that still doesn't work, I'm out of ideas. You manage to start your program, but it tries to query the size of your terminal and fails. Debugging that requires knowledge of your program, and I have no idea what MasterClaw is.

How can I debug eslint rules?

I wanted to debug eslint rules for performance optimization.
Is there any way I can debug it using browser/command-line/tool?
You can use TIMING=1 when running on the command line:
$ TIMING=1 eslint lib
Rule | Time (ms) | Relative
:-----------------------|----------:|--------:
no-multi-spaces | 52.472 | 6.1%
camelcase | 48.684 | 5.7%
no-irregular-whitespace | 43.847 | 5.1%
valid-jsdoc | 40.346 | 4.7%
handle-callback-err | 39.153 | 4.6%
space-infix-ops | 35.444 | 4.1%
no-undefined | 25.693 | 3.0%
no-shadow | 22.759 | 2.7%
no-empty-class | 21.976 | 2.6%
semi | 19.359 | 2.3%
Documentation: https://eslint.org/docs/1.0.0/developer-guide/working-with-rules#per-rule-performance

Instanbul/Nyc only picking up some files

I tried to set up Istanbul/Nyc/Mocha for test coverage for my project and although I was able to run Nyc successfully, I am only able to see some files being picked up for test coverage not all the .ts files that I have.
So when I run
npm run coverage
I get
-----------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------------|---------|----------|---------|---------|-------------------
All files | 0 | 100 | 100 | 0 |
develop-potta | 0 | 100 | 100 | 0 |
swagger.ts | 0 | 100 | 100 | 0 | 1
develop-potta/models | 0 | 100 | 100 | 0 |
students.ts | 0 | 100 | 100 | 0 | 1
swaggerDefinition.ts | 0 | 100 | 100 | 0 | 1
develop-potta/routes | 0 | 100 | 100 | 0 |
routescontroller.ts | 0 | 100 | 100 | 0 | 4-5
This only covers about 50% of my code base. For example I have a develop-potta/DBConnection/OracleConnection.ts which is also a ts file which isn't being picked up by my script. I am unable to figure out why? Could it be a certain naming convention? Could it be that I didn't export those modules?
Typescript + mocha + nyc can be picky. Especially the all: true setting messes up the coverage a lot. But as you mention it's hard to bring it cover all files. My template repo covers those cases. Maybe it can help you.
https://github.com/Flowkap/typescript-node-template
If you're only interested in coverage check the .ncyrc.yml and mocharc.yml as well as the call config in package.json. VsCode launch configs also included.

Display date or time on the values axis (y-axis) of a chart in Excel

I have a process that produces widgets at a variable rate. The number of widgets produced every 5 minutes is reported to a log. Knowing how many widgets must be produced in total, I can use the number of widgets produced in any timeframe to compute the estimated time of completion (ETC) of the process. But how can I make Excel show the ETC on the y-axis?
For example, this data shows sample time; count of widgets since the process started; (computed) average number of widgets produced per minute from record 1 to the current record; and the (computed) ETC based on the average, the known total number of widgets (127830) to be produced, and the current time.
+-------------+-------+---------+-------------+
| Time | Count | Average | ETC |
+-------------+-------+---------+-------------+
| 11:39:20 AM | 256 | | |
| 11:44:20 AM | 13083 | 2617 | 12:27:20 PM |
| 11:49:20 AM | 27979 | 2798 | 12:24:20 PM |
| 11:54:20 AM | 28196 | 1880 | 12:47:20 PM |
| 11:59:20 AM | 28201 | 1410 | 1:09:20 PM |
| 12:04:20 PM | 28791 | 1152 | 1:29:20 PM |
| 12:09:20 PM | 28936 | 965 | 1:51:20 PM |
| 12:14:20 PM | 52237 | 1492 | 1:04:20 PM |
| 12:19:20 PM | 56599 | 1415 | 1:09:20 PM |
| 12:24:20 PM | 59948 | 1332 | 1:14:20 PM |
| 12:29:20 PM | 66523 | 1330 | 1:15:20 PM |
| 12:34:20 PM | 69557 | 1265 | 1:20:20 PM |
| 12:39:20 PM | 74458 | 1241 | 1:22:20 PM |
| 12:44:20 PM | 80642 | 1241 | 1:22:20 PM |
+-------------+-------+---------+-------------+
When I chart this in Excel, I get the ETC (time) values as fractions of a day.
I see the y-axis has a property named "Display units" that allows me to show the values as thousands or millions, but not date or time. Am I missing something, or is this just a limitation of Excel?
Right-click on the labels and choose "Format Axis from the drop down menu
Under "Number", choose the number format you want (Time)
This should give you the desired result:

ionic 2 project reports 97% coverage but sonar reports 0% coverage

I'm trying to integrate an ionic project with sonar, and everything seems to be OK but the coverage, tests are developed with jest and the test:coverage task (jest --coverage) is reporting a 97% but I get a 0 coverage in sonar.
npm run test:coverage result:
Test Suites: 5 passed, 5 total
Tests: 14 passed, 14 total
Snapshots: 0 total
Time: 3.004s
Ran all test suites.
-----------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------------------------------|----------|----------|----------|----------|----------------|
All files | 97.53 | 75 | 84.85 | 97.22 | |
app | 100 | 76.92 | 100 | 100 | |
app.component.ts | 100 | 76.92 | 100 | 100 | 14 |
app.html | 100 | 100 | 100 | 100 | |
pages/appointment | 100 | 100 | 100 | 100 | |
appointment.module.ts | 100 | 100 | 100 | 100 | |
pages/appointment/appointmentItem | 100 | 76.92 | 100 | 100 | |
appointmentItemPage.html | 100 | 100 | 100 | 100 | |
appointmentItemPage.ts | 100 | 76.92 | 100 | 100 | 17,18 |
pages/appointment/appointmentList | 94.12 | 75 | 80 | 93.33 | |
appointmentListPage.html | 100 | 100 | 100 | 100 | |
appointmentListPage.ts | 93.75 | 75 | 80 | 92.86 | 32 |
pages/home | 85.71 | 66.67 | 66.67 | 83.33 | |
home.html | 100 | 100 | 100 | 100 | |
home.ts | 83.33 | 66.67 | 66.67 | 80 | 16 |
providers/appointment | 100 | 66.67 | 83.33 | 100 | |
appointmentData.ts | 100 | 100 | 83.33 | 100 | |
appointmentProvider.ts | 100 | 66.67 | 100 | 100 | 21 |
prospectData.ts | 100 | 100 | 66.67 | 100 | |
-----------------------------------|----------|----------|----------|----------|----------------|
The coverage/lcov.info it's been correctly generated (abstract of a file):
TN:
SF:/home/jmgomez/securitas/sst/src/app/app.component.ts
FN:11,(anonymous_2)
FN:14,MyApp
FN:15,(anonymous_4)
FNF:3
FNH:3
FNDA:1,(anonymous_2)
FNDA:1,MyApp
FNDA:1,(anonymous_4)
DA:11,1
DA:12,1
DA:15,1
DA:18,1
DA:19,1
DA:22,1
LF:6
LH:6
BRDA:14,0,0,1
BRDA:14,0,1,0
BRDA:14,1,0,1
BRDA:14,2,0,1
BRDA:14,2,1,1
BRDA:14,2,2,0
BRDA:14,3,0,1
BRDA:14,3,1,1
BRDA:14,4,0,1
BRDA:14,4,1,1
BRDA:14,4,2,0
BRDA:14,5,0,1
BRDA:14,5,1,1
BRF:13
BRH:10
end_of_record
And linked into the sonar-project.properties file:
sonar.projectKey=sst:app
sonar.projectName=sst_app
sonar.projectVersion=1.0
sonar.sources=./src/
sonar.tests=.
sonar.test.inclusions=**/*.spec.ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
This is the listing for the coverage folder
ls coverage/ -la
total 36
drwxrwxr-x 3 myuser mygroup 4096 ene 3 12:01 .
drwxrwxr-x 11 myuser mygroup 4096 ene 3 11:57 ..
-rw-rw-r-- 1 myuser mygroup 19778 ene 3 11:57 coverage-final.json
-rw-rw-r-- 1 myuser mygroup 4032 ene 3 11:57 lcov.info
drwxrwxr-x 7 myuser mygroup 4096 dic 20 15:27 lcov-report
Related log lines for sonnar-scanner command are the following:
INFO: Excluded sources:
INFO: **/*.spec.ts
INFO: Included tests:
INFO: **/*.spec.ts
INFO: 35 files indexed
...
INFO: Sensor TypeScript LCOV Coverage Sensor [typescript]
INFO: Sensor TypeScript LCOV Coverage Sensor [typescript] (done) | time=4ms
INFO: Sensor JavaScript Squid Sensor [javascript]
INFO: 1 source files to be analyzed
INFO: Test Coverage Sensor is started
INFO: 1/1 source files have been analyzed
INFO: Analysing [/home/jmgomez/securitas/sst/coverage/lcov.info]
INFO: Sensor JavaScript Squid Sensor [javascript] (done) | time=135ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=29ms
Any hint?, Am I missing something?

Resources