@getkist/action-eslint 1.0.1
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/actions/LintAction/LintAction.d.ts +42 -0
- package/dist/actions/LintAction/LintAction.d.ts.map +1 -0
- package/dist/actions/LintAction/LintAction.js +99 -0
- package/dist/actions/LintAction/LintAction.js.map +1 -0
- package/dist/actions/LintAction/index.d.ts +3 -0
- package/dist/actions/LintAction/index.d.ts.map +1 -0
- package/dist/actions/LintAction/index.js +9 -0
- package/dist/actions/LintAction/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Action.d.ts +60 -0
- package/dist/types/Action.d.ts.map +1 -0
- package/dist/types/Action.js +56 -0
- package/dist/types/Action.js.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 kist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @getkist/action-eslint
|
|
2
|
+
|
|
3
|
+
ESLint linting actions for kist.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @getkist/action-eslint
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### As a kist plugin
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
# kist.yml
|
|
17
|
+
plugins:
|
|
18
|
+
- "@getkist/action-eslint"
|
|
19
|
+
|
|
20
|
+
pipeline:
|
|
21
|
+
- action: LintAction
|
|
22
|
+
options:
|
|
23
|
+
targetFiles:
|
|
24
|
+
- "src/**/*.ts"
|
|
25
|
+
- "src/**/*.js"
|
|
26
|
+
fix: false
|
|
27
|
+
configPath: "eslint.config.js"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Standalone usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { LintAction } from "@getkist/action-eslint";
|
|
34
|
+
|
|
35
|
+
const action = new LintAction();
|
|
36
|
+
await action.execute({
|
|
37
|
+
targetFiles: ["src/**/*.ts"],
|
|
38
|
+
fix: true,
|
|
39
|
+
configPath: "eslint.config.js"
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Actions
|
|
44
|
+
|
|
45
|
+
### LintAction
|
|
46
|
+
|
|
47
|
+
Runs ESLint on specified files and directories, with optional auto-fixing.
|
|
48
|
+
|
|
49
|
+
#### Options
|
|
50
|
+
|
|
51
|
+
| Option | Type | Default | Description |
|
|
52
|
+
|--------|------|---------|-------------|
|
|
53
|
+
| `targetFiles` | `string[]` | `["src/**/*.ts"]` | Files or glob patterns to lint |
|
|
54
|
+
| `fix` | `boolean` | `false` | Whether to automatically fix issues |
|
|
55
|
+
| `configPath` | `string` | `"eslint.config.js"` | Path to ESLint config file |
|
|
56
|
+
|
|
57
|
+
## Configuration Examples
|
|
58
|
+
|
|
59
|
+
### Lint TypeScript and JavaScript files
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
- action: LintAction
|
|
63
|
+
options:
|
|
64
|
+
targetFiles:
|
|
65
|
+
- "src/**/*.ts"
|
|
66
|
+
- "src/**/*.tsx"
|
|
67
|
+
- "src/**/*.js"
|
|
68
|
+
- "src/**/*.jsx"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Auto-fix issues
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
- action: LintAction
|
|
75
|
+
options:
|
|
76
|
+
targetFiles:
|
|
77
|
+
- "src/**/*.ts"
|
|
78
|
+
fix: true
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Use custom config
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
- action: LintAction
|
|
85
|
+
options:
|
|
86
|
+
targetFiles:
|
|
87
|
+
- "src/**/*.ts"
|
|
88
|
+
configPath: "config/eslint.custom.js"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Action, ActionOptionsType } from "../../types/Action.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the LintAction
|
|
4
|
+
*/
|
|
5
|
+
export interface LintActionOptions extends ActionOptionsType {
|
|
6
|
+
/** Files or glob patterns to lint (default: src ts files) */
|
|
7
|
+
targetFiles?: string[];
|
|
8
|
+
/** Whether to automatically fix issues (default: false) */
|
|
9
|
+
fix?: boolean;
|
|
10
|
+
/** Path to ESLint config file (default: eslint.config.js) */
|
|
11
|
+
configPath?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* LintAction handles linting TypeScript and JavaScript files using ESLint.
|
|
15
|
+
* This action can be configured to run in strict mode or automatically fix issues.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LintAction extends Action<LintActionOptions> {
|
|
18
|
+
private eslint;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Validates the action options.
|
|
22
|
+
*
|
|
23
|
+
* @param options - The options to validate.
|
|
24
|
+
* @returns True if options are valid.
|
|
25
|
+
*/
|
|
26
|
+
validateOptions(options: LintActionOptions): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Executes the ESLint linting action.
|
|
29
|
+
*
|
|
30
|
+
* @param options - The options for linting.
|
|
31
|
+
* @returns A Promise that resolves when linting completes.
|
|
32
|
+
* @throws {Error} If linting encounters an error.
|
|
33
|
+
*/
|
|
34
|
+
execute(options: LintActionOptions): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Provides a description of the action.
|
|
37
|
+
*
|
|
38
|
+
* @returns A string description of the action.
|
|
39
|
+
*/
|
|
40
|
+
describe(): string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=LintAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LintAction.d.ts","sourceRoot":"","sources":["../../../src/actions/LintAction/LintAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMlE;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAM,CAAC,iBAAiB,CAAC;IACrD,OAAO,CAAC,MAAM,CAAS;;IAOvB;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO;IAsBpD;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CxD;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { ESLint } from "eslint";
|
|
5
|
+
import { Action } from "../../types/Action.js";
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Classes
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* LintAction handles linting TypeScript and JavaScript files using ESLint.
|
|
11
|
+
* This action can be configured to run in strict mode or automatically fix issues.
|
|
12
|
+
*/
|
|
13
|
+
export class LintAction extends Action {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.eslint = new ESLint({});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates the action options.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The options to validate.
|
|
22
|
+
* @returns True if options are valid.
|
|
23
|
+
*/
|
|
24
|
+
validateOptions(options) {
|
|
25
|
+
if (options.targetFiles !== undefined) {
|
|
26
|
+
if (!Array.isArray(options.targetFiles)) {
|
|
27
|
+
this.logError("Invalid options: 'targetFiles' must be an array.");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (options.targetFiles.length === 0) {
|
|
31
|
+
this.logError("Invalid options: 'targetFiles' must contain at least one file or pattern.");
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (options.fix !== undefined && typeof options.fix !== "boolean") {
|
|
36
|
+
this.logError("Invalid options: 'fix' must be a boolean.");
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (options.configPath !== undefined && typeof options.configPath !== "string") {
|
|
40
|
+
this.logError("Invalid options: 'configPath' must be a string.");
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Executes the ESLint linting action.
|
|
47
|
+
*
|
|
48
|
+
* @param options - The options for linting.
|
|
49
|
+
* @returns A Promise that resolves when linting completes.
|
|
50
|
+
* @throws {Error} If linting encounters an error.
|
|
51
|
+
*/
|
|
52
|
+
async execute(options) {
|
|
53
|
+
if (!this.validateOptions(options)) {
|
|
54
|
+
throw new Error("Invalid options provided to LintAction.");
|
|
55
|
+
}
|
|
56
|
+
const { targetFiles = ["src/**/*.ts"], fix = false, configPath = "eslint.config.js", } = options;
|
|
57
|
+
this.logInfo(`Starting ESLint on: ${targetFiles.join(", ")}`);
|
|
58
|
+
try {
|
|
59
|
+
// Update ESLint instance with correct configuration
|
|
60
|
+
this.eslint = new ESLint({ fix, overrideConfigFile: configPath });
|
|
61
|
+
const results = await this.eslint.lintFiles(targetFiles);
|
|
62
|
+
if (fix) {
|
|
63
|
+
await ESLint.outputFixes(results);
|
|
64
|
+
this.logInfo("Applied automatic fixes where possible.");
|
|
65
|
+
}
|
|
66
|
+
// Count errors and warnings
|
|
67
|
+
const errorCount = results.reduce((acc, r) => acc + r.errorCount, 0);
|
|
68
|
+
const warningCount = results.reduce((acc, r) => acc + r.warningCount, 0);
|
|
69
|
+
// Format and output results
|
|
70
|
+
const formatter = await this.eslint.loadFormatter("stylish");
|
|
71
|
+
const formattedResults = await formatter.format(results);
|
|
72
|
+
if (formattedResults) {
|
|
73
|
+
console.log(formattedResults);
|
|
74
|
+
}
|
|
75
|
+
if (errorCount > 0) {
|
|
76
|
+
this.logWarning(`ESLint found ${errorCount} error(s) and ${warningCount} warning(s).`);
|
|
77
|
+
}
|
|
78
|
+
else if (warningCount > 0) {
|
|
79
|
+
this.logInfo(`ESLint completed with ${warningCount} warning(s).`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.logInfo("ESLint linting completed successfully with no issues.");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.logError("ESLint encountered an error.", error);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Provides a description of the action.
|
|
92
|
+
*
|
|
93
|
+
* @returns A string description of the action.
|
|
94
|
+
*/
|
|
95
|
+
describe() {
|
|
96
|
+
return "Runs ESLint on specified files and directories, with optional auto-fixing.";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=LintAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LintAction.js","sourceRoot":"","sources":["../../../src/actions/LintAction/LintAction.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAqB,MAAM,uBAAuB,CAAC;AAkBlE,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAyB;IAGrD;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,OAA0B;QACtC,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,QAAQ,CAAC,kDAAkD,CAAC,CAAC;gBAClE,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,OAAO,CAAC,WAAW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
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/LintAction/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMhE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { LintAction } from "./LintAction.js";
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Export
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export { LintAction };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/LintAction/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAEhE,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAqB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionPlugin } from "./types/Action.js";
|
|
2
|
+
import { LintAction } from "./actions/LintAction/index.js";
|
|
3
|
+
declare const plugin: ActionPlugin;
|
|
4
|
+
export default plugin;
|
|
5
|
+
export type { LintActionOptions } from "./actions/LintAction/index.js";
|
|
6
|
+
export { LintAction };
|
|
7
|
+
export { Action, ActionPlugin, ActionOptionsType } from "./types/Action.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LintAction } from "./actions/LintAction/index.js";
|
|
2
|
+
const plugin = {
|
|
3
|
+
name: "@getkist/action-eslint",
|
|
4
|
+
version: "1.0.0",
|
|
5
|
+
actions: { LintAction },
|
|
6
|
+
};
|
|
7
|
+
export default plugin;
|
|
8
|
+
export { LintAction };
|
|
9
|
+
export { Action } from "./types/Action.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,MAAM,MAAM,GAAiB;IACzB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,EAAE,UAAU,EAAE;CAC1B,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,OAAO,EAAE,MAAM,EAAmC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Action types for kist action plugins
|
|
3
|
+
* These types match the kist Action interface for compatibility
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Action options type - a generic record of key-value pairs
|
|
7
|
+
*/
|
|
8
|
+
export type ActionOptionsType = Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for all kist actions
|
|
11
|
+
* Provides logging and execution interface
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class Action<T extends ActionOptionsType = ActionOptionsType> {
|
|
14
|
+
/**
|
|
15
|
+
* Gets the unique name of the action.
|
|
16
|
+
*/
|
|
17
|
+
get name(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Validates options before execution
|
|
20
|
+
* Override in subclasses for specific validation
|
|
21
|
+
*/
|
|
22
|
+
validateOptions(_options: T): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Execute the action with given options
|
|
25
|
+
* Must be implemented by subclasses
|
|
26
|
+
*/
|
|
27
|
+
abstract execute(options: T): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Provides a description of the action
|
|
30
|
+
*/
|
|
31
|
+
describe(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Log an info message
|
|
34
|
+
*/
|
|
35
|
+
protected logInfo(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Log an error message
|
|
38
|
+
*/
|
|
39
|
+
protected logError(message: string, error?: unknown): void;
|
|
40
|
+
/**
|
|
41
|
+
* Log a debug message
|
|
42
|
+
*/
|
|
43
|
+
protected logDebug(message: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Log a warning message
|
|
46
|
+
*/
|
|
47
|
+
protected logWarning(message: string): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Plugin interface for kist action packages
|
|
51
|
+
*/
|
|
52
|
+
export interface ActionPlugin {
|
|
53
|
+
/** Plugin name */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Plugin version */
|
|
56
|
+
version: string;
|
|
57
|
+
/** Map of action names to action classes */
|
|
58
|
+
actions: Record<string, new () => Action>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD;;;GAGG;AACH,8BAAsB,MAAM,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACxE;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO;IAIrC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMzC;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG9C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,MAAM,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Action types for kist action plugins
|
|
3
|
+
* These types match the kist Action interface for compatibility
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class for all kist actions
|
|
7
|
+
* Provides logging and execution interface
|
|
8
|
+
*/
|
|
9
|
+
export class Action {
|
|
10
|
+
/**
|
|
11
|
+
* Gets the unique name of the action.
|
|
12
|
+
*/
|
|
13
|
+
get name() {
|
|
14
|
+
return this.constructor.name;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates options before execution
|
|
18
|
+
* Override in subclasses for specific validation
|
|
19
|
+
*/
|
|
20
|
+
validateOptions(_options) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provides a description of the action
|
|
25
|
+
*/
|
|
26
|
+
describe() {
|
|
27
|
+
return `${this.name} action`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Log an info message
|
|
31
|
+
*/
|
|
32
|
+
logInfo(message) {
|
|
33
|
+
console.log(`[${this.name}] ${message}`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Log an error message
|
|
37
|
+
*/
|
|
38
|
+
logError(message, error) {
|
|
39
|
+
console.error(`[${this.name}] ERROR: ${message}`, error || "");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Log a debug message
|
|
43
|
+
*/
|
|
44
|
+
logDebug(message) {
|
|
45
|
+
if (process.env.DEBUG) {
|
|
46
|
+
console.debug(`[${this.name}] DEBUG: ${message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Log a warning message
|
|
51
|
+
*/
|
|
52
|
+
logWarning(message) {
|
|
53
|
+
console.warn(`[${this.name}] WARNING: ${message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=Action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,MAAM,OAAgB,MAAM;IACxB;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,eAAe,CAAC,QAAW;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAQD;;OAEG;IACH,QAAQ;QACJ,OAAO,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED;;OAEG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getkist/action-eslint",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "ESLint linting actions for kist",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"kist",
|
|
17
|
+
"kist-action",
|
|
18
|
+
"eslint",
|
|
19
|
+
"lint",
|
|
20
|
+
"linter",
|
|
21
|
+
"typescript",
|
|
22
|
+
"javascript"
|
|
23
|
+
],
|
|
24
|
+
"author": "kist",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/getkist/kist-action-eslint.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/getkist/kist-action-eslint/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/getkist/kist-action-eslint#readme",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20.0.0",
|
|
36
|
+
"npm": ">=10.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"build:watch": "tsc --watch",
|
|
41
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
42
|
+
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
|
|
43
|
+
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
|
|
44
|
+
"test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.test\\.ts$",
|
|
45
|
+
"test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.integration\\.test\\.ts$",
|
|
46
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
47
|
+
"lint:fix": "eslint 'src/**/*.ts' --fix",
|
|
48
|
+
"format": "prettier --write 'src/**/*.ts'",
|
|
49
|
+
"docs": "typedoc",
|
|
50
|
+
"docs:watch": "typedoc --watch",
|
|
51
|
+
"clean": "rm -rf dist docs/api coverage",
|
|
52
|
+
"prepublishOnly": "npm run clean && npm run build && npm test"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"kist": ">=0.1.58"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"eslint": "^9.0.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/jest": "30.0.0",
|
|
62
|
+
"@types/node": "25.2.2",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
64
|
+
"@typescript-eslint/parser": "8.54.0",
|
|
65
|
+
"jest": "30.2.0",
|
|
66
|
+
"ts-jest": "^29.4.6",
|
|
67
|
+
"typedoc": "^0.28.0",
|
|
68
|
+
"typedoc-plugin-markdown": "^4.10.0",
|
|
69
|
+
"typescript": "^5.9.3"
|
|
70
|
+
},
|
|
71
|
+
"files": [
|
|
72
|
+
"dist",
|
|
73
|
+
"README.md",
|
|
74
|
+
"LICENSE"
|
|
75
|
+
],
|
|
76
|
+
"sideEffects": false
|
|
77
|
+
}
|