ko-lints 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/eslint/parser.js +3 -0
- package/lib/factory/runner.js +4 -3
- package/lib/threads/Pool.js +1 -1
- package/package.json +3 -3
package/lib/eslint/parser.js
CHANGED
|
@@ -26,6 +26,9 @@ class ESLintParser extends parser_1.default {
|
|
|
26
26
|
let resultText = '';
|
|
27
27
|
try {
|
|
28
28
|
const result = await this.eslintInstance.lintFiles(file);
|
|
29
|
+
if (this.opts.write) {
|
|
30
|
+
await ko_lint_config_1.eslint.ESLint.outputFixes(result);
|
|
31
|
+
}
|
|
29
32
|
if (result[0].errorCount) {
|
|
30
33
|
resultText = formatter.format(result);
|
|
31
34
|
}
|
package/lib/factory/runner.js
CHANGED
|
@@ -42,8 +42,9 @@ class LintRunnerFactory {
|
|
|
42
42
|
return acc;
|
|
43
43
|
}, []);
|
|
44
44
|
}
|
|
45
|
-
getConcurrentNumber(num) {
|
|
46
|
-
|
|
45
|
+
getConcurrentNumber(entriesCount, num) {
|
|
46
|
+
const initNumber = num ? num : (0, os_1.cpus)().length;
|
|
47
|
+
return initNumber < entriesCount ? initNumber : entriesCount;
|
|
47
48
|
}
|
|
48
49
|
async run(entries) {
|
|
49
50
|
let ret;
|
|
@@ -60,7 +61,7 @@ class LintRunnerFactory {
|
|
|
60
61
|
const { concurrentNumber, write, configPath } = this.opts;
|
|
61
62
|
const threads = new threads_1.default({
|
|
62
63
|
entries,
|
|
63
|
-
concurrentNumber: this.getConcurrentNumber(concurrentNumber),
|
|
64
|
+
concurrentNumber: this.getConcurrentNumber(entries.length, concurrentNumber),
|
|
64
65
|
write,
|
|
65
66
|
configPath,
|
|
66
67
|
name: this.childOpts.name,
|
package/lib/threads/Pool.js
CHANGED
|
@@ -7,7 +7,7 @@ class ThreadPool {
|
|
|
7
7
|
this.workers = [];
|
|
8
8
|
this.workerPList = [];
|
|
9
9
|
this.stdout = [];
|
|
10
|
-
console.log(
|
|
10
|
+
console.log(`Using concurrent mode with ${opts.concurrentNumber} threads...`);
|
|
11
11
|
this.opts = opts;
|
|
12
12
|
this.queue = this.opts.entries;
|
|
13
13
|
this.format();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ko-lints",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "lint tools used by ko",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ko",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"fast-glob": "^3.2.11"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"ko-lint-config": "2.
|
|
32
|
+
"ko-lint-config": "2.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^4.6.4",
|
|
36
|
-
"ko-lint-config": "2.
|
|
36
|
+
"ko-lint-config": "2.2.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc",
|