@huangjunsen/encode-fe-lint 1.0.6 → 1.0.8

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.
Files changed (77) hide show
  1. package/lib/actions/init.d.ts +3 -3
  2. package/lib/actions/init.js +168 -223
  3. package/lib/actions/scan.d.ts +3 -3
  4. package/lib/actions/scan.js +63 -137
  5. package/lib/actions/update.d.ts +2 -2
  6. package/lib/actions/update.js +51 -112
  7. package/lib/cli.d.ts +2 -2
  8. package/lib/cli.js +152 -230
  9. package/lib/config/_editorconfig.ejs +13 -13
  10. package/lib/config/_eslintignore.ejs +9 -9
  11. package/lib/config/_eslintrc.js.ejs +21 -3
  12. package/lib/config/_markdownlint.json.ejs +1 -1
  13. package/lib/config/_markdownlintignore.ejs +5 -5
  14. package/lib/config/_prettierrc.js.ejs +3 -8
  15. package/lib/config/_stylelintignore.ejs +5 -5
  16. package/lib/config/_stylelintrc.js.ejs +5 -5
  17. package/lib/config/_vscode/extensions.json.ejs +7 -7
  18. package/lib/config/_vscode/settings.json.ejs +55 -54
  19. package/lib/config/commitlint.config.js.ejs +3 -3
  20. package/lib/config/encode-fe-lint.config.js.ejs +6 -6
  21. package/lib/config/eslint.config.mjs.ejs +5 -0
  22. package/lib/index.d.ts +5 -5
  23. package/lib/index.js +36 -93
  24. package/lib/lints/eslint/doEslint.d.ts +6 -6
  25. package/lib/lints/eslint/doEslint.js +44 -80
  26. package/lib/lints/eslint/formatESLintResults.d.ts +3 -3
  27. package/lib/lints/eslint/formatESLintResults.js +28 -39
  28. package/lib/lints/eslint/getESLintConfig.d.ts +3 -3
  29. package/lib/lints/eslint/getESLintConfig.js +43 -67
  30. package/lib/lints/eslint/getESLintConfigType.d.ts +2 -2
  31. package/lib/lints/eslint/getESLintConfigType.js +23 -26
  32. package/lib/lints/eslint/index.d.ts +3 -3
  33. package/lib/lints/eslint/index.js +19 -19
  34. package/lib/lints/index.d.ts +4 -4
  35. package/lib/lints/index.js +20 -20
  36. package/lib/lints/markdownlint/doMarkdownlint.d.ts +6 -6
  37. package/lib/lints/markdownlint/doMarkdownlint.js +52 -119
  38. package/lib/lints/markdownlint/formatMarkdownlintResults.d.ts +3 -3
  39. package/lib/lints/markdownlint/formatMarkdownlintResults.js +35 -39
  40. package/lib/lints/markdownlint/getMarkdownlintConfig.d.ts +7 -7
  41. package/lib/lints/markdownlint/getMarkdownlintConfig.js +31 -31
  42. package/lib/lints/markdownlint/index.d.ts +3 -3
  43. package/lib/lints/markdownlint/index.js +19 -19
  44. package/lib/lints/prettier/doPrettier.d.ts +4 -4
  45. package/lib/lints/prettier/doPrettier.js +32 -106
  46. package/lib/lints/prettier/index.d.ts +1 -1
  47. package/lib/lints/prettier/index.js +17 -17
  48. package/lib/lints/stylelint/doStylelint.d.ts +5 -5
  49. package/lib/lints/stylelint/doStylelint.js +31 -86
  50. package/lib/lints/stylelint/formatStylelintResults.d.ts +3 -3
  51. package/lib/lints/stylelint/formatStylelintResults.js +38 -39
  52. package/lib/lints/stylelint/getStylelintConfig.d.ts +3 -3
  53. package/lib/lints/stylelint/getStylelintConfig.js +37 -36
  54. package/lib/lints/stylelint/getStylelintDocUrl.d.ts +1 -1
  55. package/lib/lints/stylelint/getStylelintDocUrl.js +13 -13
  56. package/lib/lints/stylelint/index.d.ts +3 -3
  57. package/lib/lints/stylelint/index.js +19 -19
  58. package/lib/types/index.d.ts +73 -73
  59. package/lib/types/index.js +2 -2
  60. package/lib/utils/conflict-resolve.d.ts +3 -3
  61. package/lib/utils/conflict-resolve.js +95 -175
  62. package/lib/utils/constants.d.ts +18 -18
  63. package/lib/utils/constants.js +104 -133
  64. package/lib/utils/generate-template.d.ts +2 -2
  65. package/lib/utils/generate-template.js +53 -99
  66. package/lib/utils/git.d.ts +3 -3
  67. package/lib/utils/git.js +44 -105
  68. package/lib/utils/log.d.ts +8 -8
  69. package/lib/utils/log.js +25 -25
  70. package/lib/utils/npm-type.d.ts +2 -2
  71. package/lib/utils/npm-type.js +10 -10
  72. package/lib/utils/print-report.d.ts +3 -3
  73. package/lib/utils/print-report.js +86 -109
  74. package/package.json +18 -14
  75. package/LICENSE +0 -21
  76. package/lib/utils/update.d.ts +0 -2
  77. package/lib/utils/update.js +0 -112
@@ -1,19 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./getMarkdownlintConfig"), exports);
18
- __exportStar(require("./formatMarkdownlintResults"), exports);
19
- __exportStar(require("./doMarkdownlint"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getMarkdownlintConfig"), exports);
18
+ __exportStar(require("./formatMarkdownlintResults"), exports);
19
+ __exportStar(require("./doMarkdownlint"), exports);
@@ -1,4 +1,4 @@
1
- import { ScanOptions } from '../../types';
2
- export interface DoPrettierOptions extends ScanOptions {
3
- }
4
- export declare function doPrettier(options: DoPrettierOptions): Promise<void>;
1
+ import { ScanOptions } from '../../types';
2
+ export interface DoPrettierOptions extends ScanOptions {
3
+ }
4
+ export declare function doPrettier(options: DoPrettierOptions): Promise<void>;
@@ -1,106 +1,32 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.doPrettier = void 0;
54
- var fast_glob_1 = __importDefault(require("fast-glob"));
55
- var fs_extra_1 = require("fs-extra");
56
- var path_1 = require("path");
57
- var prettier_1 = __importDefault(require("prettier"));
58
- var constants_1 = require("../../utils/constants");
59
- function doPrettier(options) {
60
- return __awaiter(this, void 0, void 0, function () {
61
- var files, pattern;
62
- return __generator(this, function (_a) {
63
- switch (_a.label) {
64
- case 0:
65
- files = [];
66
- if (!options.files) return [3, 1];
67
- files = options.files.filter(function (name) { return constants_1.PRETTIER_FILE_EXT.includes((0, path_1.extname)(name)); });
68
- return [3, 3];
69
- case 1:
70
- pattern = (0, path_1.join)(options.include, "**/*.{".concat(constants_1.PRETTIER_FILE_EXT.map(function (t) { return t.replace(/^\./, ''); }).join(','), "}"));
71
- return [4, (0, fast_glob_1.default)(pattern, {
72
- cwd: options.cwd,
73
- ignore: constants_1.PRETTIER_IGNORE_PATTERN,
74
- })];
75
- case 2:
76
- files = _a.sent();
77
- _a.label = 3;
78
- case 3: return [4, Promise.all(files.map(formatFile))];
79
- case 4:
80
- _a.sent();
81
- return [2];
82
- }
83
- });
84
- });
85
- }
86
- exports.doPrettier = doPrettier;
87
- function formatFile(filepath) {
88
- return __awaiter(this, void 0, void 0, function () {
89
- var text, options, formatted;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0: return [4, (0, fs_extra_1.readFile)(filepath, 'utf8')];
93
- case 1:
94
- text = _a.sent();
95
- return [4, prettier_1.default.resolveConfig(filepath)];
96
- case 2:
97
- options = _a.sent();
98
- formatted = prettier_1.default.format(text, __assign(__assign({}, options), { filepath: filepath }));
99
- return [4, (0, fs_extra_1.writeFile)(filepath, formatted, 'utf8')];
100
- case 3:
101
- _a.sent();
102
- return [2];
103
- }
104
- });
105
- });
106
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.doPrettier = void 0;
7
+ const fast_glob_1 = __importDefault(require("fast-glob"));
8
+ const fs_extra_1 = require("fs-extra");
9
+ const path_1 = require("path");
10
+ const prettier_1 = __importDefault(require("prettier"));
11
+ const constants_1 = require("../../utils/constants");
12
+ async function doPrettier(options) {
13
+ let files = [];
14
+ if (options.files) {
15
+ files = options.files.filter((name) => constants_1.PRETTIER_FILE_EXT.includes((0, path_1.extname)(name)));
16
+ }
17
+ else {
18
+ const pattern = (0, path_1.join)(options.include, `**/*.{${constants_1.PRETTIER_FILE_EXT.map((t) => t.replace(/^\./, '')).join(',')}}`);
19
+ files = await (0, fast_glob_1.default)(pattern, {
20
+ cwd: options.cwd,
21
+ ignore: constants_1.PRETTIER_IGNORE_PATTERN,
22
+ });
23
+ }
24
+ await Promise.all(files.map(formatFile));
25
+ }
26
+ exports.doPrettier = doPrettier;
27
+ async function formatFile(filepath) {
28
+ const text = await (0, fs_extra_1.readFile)(filepath, 'utf8');
29
+ const options = await prettier_1.default.resolveConfig(filepath);
30
+ const formatted = await prettier_1.default.format(text, { ...options, filepath });
31
+ await (0, fs_extra_1.writeFile)(filepath, formatted, 'utf8');
32
+ }
@@ -1 +1 @@
1
- export * from './doPrettier';
1
+ export * from './doPrettier';
@@ -1,17 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./doPrettier"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./doPrettier"), exports);
@@ -1,5 +1,5 @@
1
- import { PKG, ScanOptions } from '../../types';
2
- export interface DoStylelintOptions extends ScanOptions {
3
- pkg: PKG;
4
- }
5
- export declare function doStylelint(options: DoStylelintOptions): Promise<import("../../types").ScanResult[]>;
1
+ import { PKG, ScanOptions } from '../../types';
2
+ export interface DoStylelintOptions extends ScanOptions {
3
+ pkg: PKG;
4
+ }
5
+ export declare function doStylelint(options: DoStylelintOptions): Promise<import("../../types").ScanResult[]>;
@@ -1,86 +1,31 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.doStylelint = void 0;
54
- var fast_glob_1 = __importDefault(require("fast-glob"));
55
- var path_1 = require("path");
56
- var stylelint_1 = __importDefault(require("stylelint"));
57
- var constants_1 = require("../../utils/constants");
58
- var formatStylelintResults_1 = require("./formatStylelintResults");
59
- var getStylelintConfig_1 = require("./getStylelintConfig");
60
- function doStylelint(options) {
61
- return __awaiter(this, void 0, void 0, function () {
62
- var files, pattern, data;
63
- return __generator(this, function (_a) {
64
- switch (_a.label) {
65
- case 0:
66
- if (!options.files) return [3, 1];
67
- files = options.files.filter(function (name) { return constants_1.STYLELINT_FILE_EXT.includes((0, path_1.extname)(name)); });
68
- return [3, 3];
69
- case 1:
70
- pattern = (0, path_1.join)(options.include, "**/*.{".concat(constants_1.STYLELINT_FILE_EXT.map(function (t) { return t.replace(/^\./, ''); }).join(','), "}"));
71
- return [4, (0, fast_glob_1.default)(pattern, {
72
- cwd: options.cwd,
73
- ignore: constants_1.STYLELINT_IGNORE_PATTERN,
74
- })];
75
- case 2:
76
- files = _a.sent();
77
- _a.label = 3;
78
- case 3: return [4, stylelint_1.default.lint(__assign(__assign({}, (0, getStylelintConfig_1.getStylelintConfig)(options, options.pkg, options.config)), { files: files }))];
79
- case 4:
80
- data = _a.sent();
81
- return [2, (0, formatStylelintResults_1.formatStylelintResults)(data.results, options.quiet)];
82
- }
83
- });
84
- });
85
- }
86
- exports.doStylelint = doStylelint;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.doStylelint = void 0;
7
+ const fast_glob_1 = __importDefault(require("fast-glob"));
8
+ const path_1 = require("path");
9
+ const stylelint_1 = __importDefault(require("stylelint"));
10
+ const constants_1 = require("../../utils/constants");
11
+ const formatStylelintResults_1 = require("./formatStylelintResults");
12
+ const getStylelintConfig_1 = require("./getStylelintConfig");
13
+ async function doStylelint(options) {
14
+ let files;
15
+ if (options.files) {
16
+ files = options.files.filter((name) => constants_1.STYLELINT_FILE_EXT.includes((0, path_1.extname)(name)));
17
+ }
18
+ else {
19
+ const pattern = (0, path_1.join)(options.include, `**/*.{${constants_1.STYLELINT_FILE_EXT.map((t) => t.replace(/^\./, '')).join(',')}}`);
20
+ files = await (0, fast_glob_1.default)(pattern, {
21
+ cwd: options.cwd,
22
+ ignore: constants_1.STYLELINT_IGNORE_PATTERN,
23
+ });
24
+ }
25
+ const data = await stylelint_1.default.lint({
26
+ ...(0, getStylelintConfig_1.getStylelintConfig)(options, options.pkg, options.config),
27
+ files,
28
+ });
29
+ return (0, formatStylelintResults_1.formatStylelintResults)(data.results, options.quiet);
30
+ }
31
+ exports.doStylelint = doStylelint;
@@ -1,3 +1,3 @@
1
- import { LintResult } from 'stylelint';
2
- import type { ScanResult } from '../../types';
3
- export declare function formatStylelintResults(results: LintResult[], quiet: boolean): ScanResult[];
1
+ import { LintResult } from 'stylelint';
2
+ import type { ScanResult } from '../../types';
3
+ export declare function formatStylelintResults(results: LintResult[], quiet: boolean): ScanResult[];
@@ -1,39 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatStylelintResults = void 0;
4
- var getStylelintDocUrl_1 = require("./getStylelintDocUrl");
5
- function formatStylelintResults(results, quiet) {
6
- return results.map(function (_a) {
7
- var source = _a.source, warnings = _a.warnings;
8
- var errorCount = 0;
9
- var warningCount = 0;
10
- var messages = warnings
11
- .filter(function (item) { return !quiet || item.severity === 'error'; })
12
- .map(function (item) {
13
- var _a = item.line, line = _a === void 0 ? 0 : _a, _b = item.column, column = _b === void 0 ? 0 : _b, rule = item.rule, severity = item.severity, text = item.text;
14
- if (severity === 'error') {
15
- errorCount++;
16
- }
17
- else {
18
- warningCount++;
19
- }
20
- return {
21
- line: line,
22
- column: column,
23
- rule: rule,
24
- url: (0, getStylelintDocUrl_1.getStylelintRuleDocUrl)(rule),
25
- message: text.replace(/([^ ])\.$/u, '$1').replace(new RegExp("\\(".concat(rule, "\\)")), ''),
26
- errored: severity === 'error',
27
- };
28
- });
29
- return {
30
- filePath: source,
31
- messages: messages,
32
- errorCount: errorCount,
33
- warningCount: warningCount,
34
- fixableErrorCount: 0,
35
- fixableWarningCount: 0,
36
- };
37
- });
38
- }
39
- exports.formatStylelintResults = formatStylelintResults;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatStylelintResults = void 0;
4
+ const getStylelintDocUrl_1 = require("./getStylelintDocUrl");
5
+ function formatStylelintResults(results, quiet) {
6
+ return results.map(({ source, warnings }) => {
7
+ let errorCount = 0;
8
+ let warningCount = 0;
9
+ const messages = warnings
10
+ .filter((item) => !quiet || item.severity === 'error')
11
+ .map((item) => {
12
+ const { line = 0, column = 0, rule, severity, text } = item;
13
+ if (severity === 'error') {
14
+ errorCount++;
15
+ }
16
+ else {
17
+ warningCount++;
18
+ }
19
+ return {
20
+ line,
21
+ column,
22
+ rule,
23
+ url: (0, getStylelintDocUrl_1.getStylelintRuleDocUrl)(rule),
24
+ message: text.replace(/([^ ])\.$/u, '$1').replace(new RegExp(`\\(${rule}\\)`), ''),
25
+ errored: severity === 'error',
26
+ };
27
+ });
28
+ return {
29
+ filePath: source,
30
+ messages,
31
+ errorCount,
32
+ warningCount,
33
+ fixableErrorCount: 0,
34
+ fixableWarningCount: 0,
35
+ };
36
+ });
37
+ }
38
+ exports.formatStylelintResults = formatStylelintResults;
@@ -1,3 +1,3 @@
1
- import { LinterOptions } from 'stylelint';
2
- import type { Config, PKG, ScanOptions } from '../../types';
3
- export declare function getStylelintConfig(opts: ScanOptions, pkg: PKG, config: Config): LinterOptions;
1
+ import { LinterOptions } from 'stylelint';
2
+ import type { Config, PKG, ScanOptions } from '../../types';
3
+ export declare function getStylelintConfig(opts: ScanOptions, pkg: PKG, config: Config): LinterOptions;
@@ -1,36 +1,37 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getStylelintConfig = void 0;
7
- var fs_extra_1 = __importDefault(require("fs-extra"));
8
- var glob_1 = __importDefault(require("glob"));
9
- var path_1 = __importDefault(require("path"));
10
- var constants_1 = require("../../utils/constants");
11
- function getStylelintConfig(opts, pkg, config) {
12
- var cwd = opts.cwd, fix = opts.fix;
13
- if (config.enableStylelint === false)
14
- return {};
15
- var lintConfig = {
16
- fix: Boolean(fix),
17
- allowEmptyInput: true,
18
- };
19
- if (config.stylelintOptions) {
20
- Object.assign(lintConfig, config.stylelintOptions);
21
- }
22
- else {
23
- var lintConfigFiles = glob_1.default.sync('.stylelintrc?(.@(js|yaml|yml|json))', { cwd: cwd });
24
- if (lintConfigFiles.length === 0 && !pkg.stylelint) {
25
- lintConfig.config = {
26
- extends: '@huangjunsen/stylelint-config',
27
- };
28
- }
29
- var ignoreFilePath = path_1.default.resolve(cwd, '.stylelintignore');
30
- if (!fs_extra_1.default.existsSync(ignoreFilePath)) {
31
- lintConfig.ignorePattern = constants_1.STYLELINT_IGNORE_PATTERN;
32
- }
33
- }
34
- return lintConfig;
35
- }
36
- exports.getStylelintConfig = getStylelintConfig;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getStylelintConfig = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const glob_1 = __importDefault(require("glob"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const constants_1 = require("../../utils/constants");
11
+ function getStylelintConfig(opts, pkg, config) {
12
+ const { cwd, fix } = opts;
13
+ if (config.enableStylelint === false)
14
+ return {};
15
+ const lintConfig = {
16
+ fix: Boolean(fix),
17
+ allowEmptyInput: true,
18
+ configBasedir: cwd,
19
+ };
20
+ if (config.stylelintOptions) {
21
+ Object.assign(lintConfig, config.stylelintOptions);
22
+ }
23
+ else {
24
+ const lintConfigFiles = glob_1.default.sync('.stylelintrc?(.@(js|yaml|yml|json))', { cwd });
25
+ if (lintConfigFiles.length === 0 && !pkg.stylelint) {
26
+ lintConfig.config = {
27
+ extends: '@huangjunsen/stylelint-config',
28
+ };
29
+ }
30
+ const ignoreFilePath = path_1.default.resolve(cwd, '.stylelintignore');
31
+ if (!fs_extra_1.default.existsSync(ignoreFilePath)) {
32
+ lintConfig.ignorePattern = constants_1.STYLELINT_IGNORE_PATTERN;
33
+ }
34
+ }
35
+ return lintConfig;
36
+ }
37
+ exports.getStylelintConfig = getStylelintConfig;
@@ -1 +1 @@
1
- export declare function getStylelintRuleDocUrl(rule: string): string;
1
+ export declare function getStylelintRuleDocUrl(rule: string): string;
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStylelintRuleDocUrl = void 0;
4
- function getStylelintRuleDocUrl(rule) {
5
- var match = rule.match(/^@scss\/(\S+)$/);
6
- if (match) {
7
- return "https://github.com/kristerkari/stylelint-scss/tree/master/src/rules/".concat(match[1]);
8
- }
9
- if (rule !== 'CssSyntaxError')
10
- return "https://stylelint.io/user-guide/rules/list/".concat(rule);
11
- return '';
12
- }
13
- exports.getStylelintRuleDocUrl = getStylelintRuleDocUrl;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStylelintRuleDocUrl = void 0;
4
+ function getStylelintRuleDocUrl(rule) {
5
+ const match = rule.match(/^@scss\/(\S+)$/);
6
+ if (match) {
7
+ return `https://github.com/kristerkari/stylelint-scss/tree/master/src/rules/${match[1]}`;
8
+ }
9
+ if (rule !== 'CssSyntaxError')
10
+ return `https://stylelint.io/user-guide/rules/list/${rule}`;
11
+ return '';
12
+ }
13
+ exports.getStylelintRuleDocUrl = getStylelintRuleDocUrl;
@@ -1,3 +1,3 @@
1
- export * from './getStylelintConfig';
2
- export * from './formatStylelintResults';
3
- export * from './doStylelint';
1
+ export * from './getStylelintConfig';
2
+ export * from './formatStylelintResults';
3
+ export * from './doStylelint';
@@ -1,19 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./getStylelintConfig"), exports);
18
- __exportStar(require("./formatStylelintResults"), exports);
19
- __exportStar(require("./doStylelint"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getStylelintConfig"), exports);
18
+ __exportStar(require("./formatStylelintResults"), exports);
19
+ __exportStar(require("./doStylelint"), exports);