@tsslint/config 3.0.1 → 3.0.2
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/eslint.d.ts +2 -3
- package/lib/eslint.js +2 -0
- package/lib/tslint.d.ts +2 -3
- package/lib/tslint.js +2 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +21 -0
- package/package.json +3 -3
package/lib/eslint.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as TSSLint from '@tsslint/types';
|
|
2
2
|
import type * as ESLint from 'eslint';
|
|
3
3
|
import type { ESLintRulesConfig } from './eslint-types.js';
|
|
4
|
-
|
|
4
|
+
import { type RuleSeverity } from './utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* Converts an ESLint rules configuration to TSSLint rules.
|
|
7
7
|
*
|
|
@@ -10,6 +10,5 @@ type Severity = boolean | 'error' | 'warn';
|
|
|
10
10
|
* Please run `npx tsslint-docgen` to update them.
|
|
11
11
|
*/
|
|
12
12
|
export declare function importESLintRules(config: {
|
|
13
|
-
[K in keyof ESLintRulesConfig]:
|
|
13
|
+
[K in keyof ESLintRulesConfig]: RuleSeverity | [RuleSeverity, ...ESLintRulesConfig[K]];
|
|
14
14
|
}, context?: Partial<ESLint.Rule.RuleContext>): Promise<TSSLint.Rules>;
|
|
15
|
-
export {};
|
package/lib/eslint.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.importESLintRules = importESLintRules;
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
|
+
const utils_js_1 = require("./utils.js");
|
|
6
7
|
const noop = () => { };
|
|
7
8
|
const plugins = {};
|
|
8
9
|
const loader = async (moduleName) => {
|
|
@@ -46,6 +47,7 @@ async function importESLintRules(config, context = {}) {
|
|
|
46
47
|
severity = severityOrOptions;
|
|
47
48
|
options = [];
|
|
48
49
|
}
|
|
50
|
+
severity = (0, utils_js_1.normalizeRuleSeverity)(severity);
|
|
49
51
|
if (!severity) {
|
|
50
52
|
rules[rule] = noop;
|
|
51
53
|
continue;
|
package/lib/tslint.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as TSSLint from '@tsslint/types';
|
|
2
2
|
import type { TSLintRulesConfig } from './tslint-types.js';
|
|
3
|
-
|
|
3
|
+
import { type RuleSeverity } from './utils.js';
|
|
4
4
|
/**
|
|
5
5
|
* Converts a TSLint rules configuration to TSSLint rules.
|
|
6
6
|
*
|
|
@@ -9,7 +9,6 @@ type Severity = boolean | 'error' | 'warn';
|
|
|
9
9
|
* Please run `npx tsslint-docgen` to update them.
|
|
10
10
|
*/
|
|
11
11
|
export declare function importTSLintRules(config: {
|
|
12
|
-
[K in keyof TSLintRulesConfig]:
|
|
12
|
+
[K in keyof TSLintRulesConfig]: RuleSeverity | [RuleSeverity, ...TSLintRulesConfig[K]];
|
|
13
13
|
}): Promise<TSSLint.Rules>;
|
|
14
14
|
export declare function getTSLintRulesDirectories(): [string, string][];
|
|
15
|
-
export {};
|
package/lib/tslint.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.importTSLintRules = importTSLintRules;
|
|
|
4
4
|
exports.getTSLintRulesDirectories = getTSLintRulesDirectories;
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const utils_js_1 = require("./utils.js");
|
|
7
8
|
const noop = () => { };
|
|
8
9
|
/**
|
|
9
10
|
* Converts a TSLint rules configuration to TSSLint rules.
|
|
@@ -25,6 +26,7 @@ async function importTSLintRules(config) {
|
|
|
25
26
|
severity = severityOrOptions;
|
|
26
27
|
options = [];
|
|
27
28
|
}
|
|
29
|
+
severity = (0, utils_js_1.normalizeRuleSeverity)(severity);
|
|
28
30
|
if (!severity) {
|
|
29
31
|
rules[ruleName] = noop;
|
|
30
32
|
continue;
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type RuleSeverity = boolean | 'error' | 'warn';
|
|
2
|
+
type ESLintStringSeverity = 'off' | 'warn' | 'error';
|
|
3
|
+
type ESLintNumericSeverity = 0 | 1 | 2;
|
|
4
|
+
type TSLintStringSeverity = 'default' | 'warning' | 'warn' | 'error' | 'off' | 'none';
|
|
5
|
+
type TSLintBooleanSeverity = true | false;
|
|
6
|
+
export declare function normalizeRuleSeverity(severity: RuleSeverity | ESLintStringSeverity | ESLintNumericSeverity | TSLintStringSeverity | TSLintBooleanSeverity): RuleSeverity;
|
|
7
|
+
export {};
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeRuleSeverity = normalizeRuleSeverity;
|
|
4
|
+
function normalizeRuleSeverity(severity) {
|
|
5
|
+
switch (severity) {
|
|
6
|
+
case 'default':
|
|
7
|
+
return true;
|
|
8
|
+
case 0:
|
|
9
|
+
case 'off':
|
|
10
|
+
case 'none':
|
|
11
|
+
return false;
|
|
12
|
+
case 1:
|
|
13
|
+
case 'warning':
|
|
14
|
+
return 'warn';
|
|
15
|
+
case 2:
|
|
16
|
+
return 'error';
|
|
17
|
+
default:
|
|
18
|
+
return severity;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/config",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.6.0"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"directory": "packages/config"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tsslint/types": "3.0.
|
|
21
|
+
"@tsslint/types": "3.0.2",
|
|
22
22
|
"minimatch": "^10.0.1",
|
|
23
23
|
"ts-api-utils": "^2.0.0"
|
|
24
24
|
},
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"optional": true
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "89dbc73b57c9563dc287b4fd95df6c894bc2ed38"
|
|
42
42
|
}
|