jest-preset-stylelint 5.0.4 → 6.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/getTestRule.js +9 -3
- package/package.json +19 -16
package/getTestRule.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const util = require('util');
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
// @ts-expect-error -- TS2614: Module '"stylelint"' has no exported member 'lint'. Did you mean to use 'import lint from "stylelint"' instead?
|
|
6
|
+
const { lint } = require('stylelint'); // eslint-disable-line node/no-unpublished-require -- Avoid auto-install of `stylelint` peer dependency.
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @typedef {import('.').TestCase} TestCase
|
|
@@ -36,6 +37,7 @@ module.exports = function getTestRule(options = {}) {
|
|
|
36
37
|
|
|
37
38
|
expect(output.results[0].warnings).toEqual([]);
|
|
38
39
|
expect(output.results[0].parseErrors).toEqual([]);
|
|
40
|
+
expect(output.results[0].invalidOptionWarnings).toEqual([]);
|
|
39
41
|
|
|
40
42
|
if (!schema.fix) return;
|
|
41
43
|
|
|
@@ -61,7 +63,10 @@ module.exports = function getTestRule(options = {}) {
|
|
|
61
63
|
|
|
62
64
|
const outputAfterLint = await lint(stylelintOptions);
|
|
63
65
|
|
|
64
|
-
const actualWarnings =
|
|
66
|
+
const actualWarnings = [
|
|
67
|
+
...outputAfterLint.results[0].invalidOptionWarnings,
|
|
68
|
+
...outputAfterLint.results[0].warnings,
|
|
69
|
+
];
|
|
65
70
|
|
|
66
71
|
expect(outputAfterLint.results[0]).toMatchObject({ parseErrors: [] });
|
|
67
72
|
expect(actualWarnings).toHaveLength(testCase.warnings ? testCase.warnings.length : 1);
|
|
@@ -117,6 +122,7 @@ module.exports = function getTestRule(options = {}) {
|
|
|
117
122
|
const outputAfterLintOnFixedCode = await lint({
|
|
118
123
|
...stylelintOptions,
|
|
119
124
|
code: fixedCode,
|
|
125
|
+
fix: testCase.unfixable,
|
|
120
126
|
});
|
|
121
127
|
|
|
122
128
|
expect(outputAfterLintOnFixedCode.results[0]).toMatchObject({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-stylelint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Jest preset for Stylelint plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stylelint",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"lint:md": "remark . --quiet --frail",
|
|
28
28
|
"lint:types": "tsc",
|
|
29
29
|
"release": "np",
|
|
30
|
+
"pretest": "npm run lint",
|
|
30
31
|
"test": "jest",
|
|
31
32
|
"watch": "jest --watch",
|
|
32
33
|
"prepare": "husky install"
|
|
@@ -38,7 +39,8 @@
|
|
|
38
39
|
"prettier": "@stylelint/prettier-config",
|
|
39
40
|
"eslintConfig": {
|
|
40
41
|
"extends": [
|
|
41
|
-
"stylelint"
|
|
42
|
+
"stylelint",
|
|
43
|
+
"stylelint/jest"
|
|
42
44
|
],
|
|
43
45
|
"globals": {
|
|
44
46
|
"module": true,
|
|
@@ -54,24 +56,25 @@
|
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@stylelint/prettier-config": "^2.0.0",
|
|
57
|
-
"@stylelint/remark-preset": "^
|
|
58
|
-
"@types/jest": "^
|
|
59
|
-
"eslint": "^8.
|
|
60
|
-
"eslint-config-stylelint": "^
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
59
|
+
"@stylelint/remark-preset": "^4.0.0",
|
|
60
|
+
"@types/jest": "^29.4.0",
|
|
61
|
+
"eslint": "^8.34.0",
|
|
62
|
+
"eslint-config-stylelint": "^18.0.0",
|
|
63
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
64
|
+
"husky": "^8.0.3",
|
|
65
|
+
"jest": "^29.4.3",
|
|
66
|
+
"lint-staged": "^13.1.2",
|
|
67
|
+
"np": "^7.6.3",
|
|
65
68
|
"npm-run-all": "^4.1.5",
|
|
66
|
-
"prettier": "^2.
|
|
67
|
-
"remark-cli": "^
|
|
68
|
-
"stylelint": "^
|
|
69
|
-
"typescript": "^4.
|
|
69
|
+
"prettier": "^2.8.4",
|
|
70
|
+
"remark-cli": "^11.0.0",
|
|
71
|
+
"stylelint": "^15.1.0",
|
|
72
|
+
"typescript": "^4.9.5"
|
|
70
73
|
},
|
|
71
74
|
"peerDependencies": {
|
|
72
|
-
"jest": "^
|
|
75
|
+
"jest": "^29.0.2"
|
|
73
76
|
},
|
|
74
77
|
"engines": {
|
|
75
|
-
"node": "^
|
|
78
|
+
"node": "^14.15.0 || >=16.10.0"
|
|
76
79
|
}
|
|
77
80
|
}
|