@tsslint/core 1.0.11 → 1.0.12

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.
Files changed (2) hide show
  1. package/index.js +14 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -50,7 +50,7 @@ function createLinter(ctx, config, withStack) {
50
50
  const token = ctx.languageServiceHost.getCancellationToken?.();
51
51
  const rules = getFileRules(sourceFile.fileName);
52
52
  const fixes = getFileFixes(sourceFile.fileName);
53
- let result = [];
53
+ let diagnostics = [];
54
54
  let currentRuleId;
55
55
  fixes.clear();
56
56
  for (const [id, rule] of Object.entries(rules)) {
@@ -68,10 +68,20 @@ function createLinter(ctx, config, withStack) {
68
68
  }
69
69
  for (const plugin of plugins) {
70
70
  if (plugin.resolveDiagnostics) {
71
- result = plugin.resolveDiagnostics(sourceFile.fileName, result);
71
+ diagnostics = plugin.resolveDiagnostics(sourceFile.fileName, diagnostics);
72
72
  }
73
73
  }
74
- return result;
74
+ const diagnosticSet = new Set(diagnostics);
75
+ for (const [ruleId, fix] of [...fixes]) {
76
+ const finalFixes = fix.filter(fix => diagnosticSet.has(fix.diagnostic));
77
+ if (finalFixes.length) {
78
+ fixes.set(ruleId, finalFixes);
79
+ }
80
+ else {
81
+ fixes.delete(ruleId);
82
+ }
83
+ }
84
+ return diagnostics;
75
85
  function reportError(message, start, end, traceOffset = 0) {
76
86
  return report(ts.DiagnosticCategory.Error, message, start, end, traceOffset);
77
87
  }
@@ -103,7 +113,7 @@ function createLinter(ctx, config, withStack) {
103
113
  }
104
114
  }
105
115
  }
106
- result.push(error);
116
+ diagnostics.push(error);
107
117
  return {
108
118
  withDeprecated() {
109
119
  error.reportsDeprecated = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/core",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -17,7 +17,7 @@
17
17
  "source-map-support": "^0.5.21"
18
18
  },
19
19
  "devDependencies": {
20
- "@tsslint/config": "1.0.11"
20
+ "@tsslint/config": "1.0.12"
21
21
  },
22
- "gitHead": "5797507a1ef19b82bafa6f43cdf412905723374f"
22
+ "gitHead": "b34fbb2c8408616eb00536f00e525cb4fc8d8913"
23
23
  }