@studiometa/stylelint-formatter-gitlab 1.0.2 → 1.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 +6 -0
- package/package.json +9 -12
- package/src/index.js +1 -2
- package/src/utils.js +25 -10
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## v1.1.0 - 2026-02-28
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Add support for Stylelint v17 ([649ae1b](https://github.com/studiometa/stylelint-formatter-gitlab/commit/649ae1b), [#69](https://github.com/studiometa/stylelint-formatter-gitlab/pull/69))
|
|
14
|
+
|
|
9
15
|
## v1.0.2 - 2025-05-23
|
|
10
16
|
|
|
11
17
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/stylelint-formatter-gitlab",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A StyleLint formatter for the GitLab Code Quality report",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,20 +35,17 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/studiometa/stylelint-formatter-gitlab#readme",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@studiometa/eslint-config": "4.
|
|
39
|
-
"@studiometa/prettier-config": "4.
|
|
40
|
-
"@studiometa/stylelint-config": "4.
|
|
41
|
-
"bun": "1.
|
|
42
|
-
"
|
|
43
|
-
"prettier": "3.5.3",
|
|
44
|
-
"stylelint": "16.19.1"
|
|
38
|
+
"@studiometa/eslint-config": "4.3.1",
|
|
39
|
+
"@studiometa/prettier-config": "4.4.0",
|
|
40
|
+
"@studiometa/stylelint-config": "4.1.1",
|
|
41
|
+
"bun": "1.3.0",
|
|
42
|
+
"stylelint": "17.4.0"
|
|
45
43
|
},
|
|
46
44
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"js-yaml": "^4.1.0"
|
|
45
|
+
"jest-diff": "30.2.0",
|
|
46
|
+
"yaml": "2.8.2"
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
52
|
-
"stylelint": "^16.0"
|
|
49
|
+
"stylelint": "^16.0 || ^17.0"
|
|
53
50
|
}
|
|
54
51
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import { exit } from 'node:process';
|
|
3
2
|
import stylelint from 'stylelint';
|
|
4
3
|
import { getOutputPath, convert, getEnv } from './utils.js';
|
|
5
4
|
|
|
@@ -22,7 +21,7 @@ export default function gitlabFormatter(results, returnValue) {
|
|
|
22
21
|
stylelint.formatters[STYLELINT_FORMATTER].then((fallbackFormatter) => {
|
|
23
22
|
console.log(fallbackFormatter(results, returnValue));
|
|
24
23
|
if (returnValue.errored) {
|
|
25
|
-
exit(1);
|
|
24
|
+
process.exit(1);
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
}
|
package/src/utils.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { join, resolve, relative } from 'node:path';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import { parseDocument } from 'yaml';
|
|
5
|
+
|
|
6
|
+
/** @type {import('yaml').CollectionTag} */
|
|
7
|
+
const referenceTag = {
|
|
8
|
+
tag: '!reference',
|
|
9
|
+
collection: 'seq',
|
|
10
|
+
default: false,
|
|
11
|
+
resolve() {
|
|
12
|
+
// We only allow the syntax. We don’t actually resolve the reference.
|
|
13
|
+
},
|
|
14
|
+
};
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
17
|
* Get environment variables with sane defaults.
|
|
@@ -33,22 +42,28 @@ export function getEnv() {
|
|
|
33
42
|
*/
|
|
34
43
|
export function getOutputPath() {
|
|
35
44
|
const { CI_PROJECT_DIR, CI_CONFIG_PATH, CI_JOB_NAME } = getEnv();
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
const doc = parseDocument(readFileSync(join(CI_PROJECT_DIR, CI_CONFIG_PATH), 'utf-8'), {
|
|
46
|
+
version: '1.1',
|
|
47
|
+
customTags: [referenceTag],
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const path = [CI_JOB_NAME, 'artifacts', 'reports', 'codequality'];
|
|
51
|
+
const location = doc.getIn(path);
|
|
52
|
+
|
|
39
53
|
const msg = `Expected ${CI_JOB_NAME}.artifacts.reports.codequality to be one exact path`;
|
|
54
|
+
|
|
40
55
|
if (location === null || location === undefined) {
|
|
41
56
|
throw new Error(`${msg}, but no value was found.`);
|
|
42
57
|
}
|
|
43
|
-
|
|
44
|
-
throw new Error(`${msg}, but found an array instead.`);
|
|
45
|
-
}
|
|
58
|
+
|
|
46
59
|
if (typeof location !== 'string') {
|
|
47
60
|
throw new Error(`${msg}, but found ${JSON.stringify(location)} instead.`);
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
|
|
63
|
+
if (location.includes('*')) {
|
|
64
|
+
throw new Error(`${msg}, but found a glob-like string instead.`);
|
|
51
65
|
}
|
|
66
|
+
|
|
52
67
|
return resolve(CI_PROJECT_DIR, location);
|
|
53
68
|
}
|
|
54
69
|
|