sku 12.0.2 → 12.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # sku
2
2
 
3
+ ## 12.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Bump `eslint-config-seek` to `11.2.0` ([#830](https://github.com/seek-oss/sku/pull/830))
8
+
9
+ ## 12.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix ESLint warning and error reporting ([#826](https://github.com/seek-oss/sku/pull/826))
14
+
3
15
  ## 12.0.2
4
16
 
5
17
  ### Patch Changes
package/lib/runESLint.js CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  const { yellow, cyan, gray } = require('chalk');
2
3
  const { ESLint } = require('eslint');
3
4
  const eslintConfig = require('../config/eslint/eslintConfig');
@@ -6,7 +7,7 @@ const { lintExtensions } = require('./lint');
6
7
  const extensions = lintExtensions.map((ext) => `.${ext}`);
7
8
 
8
9
  /**
9
- * @param {{ fix?: boolean, paths?: string[] }}
10
+ * @param {{ fix?: boolean, paths?: string[] }} options
10
11
  */
11
12
  const runESLint = async ({ fix = false, paths }) => {
12
13
  console.log(cyan(`${fix ? 'Fixing' : 'Checking'} code with ESLint`));
@@ -30,16 +31,24 @@ const runESLint = async ({ fix = false, paths }) => {
30
31
  } else {
31
32
  console.log(gray(`Paths: ${filteredFilePaths.join(' ')}`));
32
33
  try {
33
- const report = await eslint.lintFiles(filteredFilePaths);
34
+ const lintResults = await eslint.lintFiles(filteredFilePaths);
34
35
 
35
36
  if (fix) {
36
- ESLint.outputFixes(report);
37
+ ESLint.outputFixes(lintResults);
37
38
  } else {
38
- const { errorCount, warningCount, results } = report;
39
+ const { warningCount, errorCount } = lintResults.reduce(
40
+ (acc, result) => {
41
+ return {
42
+ warningCount: acc.warningCount + result.warningCount,
43
+ errorCount: acc.errorCount + result.errorCount,
44
+ };
45
+ },
46
+ { warningCount: 0, errorCount: 0 },
47
+ );
39
48
 
40
49
  if (errorCount || warningCount) {
41
50
  const formatter = await eslint.loadFormatter();
42
- console.log(formatter(results));
51
+ console.log(await formatter.format(lintResults));
43
52
  }
44
53
 
45
54
  if (errorCount > 0) {
@@ -57,6 +66,8 @@ const runESLint = async ({ fix = false, paths }) => {
57
66
  };
58
67
 
59
68
  module.exports = {
69
+ /** @param {string[] | undefined} paths */
60
70
  check: (paths) => runESLint({ paths }),
71
+ /** @param {string[] | undefined} paths */
61
72
  fix: (paths) => runESLint({ fix: true, paths }),
62
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "12.0.2",
3
+ "version": "12.0.4",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -79,7 +79,7 @@
79
79
  "esbuild-register": "^3.3.3",
80
80
  "escape-string-regexp": "^4.0.0",
81
81
  "eslint": "^8.41.0",
82
- "eslint-config-seek": "^11.1.2",
82
+ "eslint-config-seek": "^11.2.0",
83
83
  "exception-formatter": "^2.1.2",
84
84
  "express": "^4.16.3",
85
85
  "fast-glob": "^3.2.5",