@pi-r/stylelint 0.7.3 → 0.8.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/README.md +1 -1
- package/index.js +10 -8
- package/package.json +5 -5
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const Document = require("@e-mc/document");
|
|
3
|
-
|
|
3
|
+
async function transform(context, value, options) {
|
|
4
4
|
context = options.upgrade(context, __dirname);
|
|
5
5
|
const { pathname, filename } = options;
|
|
6
6
|
const baseConfig = options.toBaseConfig();
|
|
7
7
|
const timeStamp = Date.now();
|
|
8
|
-
const report =
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const report = await context.lint({ code: value, fix: baseConfig.fix ?? process.env.STYLELINT_OPTIONS_FIX === 'true', config: Object.keys(baseConfig).length > 0 ? baseConfig : undefined });
|
|
9
|
+
const result = report.results[0];
|
|
10
|
+
if (result?.warnings.length) {
|
|
11
|
+
options.out[Document.hasLogType(options.logType.STDOUT) ? 'logQueued' : 'logAppend'] = Document.generateLintTable(result.warnings.map(item => ({
|
|
11
12
|
ruleId: item.rule,
|
|
12
13
|
line: item.line,
|
|
13
14
|
column: item.column,
|
|
14
15
|
message: item.text,
|
|
15
16
|
severity: item.severity
|
|
16
|
-
})), { leadingText: 'stylelint', pathname, filename, trailingText: 'https://stylelint.io/user-guide/rules
|
|
17
|
+
})), { leadingText: 'stylelint', pathname, filename, trailingText: 'https://stylelint.io/user-guide/rules', timeStamp });
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
19
|
-
options.out.messageAppend = ` -> valid(${!
|
|
20
|
+
options.out.messageAppend = ` -> valid(${!result || report.errored ? 'NO' : 'YES'})`;
|
|
20
21
|
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
22
|
+
return report?.code || value;
|
|
23
|
+
}
|
|
24
|
+
module.exports = transform;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/stylelint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Stylelint transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
12
|
-
"directory": "src/
|
|
12
|
+
"directory": "src/document/stylelint"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"squared",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/document": "^0.
|
|
24
|
-
"stylelint": "^16.
|
|
23
|
+
"@e-mc/document": "^0.10.0",
|
|
24
|
+
"stylelint": "^16.8.2",
|
|
25
25
|
"stylelint-config-standard": "^36.0.1"
|
|
26
26
|
}
|
|
27
27
|
}
|