stylelint-webpack-plugin 3.0.1 → 3.2.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/README.md +146 -26
- package/dist/StylelintError.js +1 -7
- package/dist/getStylelint.js +31 -24
- package/dist/index.js +48 -34
- package/dist/linter.js +32 -23
- package/dist/options.js +14 -16
- package/dist/utils.js +19 -19
- package/package.json +31 -31
- package/types/StylelintError.d.ts +8 -0
- package/types/getStylelint.d.ts +91 -0
- package/{declarations → types}/index.d.ts +13 -10
- package/types/linter.d.ts +109 -0
- package/{declarations → types}/options.d.ts +79 -24
- package/{declarations → types}/utils.d.ts +5 -0
- package/types/worker.d.ts +58 -0
- package/declarations/StylelintError.d.ts +0 -2
- package/declarations/cjs.d.ts +0 -3
- package/declarations/getStylelint.d.ts +0 -24
- package/declarations/linter.d.ts +0 -34
- package/declarations/worker.d.ts +0 -3
- package/dist/cjs.js +0 -5
package/dist/options.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.getOptions = getOptions;
|
|
7
|
-
exports.getStylelintOptions = getStylelintOptions;
|
|
8
|
-
|
|
9
|
-
var _schemaUtils = require("schema-utils");
|
|
10
|
-
|
|
11
|
-
var _options = _interopRequireDefault(require("./options.json"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
// @ts-ignore
|
|
3
|
+
const {
|
|
4
|
+
validate
|
|
5
|
+
} = require('schema-utils');
|
|
16
6
|
|
|
7
|
+
const schema = require('./options.json');
|
|
17
8
|
/** @typedef {import("stylelint")} stylelint */
|
|
18
9
|
|
|
19
10
|
/** @typedef {import("stylelint").LinterOptions} StylelintOptions */
|
|
@@ -50,6 +41,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
50
41
|
* @param {Options} pluginOptions
|
|
51
42
|
* @returns {Partial<PluginOptions>}
|
|
52
43
|
*/
|
|
44
|
+
|
|
45
|
+
|
|
53
46
|
function getOptions(pluginOptions) {
|
|
54
47
|
const options = {
|
|
55
48
|
extensions: ['css', 'scss', 'sass'],
|
|
@@ -63,7 +56,7 @@ function getOptions(pluginOptions) {
|
|
|
63
56
|
} : {})
|
|
64
57
|
}; // @ts-ignore
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
validate(schema, options, {
|
|
67
60
|
name: 'Stylelint Webpack Plugin',
|
|
68
61
|
baseDataPath: 'options'
|
|
69
62
|
});
|
|
@@ -83,7 +76,7 @@ function getStylelintOptions(pluginOptions) {
|
|
|
83
76
|
files,
|
|
84
77
|
formatter,
|
|
85
78
|
...stylelintOnlyOptions
|
|
86
|
-
} =
|
|
79
|
+
} = schema.properties; // No need to guard the for-in because schema.properties has hardcoded keys.
|
|
87
80
|
// eslint-disable-next-line guard-for-in
|
|
88
81
|
|
|
89
82
|
for (const option in stylelintOnlyOptions) {
|
|
@@ -92,4 +85,9 @@ function getStylelintOptions(pluginOptions) {
|
|
|
92
85
|
}
|
|
93
86
|
|
|
94
87
|
return stylelintOptions;
|
|
95
|
-
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = {
|
|
91
|
+
getOptions,
|
|
92
|
+
getStylelintOptions
|
|
93
|
+
};
|
package/dist/utils.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.arrify = arrify;
|
|
7
|
-
exports.parseFiles = parseFiles;
|
|
8
|
-
exports.parseFoldersToGlobs = parseFoldersToGlobs;
|
|
9
|
-
exports.jsonStringifyReplacerSortKeys = void 0;
|
|
3
|
+
const {
|
|
4
|
+
resolve
|
|
5
|
+
} = require('path');
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _normalizePath = _interopRequireDefault(require("normalize-path"));
|
|
16
|
-
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
|
-
// @ts-ignore
|
|
7
|
+
const {
|
|
8
|
+
statSync
|
|
9
|
+
} = require('fs');
|
|
20
10
|
|
|
11
|
+
const normalizePath = require('normalize-path');
|
|
21
12
|
/**
|
|
22
13
|
* @template T
|
|
23
14
|
* @param {T} value
|
|
@@ -33,6 +24,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
33
24
|
: [T]
|
|
34
25
|
}
|
|
35
26
|
*/
|
|
27
|
+
|
|
28
|
+
/* istanbul ignore next */
|
|
29
|
+
|
|
30
|
+
|
|
36
31
|
function arrify(value) {
|
|
37
32
|
// eslint-disable-next-line no-undefined
|
|
38
33
|
if (value === null || value === undefined) {
|
|
@@ -69,7 +64,7 @@ function arrify(value) {
|
|
|
69
64
|
function parseFiles(files, context) {
|
|
70
65
|
return arrify(files).map((
|
|
71
66
|
/** @type {string} */
|
|
72
|
-
file) => (
|
|
67
|
+
file) => normalizePath(resolve(context, file)));
|
|
73
68
|
}
|
|
74
69
|
/**
|
|
75
70
|
* @param {string|string[]} patterns
|
|
@@ -89,7 +84,7 @@ function parseFoldersToGlobs(patterns, extensions = []) {
|
|
|
89
84
|
pattern) => {
|
|
90
85
|
try {
|
|
91
86
|
// The patterns are absolute because they are prepended with the context.
|
|
92
|
-
const stats =
|
|
87
|
+
const stats = statSync(pattern);
|
|
93
88
|
/* istanbul ignore else */
|
|
94
89
|
|
|
95
90
|
if (stats.isDirectory()) {
|
|
@@ -122,4 +117,9 @@ const jsonStringifyReplacerSortKeys = (_, value) => {
|
|
|
122
117
|
return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce(insert, {}) : value;
|
|
123
118
|
};
|
|
124
119
|
|
|
125
|
-
exports
|
|
120
|
+
module.exports = {
|
|
121
|
+
arrify,
|
|
122
|
+
parseFiles,
|
|
123
|
+
parseFoldersToGlobs,
|
|
124
|
+
jsonStringifyReplacerSortKeys
|
|
125
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-webpack-plugin",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A Stylelint plugin for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/stylelint-webpack-plugin",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"type": "opencollective",
|
|
12
12
|
"url": "https://opencollective.com/webpack"
|
|
13
13
|
},
|
|
14
|
-
"main": "dist/
|
|
15
|
-
"types": "
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "types/index.d.ts",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">= 12.13.0"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"start": "npm run build -- -w",
|
|
21
|
-
"clean": "del-cli dist
|
|
21
|
+
"clean": "del-cli dist types",
|
|
22
22
|
"prebuild": "npm run clean",
|
|
23
|
-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir
|
|
23
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
|
|
24
24
|
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
|
25
25
|
"build": "npm-run-all -p \"build:**\"",
|
|
26
26
|
"commitlint": "commitlint --from=master",
|
|
@@ -39,51 +39,51 @@
|
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
42
|
-
"
|
|
42
|
+
"types"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"stylelint": "^13.0.0",
|
|
45
|
+
"stylelint": "^13.0.0 || ^14.0.0",
|
|
46
46
|
"webpack": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"globby": "^11.0.4",
|
|
49
|
+
"jest-worker": "^27.5.1",
|
|
50
|
+
"globby": "^11.1.0",
|
|
52
51
|
"micromatch": "^4.0.4",
|
|
53
52
|
"normalize-path": "^3.0.0",
|
|
54
|
-
"schema-utils": "^
|
|
53
|
+
"schema-utils": "^4.0.0"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
|
-
"@babel/cli": "^7.
|
|
58
|
-
"@babel/core": "^7.
|
|
59
|
-
"@babel/preset-env": "^7.
|
|
60
|
-
"@commitlint/cli": "^
|
|
61
|
-
"@commitlint/config-conventional": "^
|
|
62
|
-
"@types/fs-extra": "^9.0.
|
|
56
|
+
"@babel/cli": "^7.17.6",
|
|
57
|
+
"@babel/core": "^7.17.7",
|
|
58
|
+
"@babel/preset-env": "^7.16.11",
|
|
59
|
+
"@commitlint/cli": "^16.2.3",
|
|
60
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
61
|
+
"@types/fs-extra": "^9.0.13",
|
|
63
62
|
"@types/micromatch": "^4.0.2",
|
|
64
63
|
"@types/normalize-path": "^3.0.0",
|
|
65
64
|
"@types/webpack": "^5.28.0",
|
|
66
65
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
67
66
|
"babel-eslint": "^10.1.0",
|
|
68
|
-
"babel-jest": "^27.
|
|
67
|
+
"babel-jest": "^27.5.1",
|
|
69
68
|
"chokidar": "^3.5.2",
|
|
70
69
|
"cross-env": "^7.0.3",
|
|
71
70
|
"del": "^6.0.0",
|
|
72
|
-
"del-cli": "^4.0.
|
|
73
|
-
"eslint": "^
|
|
74
|
-
"eslint-config-prettier": "^8.
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
71
|
+
"del-cli": "^4.0.1",
|
|
72
|
+
"eslint": "^8.11.0",
|
|
73
|
+
"eslint-config-prettier": "^8.5.0",
|
|
74
|
+
"eslint-plugin-import": "^2.25.4",
|
|
76
75
|
"file-loader": "^6.2.0",
|
|
77
|
-
"fs-extra": "^10.0.
|
|
78
|
-
"husky": "^7.0.
|
|
79
|
-
"jest": "^27.
|
|
80
|
-
"lint-staged": "^
|
|
76
|
+
"fs-extra": "^10.0.1",
|
|
77
|
+
"husky": "^7.0.4",
|
|
78
|
+
"jest": "^27.5.1",
|
|
79
|
+
"lint-staged": "^12.3.6",
|
|
81
80
|
"npm-run-all": "^4.1.5",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
81
|
+
"postcss-scss": "^4.0.3",
|
|
82
|
+
"prettier": "^2.6.0",
|
|
83
|
+
"standard-version": "^9.3.2",
|
|
84
|
+
"stylelint": "^14.6.0",
|
|
85
|
+
"typescript": "^4.6.2",
|
|
86
|
+
"webpack": "^5.70.0"
|
|
87
87
|
},
|
|
88
88
|
"keywords": [
|
|
89
89
|
"stylelint",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export = getStylelint;
|
|
3
|
+
/**
|
|
4
|
+
* @param {string|undefined} key
|
|
5
|
+
* @param {Options} options
|
|
6
|
+
* @returns {Linter}
|
|
7
|
+
*/
|
|
8
|
+
declare function getStylelint(
|
|
9
|
+
key: string | undefined,
|
|
10
|
+
{ threads, ...options }: Options
|
|
11
|
+
): Linter;
|
|
12
|
+
declare namespace getStylelint {
|
|
13
|
+
export {
|
|
14
|
+
Stylelint,
|
|
15
|
+
LintResult,
|
|
16
|
+
Options,
|
|
17
|
+
AsyncTask,
|
|
18
|
+
LintTask,
|
|
19
|
+
Linter,
|
|
20
|
+
Worker,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type Options = import('./options').Options;
|
|
24
|
+
type Linter = {
|
|
25
|
+
api: import('stylelint').InternalApi;
|
|
26
|
+
stylelint: Stylelint;
|
|
27
|
+
lintFiles: LintTask;
|
|
28
|
+
cleanup: AsyncTask;
|
|
29
|
+
threads: number;
|
|
30
|
+
};
|
|
31
|
+
type Stylelint = import('postcss').PluginCreator<
|
|
32
|
+
import('stylelint').PostcssPluginOptions
|
|
33
|
+
> & {
|
|
34
|
+
lint: (
|
|
35
|
+
options: import('stylelint').LinterOptions
|
|
36
|
+
) => Promise<import('stylelint').LinterResult>;
|
|
37
|
+
rules: {
|
|
38
|
+
[k: string]: import('stylelint').Rule<any, any>;
|
|
39
|
+
};
|
|
40
|
+
formatters: {
|
|
41
|
+
[k: string]: import('stylelint').Formatter;
|
|
42
|
+
};
|
|
43
|
+
createPlugin: (
|
|
44
|
+
ruleName: string,
|
|
45
|
+
plugin: import('stylelint').Plugin<any, any>
|
|
46
|
+
) => {
|
|
47
|
+
ruleName: string;
|
|
48
|
+
rule: import('stylelint').Rule<any, any>;
|
|
49
|
+
};
|
|
50
|
+
createLinter: (
|
|
51
|
+
options: import('stylelint').LinterOptions
|
|
52
|
+
) => import('stylelint').InternalApi;
|
|
53
|
+
resolveConfig: (
|
|
54
|
+
filePath: string,
|
|
55
|
+
options?:
|
|
56
|
+
| Pick<
|
|
57
|
+
import('stylelint').LinterOptions,
|
|
58
|
+
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
59
|
+
>
|
|
60
|
+
| undefined
|
|
61
|
+
) => Promise<import('stylelint').Config | undefined>;
|
|
62
|
+
utils: {
|
|
63
|
+
report: (problem: import('stylelint').Problem) => void;
|
|
64
|
+
ruleMessages: <
|
|
65
|
+
T extends import('stylelint').RuleMessages,
|
|
66
|
+
R extends { [K in keyof T]: T[K] }
|
|
67
|
+
>(
|
|
68
|
+
ruleName: string,
|
|
69
|
+
messages: T
|
|
70
|
+
) => R;
|
|
71
|
+
validateOptions: (
|
|
72
|
+
result: import('stylelint').PostcssResult,
|
|
73
|
+
ruleName: string,
|
|
74
|
+
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
75
|
+
) => boolean;
|
|
76
|
+
checkAgainstRule: <T_1, O extends Object>(
|
|
77
|
+
options: {
|
|
78
|
+
ruleName: string;
|
|
79
|
+
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
80
|
+
root: import('postcss').Root;
|
|
81
|
+
},
|
|
82
|
+
callback: (warning: import('postcss').Warning) => void
|
|
83
|
+
) => void;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
type LintResult = import('stylelint').LintResult;
|
|
87
|
+
type AsyncTask = () => Promise<void>;
|
|
88
|
+
type LintTask = (files: string | string[]) => Promise<LintResult[]>;
|
|
89
|
+
type Worker = import('jest-worker').Worker & {
|
|
90
|
+
lintFiles: LintTask;
|
|
91
|
+
};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type Compiler = import('webpack').Compiler;
|
|
3
|
-
export type Module = import('webpack').Module;
|
|
4
|
-
export type Options = import('./options').Options;
|
|
5
|
-
export type FileSystemInfoEntry = Partial<
|
|
6
|
-
| {
|
|
7
|
-
timestamp: number;
|
|
8
|
-
}
|
|
9
|
-
| number
|
|
10
|
-
>;
|
|
1
|
+
export = StylelintWebpackPlugin;
|
|
11
2
|
declare class StylelintWebpackPlugin {
|
|
12
3
|
/**
|
|
13
4
|
* @param {Options} options
|
|
@@ -33,3 +24,15 @@ declare class StylelintWebpackPlugin {
|
|
|
33
24
|
*/
|
|
34
25
|
getContext(compiler: Compiler): string;
|
|
35
26
|
}
|
|
27
|
+
declare namespace StylelintWebpackPlugin {
|
|
28
|
+
export { Compiler, Module, Options, FileSystemInfoEntry };
|
|
29
|
+
}
|
|
30
|
+
type Compiler = import('webpack').Compiler;
|
|
31
|
+
type Options = import('./options').Options;
|
|
32
|
+
type Module = import('webpack').Module;
|
|
33
|
+
type FileSystemInfoEntry = Partial<
|
|
34
|
+
| {
|
|
35
|
+
timestamp: number;
|
|
36
|
+
}
|
|
37
|
+
| number
|
|
38
|
+
>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export = linter;
|
|
3
|
+
/**
|
|
4
|
+
* @param {string|undefined} key
|
|
5
|
+
* @param {Options} options
|
|
6
|
+
* @param {Compilation} compilation
|
|
7
|
+
* @returns {{api: InternalApi, lint: Linter, report: Reporter, threads: number}}
|
|
8
|
+
*/
|
|
9
|
+
declare function linter(
|
|
10
|
+
key: string | undefined,
|
|
11
|
+
options: Options,
|
|
12
|
+
compilation: Compilation
|
|
13
|
+
): {
|
|
14
|
+
api: InternalApi;
|
|
15
|
+
lint: Linter;
|
|
16
|
+
report: Reporter;
|
|
17
|
+
threads: number;
|
|
18
|
+
};
|
|
19
|
+
declare namespace linter {
|
|
20
|
+
export {
|
|
21
|
+
Stylelint,
|
|
22
|
+
LintResult,
|
|
23
|
+
InternalApi,
|
|
24
|
+
Compiler,
|
|
25
|
+
Compilation,
|
|
26
|
+
Options,
|
|
27
|
+
FormatterType,
|
|
28
|
+
FormatterFunction,
|
|
29
|
+
GenerateReport,
|
|
30
|
+
Report,
|
|
31
|
+
Reporter,
|
|
32
|
+
Linter,
|
|
33
|
+
LintResultMap,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
type Options = import('./options').Options;
|
|
37
|
+
type Compilation = import('webpack').Compilation;
|
|
38
|
+
type InternalApi = import('stylelint').InternalApi;
|
|
39
|
+
type Linter = (files: string | string[]) => void;
|
|
40
|
+
type Reporter = () => Promise<Report>;
|
|
41
|
+
type Stylelint = import('postcss').PluginCreator<
|
|
42
|
+
import('stylelint').PostcssPluginOptions
|
|
43
|
+
> & {
|
|
44
|
+
lint: (
|
|
45
|
+
options: import('stylelint').LinterOptions
|
|
46
|
+
) => Promise<import('stylelint').LinterResult>;
|
|
47
|
+
rules: {
|
|
48
|
+
[k: string]: import('stylelint').Rule<any, any>;
|
|
49
|
+
};
|
|
50
|
+
formatters: {
|
|
51
|
+
[k: string]: import('stylelint').Formatter;
|
|
52
|
+
};
|
|
53
|
+
createPlugin: (
|
|
54
|
+
ruleName: string,
|
|
55
|
+
plugin: import('stylelint').Plugin<any, any>
|
|
56
|
+
) => {
|
|
57
|
+
ruleName: string;
|
|
58
|
+
rule: import('stylelint').Rule<any, any>;
|
|
59
|
+
};
|
|
60
|
+
createLinter: (
|
|
61
|
+
options: import('stylelint').LinterOptions
|
|
62
|
+
) => import('stylelint').InternalApi;
|
|
63
|
+
resolveConfig: (
|
|
64
|
+
filePath: string,
|
|
65
|
+
options?:
|
|
66
|
+
| Pick<
|
|
67
|
+
import('stylelint').LinterOptions,
|
|
68
|
+
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
69
|
+
>
|
|
70
|
+
| undefined
|
|
71
|
+
) => Promise<import('stylelint').Config | undefined>;
|
|
72
|
+
utils: {
|
|
73
|
+
report: (problem: import('stylelint').Problem) => void;
|
|
74
|
+
ruleMessages: <
|
|
75
|
+
T extends import('stylelint').RuleMessages,
|
|
76
|
+
R extends { [K in keyof T]: T[K] }
|
|
77
|
+
>(
|
|
78
|
+
ruleName: string,
|
|
79
|
+
messages: T
|
|
80
|
+
) => R;
|
|
81
|
+
validateOptions: (
|
|
82
|
+
result: import('stylelint').PostcssResult,
|
|
83
|
+
ruleName: string,
|
|
84
|
+
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
85
|
+
) => boolean;
|
|
86
|
+
checkAgainstRule: <T_1, O extends Object>(
|
|
87
|
+
options: {
|
|
88
|
+
ruleName: string;
|
|
89
|
+
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
90
|
+
root: import('postcss').Root;
|
|
91
|
+
},
|
|
92
|
+
callback: (warning: import('postcss').Warning) => void
|
|
93
|
+
) => void;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
type LintResult = import('stylelint').LintResult;
|
|
97
|
+
type Compiler = import('webpack').Compiler;
|
|
98
|
+
type FormatterType = import('./options').FormatterType;
|
|
99
|
+
type FormatterFunction = (results: LintResult[]) => string;
|
|
100
|
+
type GenerateReport = (compilation: Compilation) => Promise<void>;
|
|
101
|
+
type Report = {
|
|
102
|
+
errors?: StylelintError;
|
|
103
|
+
warnings?: StylelintError;
|
|
104
|
+
generateReportAsset?: GenerateReport;
|
|
105
|
+
};
|
|
106
|
+
type LintResultMap = {
|
|
107
|
+
[files: string]: import('stylelint').LintResult;
|
|
108
|
+
};
|
|
109
|
+
import StylelintError = require('./StylelintError');
|
|
@@ -1,3 +1,82 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export type stylelint = import('postcss').PluginCreator<
|
|
3
|
+
import('stylelint').PostcssPluginOptions
|
|
4
|
+
> & {
|
|
5
|
+
lint: (
|
|
6
|
+
options: import('stylelint').LinterOptions
|
|
7
|
+
) => Promise<import('stylelint').LinterResult>;
|
|
8
|
+
rules: {
|
|
9
|
+
[k: string]: import('stylelint').Rule<any, any>;
|
|
10
|
+
};
|
|
11
|
+
formatters: {
|
|
12
|
+
[k: string]: import('stylelint').Formatter;
|
|
13
|
+
};
|
|
14
|
+
createPlugin: (
|
|
15
|
+
ruleName: string,
|
|
16
|
+
plugin: import('stylelint').Plugin<any, any>
|
|
17
|
+
) => {
|
|
18
|
+
ruleName: string;
|
|
19
|
+
rule: import('stylelint').Rule<any, any>;
|
|
20
|
+
};
|
|
21
|
+
createLinter: (
|
|
22
|
+
options: import('stylelint').LinterOptions
|
|
23
|
+
) => import('stylelint').InternalApi;
|
|
24
|
+
resolveConfig: (
|
|
25
|
+
filePath: string,
|
|
26
|
+
options?:
|
|
27
|
+
| Pick<
|
|
28
|
+
import('stylelint').LinterOptions,
|
|
29
|
+
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
30
|
+
>
|
|
31
|
+
| undefined
|
|
32
|
+
) => Promise<import('stylelint').Config | undefined>;
|
|
33
|
+
utils: {
|
|
34
|
+
report: (problem: import('stylelint').Problem) => void;
|
|
35
|
+
ruleMessages: <
|
|
36
|
+
T extends import('stylelint').RuleMessages,
|
|
37
|
+
R extends { [K in keyof T]: T[K] }
|
|
38
|
+
>(
|
|
39
|
+
ruleName: string,
|
|
40
|
+
messages: T
|
|
41
|
+
) => R;
|
|
42
|
+
validateOptions: (
|
|
43
|
+
result: import('stylelint').PostcssResult,
|
|
44
|
+
ruleName: string,
|
|
45
|
+
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
46
|
+
) => boolean;
|
|
47
|
+
checkAgainstRule: <T_1, O extends Object>(
|
|
48
|
+
options: {
|
|
49
|
+
ruleName: string;
|
|
50
|
+
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
51
|
+
root: import('postcss').Root;
|
|
52
|
+
},
|
|
53
|
+
callback: (warning: import('postcss').Warning) => void
|
|
54
|
+
) => void;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
58
|
+
export type FormatterType = import('stylelint').FormatterType;
|
|
59
|
+
export type OutputReport = {
|
|
60
|
+
filePath?: string | undefined;
|
|
61
|
+
formatter?: FormatterType | undefined;
|
|
62
|
+
};
|
|
63
|
+
export type PluginOptions = {
|
|
64
|
+
context: string;
|
|
65
|
+
emitError: boolean;
|
|
66
|
+
emitWarning: boolean;
|
|
67
|
+
exclude?: (string | string[]) | undefined;
|
|
68
|
+
extensions: string | string[];
|
|
69
|
+
failOnError: boolean;
|
|
70
|
+
failOnWarning: boolean;
|
|
71
|
+
files: string | string[];
|
|
72
|
+
formatter: FormatterType;
|
|
73
|
+
lintDirtyModulesOnly: boolean;
|
|
74
|
+
quiet: boolean;
|
|
75
|
+
stylelintPath: string;
|
|
76
|
+
outputReport: OutputReport;
|
|
77
|
+
threads?: (number | boolean) | undefined;
|
|
78
|
+
};
|
|
79
|
+
export type Options = Partial<PluginOptions & StylelintOptions>;
|
|
1
80
|
/** @typedef {import("stylelint")} stylelint */
|
|
2
81
|
/** @typedef {import("stylelint").LinterOptions} StylelintOptions */
|
|
3
82
|
/** @typedef {import("stylelint").FormatterType} FormatterType */
|
|
@@ -36,27 +115,3 @@ export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
|
|
|
36
115
|
export function getStylelintOptions(
|
|
37
116
|
pluginOptions: Options
|
|
38
117
|
): Partial<StylelintOptions>;
|
|
39
|
-
export type stylelint = typeof import('stylelint');
|
|
40
|
-
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
41
|
-
export type FormatterType = import('stylelint').FormatterType;
|
|
42
|
-
export type OutputReport = {
|
|
43
|
-
filePath?: string | undefined;
|
|
44
|
-
formatter?: FormatterType | undefined;
|
|
45
|
-
};
|
|
46
|
-
export type PluginOptions = {
|
|
47
|
-
context: string;
|
|
48
|
-
emitError: boolean;
|
|
49
|
-
emitWarning: boolean;
|
|
50
|
-
exclude?: (string | string[]) | undefined;
|
|
51
|
-
extensions: string | string[];
|
|
52
|
-
failOnError: boolean;
|
|
53
|
-
failOnWarning: boolean;
|
|
54
|
-
files: string | string[];
|
|
55
|
-
formatter: FormatterType;
|
|
56
|
-
lintDirtyModulesOnly: boolean;
|
|
57
|
-
quiet: boolean;
|
|
58
|
-
stylelintPath: string;
|
|
59
|
-
outputReport: OutputReport;
|
|
60
|
-
threads?: (number | boolean) | undefined;
|
|
61
|
-
};
|
|
62
|
-
export type Options = Partial<PluginOptions & StylelintOptions>;
|
|
@@ -39,4 +39,9 @@ export function parseFoldersToGlobs(
|
|
|
39
39
|
patterns: string | string[],
|
|
40
40
|
extensions?: string | string[]
|
|
41
41
|
): string[];
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {string} _ key, but unused
|
|
45
|
+
* @param {any} value
|
|
46
|
+
*/
|
|
42
47
|
export function jsonStringifyReplacerSortKeys(_: string, value: any): any;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export type Stylelint = import('postcss').PluginCreator<
|
|
3
|
+
import('stylelint').PostcssPluginOptions
|
|
4
|
+
> & {
|
|
5
|
+
lint: (
|
|
6
|
+
options: import('stylelint').LinterOptions
|
|
7
|
+
) => Promise<import('stylelint').LinterResult>;
|
|
8
|
+
rules: {
|
|
9
|
+
[k: string]: import('stylelint').Rule<any, any>;
|
|
10
|
+
};
|
|
11
|
+
formatters: {
|
|
12
|
+
[k: string]: import('stylelint').Formatter;
|
|
13
|
+
};
|
|
14
|
+
createPlugin: (
|
|
15
|
+
ruleName: string,
|
|
16
|
+
plugin: import('stylelint').Plugin<any, any>
|
|
17
|
+
) => {
|
|
18
|
+
ruleName: string;
|
|
19
|
+
rule: import('stylelint').Rule<any, any>;
|
|
20
|
+
};
|
|
21
|
+
createLinter: (
|
|
22
|
+
options: import('stylelint').LinterOptions
|
|
23
|
+
) => import('stylelint').InternalApi;
|
|
24
|
+
resolveConfig: (
|
|
25
|
+
filePath: string,
|
|
26
|
+
options?:
|
|
27
|
+
| Pick<
|
|
28
|
+
import('stylelint').LinterOptions,
|
|
29
|
+
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
30
|
+
>
|
|
31
|
+
| undefined
|
|
32
|
+
) => Promise<import('stylelint').Config | undefined>;
|
|
33
|
+
utils: {
|
|
34
|
+
report: (problem: import('stylelint').Problem) => void;
|
|
35
|
+
ruleMessages: <
|
|
36
|
+
T extends import('stylelint').RuleMessages,
|
|
37
|
+
R extends { [K in keyof T]: T[K] }
|
|
38
|
+
>(
|
|
39
|
+
ruleName: string,
|
|
40
|
+
messages: T
|
|
41
|
+
) => R;
|
|
42
|
+
validateOptions: (
|
|
43
|
+
result: import('stylelint').PostcssResult,
|
|
44
|
+
ruleName: string,
|
|
45
|
+
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
46
|
+
) => boolean;
|
|
47
|
+
checkAgainstRule: <T_1, O extends Object>(
|
|
48
|
+
options: {
|
|
49
|
+
ruleName: string;
|
|
50
|
+
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
51
|
+
root: import('postcss').Root;
|
|
52
|
+
},
|
|
53
|
+
callback: (warning: import('postcss').Warning) => void
|
|
54
|
+
) => void;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
58
|
+
export type Options = import('./options').Options;
|
package/declarations/cjs.d.ts
DELETED