@darksheep/eslint-formatter-github 2.0.1 โ 2.1.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/CHANGELOG.md +126 -0
- package/package.json +5 -12
- package/src/index.js +44 -34
- package/types/index.d.ts +64 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,131 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.1.0](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.10...eslint-formatter-github-v2.1.0) (2025-01-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ๐ Features
|
|
7
|
+
|
|
8
|
+
* Add "ruleId" to error lint messages ([#534](https://github.com/DarkSheepSoftware/node-packages/issues/534)) ([99b6c31](https://github.com/DarkSheepSoftware/node-packages/commit/99b6c310561d92c84a4a9f5fcfb687e184a9209f))
|
|
9
|
+
|
|
10
|
+
## [2.0.10](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.9...eslint-formatter-github-v2.0.10) (2024-10-21)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ๐ฉน Fixes
|
|
14
|
+
|
|
15
|
+
* only write endLine and endColumn if strings ([a568b63](https://github.com/DarkSheepSoftware/node-packages/commit/a568b63eb03a0c1d1c17e8983129bac0d34c3e1c))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* dependencies
|
|
22
|
+
* @darksheep/github-actions bumped from 2.0.8 to 2.0.9
|
|
23
|
+
* @darksheep/package.json bumped from 3.0.0 to 3.0.1
|
|
24
|
+
|
|
25
|
+
## [2.0.9](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.8...eslint-formatter-github-v2.0.9) (2024-09-13)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* The following workspace dependencies were updated
|
|
31
|
+
* dependencies
|
|
32
|
+
* @darksheep/github-actions bumped from 2.0.7 to 2.0.8
|
|
33
|
+
* @darksheep/package.json bumped from 2.0.7 to 3.0.0
|
|
34
|
+
|
|
35
|
+
## [2.0.8](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.7...eslint-formatter-github-v2.0.8) (2024-09-12)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Dependencies
|
|
39
|
+
|
|
40
|
+
* The following workspace dependencies were updated
|
|
41
|
+
* dependencies
|
|
42
|
+
* @darksheep/github-actions bumped from 2.0.6 to 2.0.7
|
|
43
|
+
* @darksheep/package.json bumped from 2.0.6 to 2.0.7
|
|
44
|
+
|
|
45
|
+
## [2.0.7](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.6...eslint-formatter-github-v2.0.7) (2024-08-28)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### ๐ฉน Fixes
|
|
49
|
+
|
|
50
|
+
* remove calls to "console.info" ([#342](https://github.com/DarkSheepSoftware/node-packages/issues/342)) ([56f39a4](https://github.com/DarkSheepSoftware/node-packages/commit/56f39a436a852ce63c2aa355a56698ac179dfe8b))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### ๐จ Code Refactoring
|
|
54
|
+
|
|
55
|
+
* Remove all eslint inline suppressions ([dc1d62f](https://github.com/DarkSheepSoftware/node-packages/commit/dc1d62f5fa9cd50f884d6b68a30d448685c6c2d2))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Dependencies
|
|
59
|
+
|
|
60
|
+
* The following workspace dependencies were updated
|
|
61
|
+
* dependencies
|
|
62
|
+
* @darksheep/github-actions bumped from 2.0.5 to 2.0.6
|
|
63
|
+
* @darksheep/package.json bumped from 2.0.5 to 2.0.6
|
|
64
|
+
|
|
65
|
+
## [2.0.6](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.5...eslint-formatter-github-v2.0.6) (2024-08-12)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### ๐งน Chores
|
|
69
|
+
|
|
70
|
+
* update env access ([#309](https://github.com/DarkSheepSoftware/node-packages/issues/309)) ([c0bb192](https://github.com/DarkSheepSoftware/node-packages/commit/c0bb192deb0d016f3893e14ab6270461d5f5b07d))
|
|
71
|
+
|
|
72
|
+
## [2.0.5](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.4...eslint-formatter-github-v2.0.5) (2024-08-09)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Dependencies
|
|
76
|
+
|
|
77
|
+
* The following workspace dependencies were updated
|
|
78
|
+
* dependencies
|
|
79
|
+
* @darksheep/github-actions bumped from 2.0.4 to 2.0.5
|
|
80
|
+
* @darksheep/package.json bumped from 2.0.4 to 2.0.5
|
|
81
|
+
|
|
82
|
+
## [2.0.4](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.3...eslint-formatter-github-v2.0.4) (2024-08-01)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### ๐ฆ Dependencies
|
|
86
|
+
|
|
87
|
+
* **dev:** update dependency eslint to ~9.8.0 ([#284](https://github.com/DarkSheepSoftware/node-packages/issues/284)) ([dc02a80](https://github.com/DarkSheepSoftware/node-packages/commit/dc02a801cb982cd3ed2bf685db62a21b6c2c15cd))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Dependencies
|
|
91
|
+
|
|
92
|
+
* The following workspace dependencies were updated
|
|
93
|
+
* dependencies
|
|
94
|
+
* @darksheep/github-actions bumped from 2.0.3 to 2.0.4
|
|
95
|
+
* @darksheep/package.json bumped from 2.0.3 to 2.0.4
|
|
96
|
+
|
|
97
|
+
## [2.0.3](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.2...eslint-formatter-github-v2.0.3) (2024-07-23)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### ๐ฆ Dependencies
|
|
101
|
+
|
|
102
|
+
* **dev:** update dependency @darksheep/eslint to v5 ([25aabab](https://github.com/DarkSheepSoftware/node-packages/commit/25aababd9295e3e47b945c91b5d6fbf121f8168b))
|
|
103
|
+
* **dev:** update dependency eslint to ~9.7.0 ([#263](https://github.com/DarkSheepSoftware/node-packages/issues/263)) ([af98723](https://github.com/DarkSheepSoftware/node-packages/commit/af9872336b01026496bc1a48807fd396eb361483))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Dependencies
|
|
107
|
+
|
|
108
|
+
* The following workspace dependencies were updated
|
|
109
|
+
* dependencies
|
|
110
|
+
* @darksheep/github-actions bumped from 2.0.2 to 2.0.3
|
|
111
|
+
* @darksheep/package.json bumped from 2.0.2 to 2.0.3
|
|
112
|
+
|
|
113
|
+
## [2.0.2](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.1...eslint-formatter-github-v2.0.2) (2024-07-02)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### ๐ฆ Dependencies
|
|
117
|
+
|
|
118
|
+
* **dev:** update dependency eslint to v9 ([#252](https://github.com/DarkSheepSoftware/node-packages/issues/252)) ([7473b18](https://github.com/DarkSheepSoftware/node-packages/commit/7473b18e59c132f41e03cd6237842205bc23d08e))
|
|
119
|
+
* **dev:** update dependency typescript to ~5.5.0 ([#242](https://github.com/DarkSheepSoftware/node-packages/issues/242)) ([68413b5](https://github.com/DarkSheepSoftware/node-packages/commit/68413b57ef85df879c33243566618a2ecb700051))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Dependencies
|
|
123
|
+
|
|
124
|
+
* The following workspace dependencies were updated
|
|
125
|
+
* dependencies
|
|
126
|
+
* @darksheep/github-actions bumped from 2.0.1 to 2.0.2
|
|
127
|
+
* @darksheep/package.json bumped from 2.0.1 to 2.0.2
|
|
128
|
+
|
|
3
129
|
## [2.0.1](https://github.com/DarkSheepSoftware/node-packages/compare/eslint-formatter-github-v2.0.0...eslint-formatter-github-v2.0.1) (2024-06-07)
|
|
4
130
|
|
|
5
131
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darksheep/eslint-formatter-github",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "ESLint + Github actions",
|
|
5
5
|
"license": "UNLICENCED",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -8,22 +8,15 @@
|
|
|
8
8
|
"types": "./types/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"./src",
|
|
11
|
-
"./types"
|
|
11
|
+
"./types",
|
|
12
|
+
"!*.test.*"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
|
-
"lint": "eslint .",
|
|
15
|
-
"lint:fix": "eslint . --fix",
|
|
16
15
|
"prepack": "tsc"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@darksheep/github-actions": "2.0.
|
|
20
|
-
"@darksheep/package.json": "
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@darksheep/eslint": "~4.4.0",
|
|
24
|
-
"@types/node": "~20.14.0",
|
|
25
|
-
"eslint": "~8.57.0",
|
|
26
|
-
"typescript": "~5.4.0"
|
|
18
|
+
"@darksheep/github-actions": "2.0.9",
|
|
19
|
+
"@darksheep/package.json": "3.0.1"
|
|
27
20
|
},
|
|
28
21
|
"engines": {
|
|
29
22
|
"node": "^20.13.1 || ^22.2.0"
|
package/src/index.js
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
/* eslint jsdoc/require-property-description: 0 */
|
|
2
1
|
const path = require('node:path');
|
|
3
2
|
const { setNotice, setWarning, setError, startGroup, endGroup } = require('@darksheep/github-actions');
|
|
4
3
|
const { getPackageJson } = require('@darksheep/package.json/sync');
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* @param {string} word The word to pluralise
|
|
8
|
-
* @param {number} count The number of items
|
|
6
|
+
* @param {string} word - The word to pluralise.
|
|
7
|
+
* @param {number} count - The number of items.
|
|
9
8
|
* @returns {string}
|
|
10
9
|
*/
|
|
11
10
|
function plural(word, count) {
|
|
12
11
|
return (count === 1 ? word : `${word}s`);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const {
|
|
16
|
-
GITHUB_WORKSPACE = process.cwd(),
|
|
17
|
-
} = process.env;
|
|
14
|
+
const { GITHUB_WORKSPACE = process.cwd() } = process.env;
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* @typedef {Object} LintMessage
|
|
21
|
-
* @property {number} column
|
|
22
|
-
* @property {number} line
|
|
23
|
-
* @property {number} [endColumn]
|
|
24
|
-
* @property {number} [endLine]
|
|
25
|
-
* @property {string | null} ruleId
|
|
26
|
-
* @property {string} message
|
|
27
|
-
* @property {string} [messageId]
|
|
28
|
-
* @property {string} [nodeType]
|
|
29
|
-
* @property {boolean} [fatal]
|
|
30
|
-
* @property {0 | 1 | 2} severity
|
|
18
|
+
* @property {number} column - The start of error column number.
|
|
19
|
+
* @property {number} line - The start of error line number.
|
|
20
|
+
* @property {number} [endColumn] - The end of error column number.
|
|
21
|
+
* @property {number} [endLine] - The end of error line number.
|
|
22
|
+
* @property {string | null} ruleId - The lint rule id.
|
|
23
|
+
* @property {string} message - The lint message.
|
|
24
|
+
* @property {string} [messageId] - The lint message id.
|
|
25
|
+
* @property {string} [nodeType] - The estree node.
|
|
26
|
+
* @property {boolean} [fatal] - Linting fatality flag.
|
|
27
|
+
* @property {0 | 1 | 2} severity - Lint severity.
|
|
31
28
|
*/
|
|
32
29
|
/**
|
|
33
30
|
* @typedef {Object} LintResult
|
|
34
|
-
* @property {string} filePath
|
|
35
|
-
* @property {LintMessage[]} messages
|
|
36
|
-
* @property {number} errorCount
|
|
37
|
-
* @property {number} fatalErrorCount
|
|
38
|
-
* @property {number} warningCount
|
|
39
|
-
* @property {number} fixableErrorCount
|
|
40
|
-
* @property {number} fixableWarningCount
|
|
31
|
+
* @property {string} filePath - Linted file path.
|
|
32
|
+
* @property {LintMessage[]} messages - Collection of messages for the file.
|
|
33
|
+
* @property {number} errorCount - Number of errors.
|
|
34
|
+
* @property {number} fatalErrorCount - Number of fatal errors.
|
|
35
|
+
* @property {number} warningCount - Number of warnings.
|
|
36
|
+
* @property {number} fixableErrorCount - Number of fixable errors.
|
|
37
|
+
* @property {number} fixableWarningCount - Number of fixable warnings.
|
|
41
38
|
*/
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
|
-
* @param {LintResult[]} fileResults The
|
|
41
|
+
* @param {LintResult[]} fileResults - The linting results.
|
|
45
42
|
* @returns {Record<'warningCount' | 'errorCount', number>}
|
|
46
43
|
*/
|
|
47
44
|
function counters(fileResults) {
|
|
@@ -60,7 +57,7 @@ function counters(fileResults) {
|
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
/**
|
|
63
|
-
* @param {LintResult} fileResult The
|
|
60
|
+
* @param {LintResult} fileResult - The single file result.
|
|
64
61
|
* @returns {string[]}
|
|
65
62
|
*/
|
|
66
63
|
function formatFileResult(fileResult) {
|
|
@@ -72,7 +69,7 @@ function formatFileResult(fileResult) {
|
|
|
72
69
|
);
|
|
73
70
|
|
|
74
71
|
for (const result of fileResult.messages) {
|
|
75
|
-
const message = result.ruleId
|
|
72
|
+
const message = (result.ruleId != null && result.ruleId !== '')
|
|
76
73
|
? `[${result.ruleId}] ${result.message}`
|
|
77
74
|
: result.message;
|
|
78
75
|
|
|
@@ -81,16 +78,29 @@ function formatFileResult(fileResult) {
|
|
|
81
78
|
file: filePath,
|
|
82
79
|
line: result.line,
|
|
83
80
|
col: result.column,
|
|
84
|
-
endLine: result.endLine,
|
|
85
|
-
endColumn: result.endColumn,
|
|
86
81
|
};
|
|
87
82
|
|
|
83
|
+
if (typeof result.endLine === 'string') {
|
|
84
|
+
context.endLine = result.endLine;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof result.endColumn === 'string') {
|
|
88
|
+
context.endColumn = result.endColumn;
|
|
89
|
+
}
|
|
90
|
+
|
|
88
91
|
switch (result.severity) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
case 0: {
|
|
93
|
+
lines.push(setNotice(message, context));
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 1: {
|
|
97
|
+
lines.push(setWarning(message, context));
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case 2: {
|
|
101
|
+
lines.push(setError(message, context));
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
|
|
@@ -98,7 +108,7 @@ function formatFileResult(fileResult) {
|
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
/**
|
|
101
|
-
* @param {LintResult[]} fileResults The
|
|
111
|
+
* @param {LintResult[]} fileResults - The linting results.
|
|
102
112
|
* @returns {string}
|
|
103
113
|
*/
|
|
104
114
|
function formatter(fileResults) {
|
package/types/index.d.ts
CHANGED
|
@@ -1,30 +1,81 @@
|
|
|
1
1
|
export = formatter;
|
|
2
2
|
/**
|
|
3
|
-
* @param {LintResult[]} fileResults The
|
|
3
|
+
* @param {LintResult[]} fileResults - The linting results.
|
|
4
4
|
* @returns {string}
|
|
5
5
|
*/
|
|
6
6
|
declare function formatter(fileResults: LintResult[]): string;
|
|
7
7
|
declare namespace formatter {
|
|
8
8
|
export { LintMessage, LintResult };
|
|
9
9
|
}
|
|
10
|
+
type LintMessage = {
|
|
11
|
+
/**
|
|
12
|
+
* - The start of error column number.
|
|
13
|
+
*/
|
|
14
|
+
column: number;
|
|
15
|
+
/**
|
|
16
|
+
* - The start of error line number.
|
|
17
|
+
*/
|
|
18
|
+
line: number;
|
|
19
|
+
/**
|
|
20
|
+
* - The end of error column number.
|
|
21
|
+
*/
|
|
22
|
+
endColumn?: number;
|
|
23
|
+
/**
|
|
24
|
+
* - The end of error line number.
|
|
25
|
+
*/
|
|
26
|
+
endLine?: number;
|
|
27
|
+
/**
|
|
28
|
+
* - The lint rule id.
|
|
29
|
+
*/
|
|
30
|
+
ruleId: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* - The lint message.
|
|
33
|
+
*/
|
|
34
|
+
message: string;
|
|
35
|
+
/**
|
|
36
|
+
* - The lint message id.
|
|
37
|
+
*/
|
|
38
|
+
messageId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* - The estree node.
|
|
41
|
+
*/
|
|
42
|
+
nodeType?: string;
|
|
43
|
+
/**
|
|
44
|
+
* - Linting fatality flag.
|
|
45
|
+
*/
|
|
46
|
+
fatal?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* - Lint severity.
|
|
49
|
+
*/
|
|
50
|
+
severity: 0 | 1 | 2;
|
|
51
|
+
};
|
|
10
52
|
type LintResult = {
|
|
53
|
+
/**
|
|
54
|
+
* - Linted file path.
|
|
55
|
+
*/
|
|
11
56
|
filePath: string;
|
|
57
|
+
/**
|
|
58
|
+
* - Collection of messages for the file.
|
|
59
|
+
*/
|
|
12
60
|
messages: LintMessage[];
|
|
61
|
+
/**
|
|
62
|
+
* - Number of errors.
|
|
63
|
+
*/
|
|
13
64
|
errorCount: number;
|
|
65
|
+
/**
|
|
66
|
+
* - Number of fatal errors.
|
|
67
|
+
*/
|
|
14
68
|
fatalErrorCount: number;
|
|
69
|
+
/**
|
|
70
|
+
* - Number of warnings.
|
|
71
|
+
*/
|
|
15
72
|
warningCount: number;
|
|
73
|
+
/**
|
|
74
|
+
* - Number of fixable errors.
|
|
75
|
+
*/
|
|
16
76
|
fixableErrorCount: number;
|
|
77
|
+
/**
|
|
78
|
+
* - Number of fixable warnings.
|
|
79
|
+
*/
|
|
17
80
|
fixableWarningCount: number;
|
|
18
81
|
};
|
|
19
|
-
type LintMessage = {
|
|
20
|
-
column: number;
|
|
21
|
-
line: number;
|
|
22
|
-
endColumn?: number | undefined;
|
|
23
|
-
endLine?: number | undefined;
|
|
24
|
-
ruleId: string | null;
|
|
25
|
-
message: string;
|
|
26
|
-
messageId?: string | undefined;
|
|
27
|
-
nodeType?: string | undefined;
|
|
28
|
-
fatal?: boolean | undefined;
|
|
29
|
-
severity: 0 | 1 | 2;
|
|
30
|
-
};
|