@tsslint/core 1.0.9 → 1.0.10
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 +12 -2
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyTextChanges = exports.combineCodeFixes = exports.createLinter = void 0;
|
|
4
4
|
const ErrorStackParser = require("error-stack-parser");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const minimatch = require("minimatch");
|
|
5
7
|
function createLinter(ctx, config, withStack) {
|
|
6
8
|
if (withStack) {
|
|
7
9
|
require('source-map-support').install({
|
|
@@ -23,6 +25,11 @@ function createLinter(ctx, config, withStack) {
|
|
|
23
25
|
const fileFixes = new Map();
|
|
24
26
|
const sourceFiles = new Map();
|
|
25
27
|
const plugins = (config.plugins ?? []).map(plugin => plugin(ctx));
|
|
28
|
+
const excludes = [];
|
|
29
|
+
for (let exclude of config.exclude ?? []) {
|
|
30
|
+
const basePath = path.dirname(ctx.configFile);
|
|
31
|
+
excludes.push(path.resolve(basePath, exclude));
|
|
32
|
+
}
|
|
26
33
|
let rules = { ...config.rules };
|
|
27
34
|
for (const plugin of plugins) {
|
|
28
35
|
if (plugin.resolveRules) {
|
|
@@ -31,6 +38,9 @@ function createLinter(ctx, config, withStack) {
|
|
|
31
38
|
}
|
|
32
39
|
return {
|
|
33
40
|
lint(fileName) {
|
|
41
|
+
if (excludes.some(pattern => minimatch.minimatch(fileName, pattern))) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
34
44
|
const sourceFile = ctx.languageService.getProgram()?.getSourceFile(fileName);
|
|
35
45
|
if (!sourceFile) {
|
|
36
46
|
throw new Error(`No source file found for ${fileName}`);
|
|
@@ -56,13 +66,13 @@ function createLinter(ctx, config, withStack) {
|
|
|
56
66
|
rule(rulesContext);
|
|
57
67
|
}
|
|
58
68
|
catch (err) {
|
|
59
|
-
console.error(`An unexpected error occurred in rule "${id}" in file ${fileName}.`);
|
|
69
|
+
console.error(`An unexpected error occurred in rule "${id}" in file ${sourceFile.fileName}.`);
|
|
60
70
|
console.error(err);
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
73
|
for (const plugin of plugins) {
|
|
64
74
|
if (plugin.resolveDiagnostics) {
|
|
65
|
-
result = plugin.resolveDiagnostics(fileName, result);
|
|
75
|
+
result = plugin.resolveDiagnostics(sourceFile.fileName, result);
|
|
66
76
|
}
|
|
67
77
|
}
|
|
68
78
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"error-stack-parser": "^2.1.4",
|
|
16
|
+
"minimatch": "^9.0.4",
|
|
16
17
|
"source-map-support": "^0.5.21"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@tsslint/config": "1.0.
|
|
20
|
+
"@tsslint/config": "1.0.10"
|
|
20
21
|
},
|
|
21
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "075fc3bf0058d41b4131345ab3634ad059562223"
|
|
22
23
|
}
|