@jhae/stylelint-config-verifier 1.0.0 → 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.
|
@@ -6,7 +6,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ConfigVerifier = void 0;
|
|
7
7
|
const stylelint_1 = __importDefault(require("stylelint"));
|
|
8
8
|
/**
|
|
9
|
-
* ConfigVerifier class
|
|
9
|
+
* The `ConfigVerifier` class verifies the rules of a Stylelint configuration. It runs Stylelint for a given test case
|
|
10
|
+
* and compares the linter result with the expected result. The test case contains the code that should be linted and
|
|
11
|
+
* the expected result. The expected result contains the expected error status, messages, and severities.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* new ConfigVerifier().verify(
|
|
16
|
+
* 'at-rule-disallowed-list',
|
|
17
|
+
* {
|
|
18
|
+
* name: 'Disallow @debug rule',
|
|
19
|
+
* code: '@debug "";',
|
|
20
|
+
* expect: {
|
|
21
|
+
* errored: true,
|
|
22
|
+
* messages: ['Unexpected at-rule "debug"'],
|
|
23
|
+
* severities: ['error'],
|
|
24
|
+
* },
|
|
25
|
+
* },
|
|
26
|
+
* {
|
|
27
|
+
* name: 'Allow @use rule',
|
|
28
|
+
* code: '@use "test.scss";',
|
|
29
|
+
* },
|
|
30
|
+
* );
|
|
31
|
+
* ``
|
|
10
32
|
*/
|
|
11
33
|
class ConfigVerifier {
|
|
12
34
|
configFile;
|
|
@@ -25,7 +47,7 @@ class ConfigVerifier {
|
|
|
25
47
|
severities: [],
|
|
26
48
|
};
|
|
27
49
|
/**
|
|
28
|
-
* Creates
|
|
50
|
+
* Creates a new `ConfigVerifier` object.
|
|
29
51
|
*
|
|
30
52
|
* @param {string} configFile The path to the Stylelint config file whose rules should be verified
|
|
31
53
|
*/
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import stylelint from 'stylelint';
|
|
2
2
|
/**
|
|
3
|
-
* ConfigVerifier class
|
|
3
|
+
* The `ConfigVerifier` class verifies the rules of a Stylelint configuration. It runs Stylelint for a given test case
|
|
4
|
+
* and compares the linter result with the expected result. The test case contains the code that should be linted and
|
|
5
|
+
* the expected result. The expected result contains the expected error status, messages, and severities.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* new ConfigVerifier().verify(
|
|
10
|
+
* 'at-rule-disallowed-list',
|
|
11
|
+
* {
|
|
12
|
+
* name: 'Disallow @debug rule',
|
|
13
|
+
* code: '@debug "";',
|
|
14
|
+
* expect: {
|
|
15
|
+
* errored: true,
|
|
16
|
+
* messages: ['Unexpected at-rule "debug"'],
|
|
17
|
+
* severities: ['error'],
|
|
18
|
+
* },
|
|
19
|
+
* },
|
|
20
|
+
* {
|
|
21
|
+
* name: 'Allow @use rule',
|
|
22
|
+
* code: '@use "test.scss";',
|
|
23
|
+
* },
|
|
24
|
+
* );
|
|
25
|
+
* ``
|
|
4
26
|
*/
|
|
5
27
|
export class ConfigVerifier {
|
|
6
28
|
configFile;
|
|
@@ -19,7 +41,7 @@ export class ConfigVerifier {
|
|
|
19
41
|
severities: [],
|
|
20
42
|
};
|
|
21
43
|
/**
|
|
22
|
-
* Creates
|
|
44
|
+
* Creates a new `ConfigVerifier` object.
|
|
23
45
|
*
|
|
24
46
|
* @param {string} configFile The path to the Stylelint config file whose rules should be verified
|
|
25
47
|
*/
|
package/package.json
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jhae/stylelint-config-verifier",
|
|
3
3
|
"description": "A Stylelint configuration tester for Jest that helps you verify your defined rules.",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"
|
|
6
|
-
"module": "./dist/esm/config-verifier.class.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
"types": "./types/config-verifier.class.d.ts",
|
|
9
|
-
"require": "./dist/cjs/config-verifier.class.js",
|
|
10
|
-
"default": "./dist/esm/config-verifier.class.js"
|
|
11
|
-
},
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"license": "MIT",
|
|
12
6
|
"author": {
|
|
13
7
|
"name": "JHAE",
|
|
14
8
|
"url": "https://github.com/jhae-de"
|
|
15
9
|
},
|
|
10
|
+
"homepage": "https://github.com/jhae-de/stylelint-config-verifier",
|
|
16
11
|
"repository": {
|
|
17
|
-
"url": "https://github.com/jhae-de/stylelint-config-verifier.git",
|
|
12
|
+
"url": "git+https://github.com/jhae-de/stylelint-config-verifier.git",
|
|
18
13
|
"type": "git"
|
|
19
14
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/cjs/config-verifier.js",
|
|
17
|
+
"module": "./dist/esm/config-verifier.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
"types": "./types/config-verifier.d.ts",
|
|
20
|
+
"require": "./dist/cjs/config-verifier.js",
|
|
21
|
+
"default": "./dist/esm/config-verifier.js"
|
|
22
|
+
},
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"build:
|
|
25
|
-
"build:esm": "tsc --project tsconfig.esm.json",
|
|
26
|
-
"build:types": "rm -rf ./types && tsc --project tsconfig.types.json",
|
|
24
|
+
"build": "./bin/build.sh",
|
|
25
|
+
"build:types": "./bin/build-types.sh",
|
|
27
26
|
"lint": "npm run-script lint:prettier && npm run-script lint:eslint",
|
|
28
27
|
"lint:eslint": "eslint .",
|
|
29
28
|
"lint:prettier": "prettier . --check",
|
|
30
|
-
"postbuild": "./bin/post-build.sh",
|
|
31
29
|
"test": "jest",
|
|
32
30
|
"test:coverage": "npm run-script test -- --coverage",
|
|
33
31
|
"test:watch": "npm run-script test -- --watchAll",
|
|
34
32
|
"test:watch:coverage": "npm run-script test:watch -- --coverage"
|
|
35
33
|
},
|
|
36
34
|
"devDependencies": {
|
|
37
|
-
"@eslint/js": "^9.
|
|
35
|
+
"@eslint/js": "^9.21",
|
|
38
36
|
"@types/jest": "^29.5",
|
|
39
|
-
"eslint": "^9.
|
|
40
|
-
"eslint-config-prettier": "^
|
|
37
|
+
"eslint": "^9.21",
|
|
38
|
+
"eslint-config-prettier": "^10.0",
|
|
41
39
|
"eslint-plugin-prettier": "^5.2",
|
|
42
|
-
"
|
|
43
|
-
"prettier": "^3.3",
|
|
40
|
+
"prettier": "^3.5",
|
|
44
41
|
"ts-jest": "^29.2",
|
|
45
42
|
"typescript": "^5.7",
|
|
46
|
-
"typescript-eslint": "^8.
|
|
43
|
+
"typescript-eslint": "^8.24"
|
|
47
44
|
},
|
|
48
45
|
"peerDependencies": {
|
|
49
46
|
"jest": "^29.0",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { TestCase } from './type';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The `ConfigVerifier` class verifies the rules of a Stylelint configuration. It runs Stylelint for a given test case
|
|
5
|
+
* and compares the linter result with the expected result. The test case contains the code that should be linted and
|
|
6
|
+
* the expected result. The expected result contains the expected error status, messages, and severities.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* new ConfigVerifier().verify(
|
|
11
|
+
* 'at-rule-disallowed-list',
|
|
12
|
+
* {
|
|
13
|
+
* name: 'Disallow @debug rule',
|
|
14
|
+
* code: '@debug "";',
|
|
15
|
+
* expect: {
|
|
16
|
+
* errored: true,
|
|
17
|
+
* messages: ['Unexpected at-rule "debug"'],
|
|
18
|
+
* severities: ['error'],
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* {
|
|
22
|
+
* name: 'Allow @use rule',
|
|
23
|
+
* code: '@use "test.scss";',
|
|
24
|
+
* },
|
|
25
|
+
* );
|
|
26
|
+
* ``
|
|
27
|
+
*/
|
|
28
|
+
export declare class ConfigVerifier {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new `ConfigVerifier` object.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} configFile The path to the Stylelint config file whose rules should be verified
|
|
33
|
+
*/
|
|
34
|
+
constructor(configFile?: string);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Verifies a rule configuration.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} ruleName The name of the rule
|
|
40
|
+
* @param {TestCase[]} testCases The test cases
|
|
41
|
+
*/
|
|
42
|
+
verify(ruleName: string, ...testCases: TestCase[]): void;
|
|
43
|
+
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TestCase } from './type';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ConfigVerifier class
|
|
5
|
-
*/
|
|
6
|
-
export declare class ConfigVerifier {
|
|
7
|
-
/**
|
|
8
|
-
* Creates and initializes an object instance of the class.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} configFile The path to the Stylelint config file whose rules should be verified
|
|
11
|
-
*/
|
|
12
|
-
constructor(configFile?: string);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Verifies a rule configuration.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} ruleName The name of the rule
|
|
18
|
-
* @param {TestCase[]} testCases The test cases
|
|
19
|
-
*/
|
|
20
|
-
verify(ruleName: string, ...testCases: TestCase[]): void;
|
|
21
|
-
}
|