@tsslint/config 0.0.6 → 0.0.7
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/types.d.ts +2 -2
- package/lib/watch.js +18 -14
- package/package.json +2 -2
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CodeFixAction,
|
|
1
|
+
import type { CodeFixAction, DiagnosticWithLocation, FileTextChanges, LanguageService, LanguageServiceHost, SourceFile } from 'typescript/lib/tsserverlibrary';
|
|
2
2
|
export interface ProjectContext {
|
|
3
3
|
configFile: string;
|
|
4
4
|
typescript: typeof import('typescript/lib/tsserverlibrary.js');
|
|
@@ -16,7 +16,7 @@ export interface Plugin {
|
|
|
16
16
|
}
|
|
17
17
|
export interface PluginInstance {
|
|
18
18
|
resolveRules?(rules: Rules): Rules;
|
|
19
|
-
resolveDiagnostics?(fileName: string, results:
|
|
19
|
+
resolveDiagnostics?(fileName: string, results: DiagnosticWithLocation[]): DiagnosticWithLocation[];
|
|
20
20
|
resolveCodeFixes?(fileName: string, results: CodeFixAction[]): CodeFixAction[];
|
|
21
21
|
}
|
|
22
22
|
export interface Rules {
|
package/lib/watch.js
CHANGED
|
@@ -7,6 +7,19 @@ async function watchConfigFile(configFilePath, onBuild, watch = true) {
|
|
|
7
7
|
const outDir = path.resolve(__dirname, '..', '..', '.tsslint');
|
|
8
8
|
const outFileName = btoa(path.relative(outDir, configFilePath)) + '.cjs';
|
|
9
9
|
const outFile = path.join(outDir, outFileName);
|
|
10
|
+
const resultHandler = (result) => {
|
|
11
|
+
let config;
|
|
12
|
+
if (!result.errors.length) {
|
|
13
|
+
try {
|
|
14
|
+
config = require(outFile).default;
|
|
15
|
+
delete require.cache[outFile];
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
result.errors.push({ text: String(e) });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
onBuild(config, result);
|
|
22
|
+
};
|
|
10
23
|
const ctx = await esbuild.context({
|
|
11
24
|
entryPoints: [configFilePath],
|
|
12
25
|
bundle: true,
|
|
@@ -30,19 +43,9 @@ async function watchConfigFile(configFilePath, onBuild, watch = true) {
|
|
|
30
43
|
}
|
|
31
44
|
return {};
|
|
32
45
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
config = require(outFile).default;
|
|
38
|
-
delete require.cache[outFile];
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
result.errors.push({ text: String(e) });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
onBuild(config, result);
|
|
45
|
-
});
|
|
46
|
+
if (watch) {
|
|
47
|
+
build.onEnd(resultHandler);
|
|
48
|
+
}
|
|
46
49
|
},
|
|
47
50
|
}],
|
|
48
51
|
});
|
|
@@ -50,8 +53,9 @@ async function watchConfigFile(configFilePath, onBuild, watch = true) {
|
|
|
50
53
|
await ctx.watch();
|
|
51
54
|
}
|
|
52
55
|
else {
|
|
53
|
-
await ctx.rebuild();
|
|
56
|
+
const result = await ctx.rebuild();
|
|
54
57
|
await ctx.dispose();
|
|
58
|
+
resultHandler(result);
|
|
55
59
|
}
|
|
56
60
|
return ctx;
|
|
57
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslint": "latest"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "ed1086b1f11469e0a9d6a14199c7e027eb28b488"
|
|
21
21
|
}
|