@tsslint/core 1.0.10 → 1.0.11
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 +15 -6
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ function createLinter(ctx, config, withStack) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const ts = ctx.typescript;
|
|
25
|
+
const fileRules = new Map();
|
|
25
26
|
const fileFixes = new Map();
|
|
26
27
|
const sourceFiles = new Map();
|
|
27
28
|
const plugins = (config.plugins ?? []).map(plugin => plugin(ctx));
|
|
@@ -30,12 +31,6 @@ function createLinter(ctx, config, withStack) {
|
|
|
30
31
|
const basePath = path.dirname(ctx.configFile);
|
|
31
32
|
excludes.push(path.resolve(basePath, exclude));
|
|
32
33
|
}
|
|
33
|
-
let rules = { ...config.rules };
|
|
34
|
-
for (const plugin of plugins) {
|
|
35
|
-
if (plugin.resolveRules) {
|
|
36
|
-
rules = plugin.resolveRules(rules);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
34
|
return {
|
|
40
35
|
lint(fileName) {
|
|
41
36
|
if (excludes.some(pattern => minimatch.minimatch(fileName, pattern))) {
|
|
@@ -53,6 +48,7 @@ function createLinter(ctx, config, withStack) {
|
|
|
53
48
|
reportSuggestion,
|
|
54
49
|
};
|
|
55
50
|
const token = ctx.languageServiceHost.getCancellationToken?.();
|
|
51
|
+
const rules = getFileRules(sourceFile.fileName);
|
|
56
52
|
const fixes = getFileFixes(sourceFile.fileName);
|
|
57
53
|
let result = [];
|
|
58
54
|
let currentRuleId;
|
|
@@ -202,6 +198,19 @@ function createLinter(ctx, config, withStack) {
|
|
|
202
198
|
return result;
|
|
203
199
|
},
|
|
204
200
|
};
|
|
201
|
+
function getFileRules(fileName) {
|
|
202
|
+
let rules = fileRules.get(fileName);
|
|
203
|
+
if (!rules) {
|
|
204
|
+
rules = { ...config.rules };
|
|
205
|
+
for (const plugin of plugins) {
|
|
206
|
+
if (plugin.resolveRules) {
|
|
207
|
+
rules = plugin.resolveRules(fileName, rules);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
fileRules.set(fileName, rules);
|
|
211
|
+
}
|
|
212
|
+
return rules;
|
|
213
|
+
}
|
|
205
214
|
function getFileFixes(fileName) {
|
|
206
215
|
if (!fileFixes.has(fileName)) {
|
|
207
216
|
fileFixes.set(fileName, new Map());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
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.
|
|
20
|
+
"@tsslint/config": "1.0.11"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "5797507a1ef19b82bafa6f43cdf412905723374f"
|
|
23
23
|
}
|