@tsslint/core 1.0.20 → 1.1.1
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/index.js +43 -35
- package/lib/watch.js +5 -2
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -104,45 +104,53 @@ function createLinter(ctx, config, withStack) {
|
|
|
104
104
|
if (debugInfo) {
|
|
105
105
|
debugInfo.messageText += '- Rules:\n';
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
details
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
107
|
+
const processRules = (rules, paths = []) => {
|
|
108
|
+
for (const [path, rule] of Object.entries(rules)) {
|
|
109
|
+
if (token?.isCancellationRequested()) {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
if (typeof rule === 'object') {
|
|
113
|
+
processRules(rule, [...paths, path]);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
currentRuleId = [...paths, path].join('/');
|
|
117
|
+
currentIssues = 0;
|
|
118
|
+
currentFixes = 0;
|
|
119
|
+
currentRefactors = 0;
|
|
120
|
+
const start = Date.now();
|
|
121
|
+
try {
|
|
122
|
+
rule(rulesContext);
|
|
123
|
+
if (debugInfo) {
|
|
124
|
+
const time = Date.now() - start;
|
|
125
|
+
debugInfo.messageText += ` - ${currentRuleId}`;
|
|
126
|
+
const details = [];
|
|
127
|
+
if (currentIssues) {
|
|
128
|
+
details.push(`${currentIssues} issues`);
|
|
129
|
+
}
|
|
130
|
+
if (currentFixes) {
|
|
131
|
+
details.push(`${currentFixes} fixes`);
|
|
132
|
+
}
|
|
133
|
+
if (currentRefactors) {
|
|
134
|
+
details.push(`${currentRefactors} refactors`);
|
|
135
|
+
}
|
|
136
|
+
if (time) {
|
|
137
|
+
details.push(`${time}ms`);
|
|
138
|
+
}
|
|
139
|
+
if (details.length) {
|
|
140
|
+
debugInfo.messageText += ` (${details.join(', ')})`;
|
|
141
|
+
}
|
|
142
|
+
debugInfo.messageText += '\n';
|
|
136
143
|
}
|
|
137
|
-
debugInfo.messageText += '\n';
|
|
138
144
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
catch (err) {
|
|
146
|
+
console.error(err);
|
|
147
|
+
if (debugInfo) {
|
|
148
|
+
debugInfo.messageText += ` - ${currentRuleId} (❌ ${err && typeof err === 'object' && 'stack' in err ? err.stack : String(err)}})\n`;
|
|
149
|
+
}
|
|
143
150
|
}
|
|
144
151
|
}
|
|
145
|
-
}
|
|
152
|
+
};
|
|
153
|
+
processRules(rules);
|
|
146
154
|
for (const plugin of plugins) {
|
|
147
155
|
if (plugin.resolveDiagnostics) {
|
|
148
156
|
diagnostics = plugin.resolveDiagnostics(sourceFile.fileName, diagnostics);
|
package/lib/watch.js
CHANGED
|
@@ -11,6 +11,8 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
|
|
|
11
11
|
const outFileName = createHash(_path.relative(outDir, configFilePath)) + '.mjs';
|
|
12
12
|
const outFile = _path.join(outDir, outFileName);
|
|
13
13
|
const resultHandler = async (result) => {
|
|
14
|
+
const t1 = Date.now() - start;
|
|
15
|
+
start = Date.now();
|
|
14
16
|
let config;
|
|
15
17
|
if (!result.errors.length) {
|
|
16
18
|
try {
|
|
@@ -20,7 +22,8 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
|
|
|
20
22
|
result.errors.push({ text: String(e) });
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
const t2 = Date.now() - start;
|
|
26
|
+
logger.log(`Built ${_path.relative(process.cwd(), configFilePath)} in ${t1}ms, loaded ${config ? 'successfully' : 'with errors'} in ${t2}ms`);
|
|
24
27
|
onBuild(config, result);
|
|
25
28
|
};
|
|
26
29
|
const cacheDir = _path.resolve(outDir, 'http_resources');
|
|
@@ -43,7 +46,7 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
|
|
|
43
46
|
cachePathToOriginalPath.set(cachePath, path);
|
|
44
47
|
return { path: cachePath, namespace: 'http-url' };
|
|
45
48
|
});
|
|
46
|
-
build.onResolve({ filter:
|
|
49
|
+
build.onResolve({ filter: /.*/, namespace: 'file' }, ({ path, resolveDir }) => {
|
|
47
50
|
if (!path.endsWith('.ts')) {
|
|
48
51
|
try {
|
|
49
52
|
const maybeJsPath = require.resolve(path, { paths: [resolveDir] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"directory": "packages/core"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@tsslint/types": "1.
|
|
15
|
+
"@tsslint/types": "1.1.1",
|
|
16
16
|
"error-stack-parser": "^2.1.4",
|
|
17
17
|
"esbuild": "^0.23.0",
|
|
18
18
|
"minimatch": "^10.0.1",
|
|
19
19
|
"source-map-support": "^0.5.21"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "1c8bb2ebfe0932f62b496d274cffd14baf0c4f4c"
|
|
22
22
|
}
|