@tsslint/config 1.5.18 → 1.6.0

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.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from '@tsslint/types';
2
+ export { create as createDiagnosticsPlugin } from './lib/plugins/diagnostics.js';
2
3
  export { create as createIgnorePlugin } from './lib/plugins/ignore.js';
3
4
  import type { Config, Plugin, Rule } from '@tsslint/types';
4
5
  export declare function defineRule(rule: Rule): Rule;
5
6
  export declare function definePlugin(plugin: Plugin): Plugin;
6
7
  export declare function defineConfig(config: Config | Config[]): Config | Config[];
8
+ export declare function isCLI(): boolean;
package/index.js CHANGED
@@ -14,11 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createIgnorePlugin = void 0;
17
+ exports.createIgnorePlugin = exports.createDiagnosticsPlugin = void 0;
18
18
  exports.defineRule = defineRule;
19
19
  exports.definePlugin = definePlugin;
20
20
  exports.defineConfig = defineConfig;
21
+ exports.isCLI = isCLI;
21
22
  __exportStar(require("@tsslint/types"), exports);
23
+ var diagnostics_js_1 = require("./lib/plugins/diagnostics.js");
24
+ Object.defineProperty(exports, "createDiagnosticsPlugin", { enumerable: true, get: function () { return diagnostics_js_1.create; } });
22
25
  var ignore_js_1 = require("./lib/plugins/ignore.js");
23
26
  Object.defineProperty(exports, "createIgnorePlugin", { enumerable: true, get: function () { return ignore_js_1.create; } });
24
27
  function defineRule(rule) {
@@ -30,4 +33,7 @@ function definePlugin(plugin) {
30
33
  function defineConfig(config) {
31
34
  return config;
32
35
  }
36
+ function isCLI() {
37
+ return !!process.env.TSSLINT_CLI;
38
+ }
33
39
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from '@tsslint/types';
2
+ type CheckMode = 'syntactic' | 'semantic' | 'declaration';
3
+ export declare function create(mode?: CheckMode | CheckMode[]): Plugin;
4
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.create = create;
4
+ function create(mode = 'semantic') {
5
+ const modes = Array.isArray(mode) ? mode : [mode];
6
+ return ({ languageService }) => ({
7
+ resolveDiagnostics(sourceFile, diagnostics) {
8
+ const program = languageService.getProgram();
9
+ for (const mode of modes) {
10
+ const diags = mode === 'syntactic'
11
+ ? program.getSyntacticDiagnostics(sourceFile)
12
+ : mode === 'semantic'
13
+ ? program.getSemanticDiagnostics(sourceFile)
14
+ : mode === 'declaration'
15
+ ? program.getDeclarationDiagnostics(sourceFile)
16
+ : [];
17
+ for (const diag of diags) {
18
+ diag.start ??= 0;
19
+ diag.length ??= 0;
20
+ diagnostics.push(diag);
21
+ }
22
+ }
23
+ return diagnostics;
24
+ },
25
+ });
26
+ }
27
+ //# sourceMappingURL=diagnostics.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/config",
3
- "version": "1.5.18",
3
+ "version": "1.6.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,8 +12,8 @@
12
12
  "directory": "packages/config"
13
13
  },
14
14
  "dependencies": {
15
- "@tsslint/types": "1.5.18",
15
+ "@tsslint/types": "1.6.0",
16
16
  "ts-api-utils": "^2.0.0"
17
17
  },
18
- "gitHead": "037ab1b5d72098fcf01c750420a98db8d8f28ba6"
18
+ "gitHead": "c1cec085945f166911af87454f6f1dd3e9fc2986"
19
19
  }