aberlaas-lint 2.10.0 → 2.11.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/configs/eslint.js CHANGED
@@ -88,6 +88,7 @@ export default [
88
88
  'error',
89
89
  { version: `>=${nodeVersion}` },
90
90
  ],
91
+ 'n/no-unpublished-import': ['error'],
91
92
  // Import
92
93
  'import/first': ['error'],
93
94
  'import/no-cycle': ['error', { ignoreExternal: true, disableScc: true }],
@@ -0,0 +1,54 @@
1
+ import { format as prettierFormat } from 'prettier';
2
+ import { firostError, read, write } from 'firost';
3
+ import { _, pMap } from 'golgoth';
4
+ import helper from 'aberlaas-helper';
5
+ import prettierConfig from '../../configs/prettier.js';
6
+
7
+ /**
8
+ * Fix all files using prettier
9
+ * @param {Array} inputFiles Files to auto-fix
10
+ */
11
+ export async function fix(inputFiles) {
12
+ // Config file
13
+ const config = await helper.getConfig(
14
+ null,
15
+ 'prettier.config.js',
16
+ prettierConfig,
17
+ );
18
+
19
+ const errors = [];
20
+
21
+ // Read all files, run them through the formatter and save them back to disk
22
+ // If any emits error, store the errors and display them all in one output
23
+ await pMap(
24
+ inputFiles,
25
+ async (filepath) => {
26
+ try {
27
+ const content = await read(filepath);
28
+ const options = { ...config, filepath };
29
+ const result = await prettierFormat(content, options);
30
+ await write(result, filepath);
31
+ } catch (error) {
32
+ const message = error.toString();
33
+ errors.push({ filepath, message });
34
+ }
35
+ },
36
+ { concurrency: 10 },
37
+ );
38
+
39
+ if (!_.isEmpty(errors)) {
40
+ let formattedErrors = '';
41
+ _.each(errors, (error) => {
42
+ formattedErrors = `${formattedErrors}${error.filepath}\n\n${error.message}\n\n`;
43
+ });
44
+
45
+ throw firostError(
46
+ 'LINT_ERROR_FIX_PRETTIER',
47
+ `Some files could not be automatically fixed:\n\n${formattedErrors}`,
48
+ );
49
+ }
50
+ }
51
+
52
+ export default {
53
+ fix,
54
+ };
package/package.json CHANGED
@@ -2,13 +2,14 @@
2
2
  "name": "aberlaas-lint",
3
3
  "type": "module",
4
4
  "description": "aberlaas lint command: Lint files",
5
- "version": "2.10.0",
5
+ "version": "2.11.0",
6
6
  "repository": "pixelastic/aberlaas",
7
7
  "homepage": "https://projects.pixelastic.com/aberlaas/",
8
8
  "author": "Tim Carry (@pixelastic)",
9
9
  "license": "MIT",
10
10
  "files": [
11
11
  "lib/*.js",
12
+ "lib/helpers/*.js",
12
13
  "configs/*.js"
13
14
  ],
14
15
  "exports": {
@@ -37,24 +38,24 @@
37
38
  "lint:fix": "../../scripts/local/lint-fix"
38
39
  },
39
40
  "dependencies": {
40
- "@eslint/js": "9.12.0",
41
- "@typescript-eslint/utils": "8.8.1",
42
- "@vitest/eslint-plugin": "1.1.7",
41
+ "@eslint/js": "9.14.0",
42
+ "@typescript-eslint/utils": "8.14.0",
43
+ "@vitest/eslint-plugin": "1.1.10",
43
44
  "aberlaas-helper": "^2.10.0",
44
45
  "aberlaas-versions": "^2.10.0",
45
- "ci-info": "4.0.0",
46
- "eslint": "9.12.0",
46
+ "ci-info": "4.1.0",
47
+ "eslint": "9.14.0",
47
48
  "eslint-config-prettier": "9.1.0",
48
49
  "eslint-plugin-import": "2.31.0",
49
- "eslint-plugin-jsdoc": "50.3.1",
50
- "eslint-plugin-n": "17.11.1",
50
+ "eslint-plugin-jsdoc": "50.5.0",
51
+ "eslint-plugin-n": "17.13.1",
51
52
  "eslint-plugin-prettier": "5.2.1",
52
53
  "firost": "4.3.0",
53
54
  "golgoth": "2.4.0",
54
55
  "prettier": "3.3.3",
55
- "stylelint": "16.9.0",
56
+ "stylelint": "16.10.0",
56
57
  "typescript": "5.6.3",
57
58
  "yaml-lint": "1.7.0"
58
59
  },
59
- "gitHead": "bcdaf87c198a588e02b5539c222f611e356d3079"
60
+ "gitHead": "ae26d72ed4782af9545d664b65c7eb5305a88335"
60
61
  }