aberlaas-lint 2.25.0 → 2.27.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/vue.js +3 -0
- package/configs/prettier.js +12 -1
- package/configs/stylelint.js +1 -1
- package/lib/css.js +2 -2
- package/lib/helpers/prettierFix.js +5 -1
- package/lib/html.js +48 -0
- package/lib/js.js +2 -2
- package/lib/json.js +2 -2
- package/lib/main.js +1 -0
- package/lib/yml.js +2 -2
- package/package.json +4 -3
package/configs/eslint/vue.js
CHANGED
|
@@ -19,11 +19,14 @@ export default [
|
|
|
19
19
|
processor: 'vue/vue',
|
|
20
20
|
rules: {
|
|
21
21
|
...rules,
|
|
22
|
+
'vue/attribute-hyphenation': ['error', 'never'],
|
|
22
23
|
'vue/component-api-style': ['error', ['script-setup']],
|
|
23
24
|
'vue/define-macros-order': ['error'],
|
|
25
|
+
'vue/no-undef-components': ['error'],
|
|
24
26
|
|
|
25
27
|
// Rules that conflict with Pretttier
|
|
26
28
|
'vue/html-indent': ['off'],
|
|
29
|
+
'vue/html-closing-bracket-newline': ['off'],
|
|
27
30
|
'vue/html-self-closing': [
|
|
28
31
|
'error',
|
|
29
32
|
{
|
package/configs/prettier.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
// We use the full absolute path to the plugin so it can be used even from
|
|
4
|
+
// outside of aberlaas, for example when calling Prettier directly.
|
|
5
|
+
const tailwindcssPlugin = fileURLToPath(
|
|
6
|
+
import.meta.resolve('prettier-plugin-tailwindcss'),
|
|
7
|
+
);
|
|
8
|
+
|
|
1
9
|
export default {
|
|
2
|
-
|
|
10
|
+
bracketSameLine: true,
|
|
3
11
|
printWidth: 80,
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
plugins: [tailwindcssPlugin],
|
|
14
|
+
tailwindFunctions: ['clsx'],
|
|
4
15
|
};
|
package/configs/stylelint.js
CHANGED
package/lib/css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from 'golgoth';
|
|
2
2
|
import { firostError } from 'firost';
|
|
3
|
-
import {
|
|
3
|
+
import { findHostFiles, getConfig } from 'aberlaas-helper';
|
|
4
4
|
import stylelint from 'stylelint';
|
|
5
5
|
import stylelintConfig from '../configs/stylelint.js';
|
|
6
6
|
import { prettierFix } from './helpers/prettierFix.js';
|
|
@@ -72,7 +72,7 @@ __ = {
|
|
|
72
72
|
const filePatterns = _.isEmpty(userPatterns)
|
|
73
73
|
? ['./**/*.css']
|
|
74
74
|
: userPatterns;
|
|
75
|
-
return await
|
|
75
|
+
return await findHostFiles(filePatterns, ['.css']);
|
|
76
76
|
},
|
|
77
77
|
|
|
78
78
|
prettierFix,
|
|
@@ -2,6 +2,7 @@ import { _, pMap } from 'golgoth';
|
|
|
2
2
|
import { firostError, read, write } from 'firost';
|
|
3
3
|
import { getConfig } from 'aberlaas-helper';
|
|
4
4
|
import { format as prettierFormat } from 'prettier';
|
|
5
|
+
import * as prettierTailwindPlugin from 'prettier-plugin-tailwindcss';
|
|
5
6
|
import prettierConfig from '../../configs/prettier.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -12,6 +13,9 @@ export async function prettierFix(inputFiles) {
|
|
|
12
13
|
// Config file
|
|
13
14
|
const config = await getConfig(null, 'prettier.config.js', prettierConfig);
|
|
14
15
|
|
|
16
|
+
// Plugins
|
|
17
|
+
const plugins = [prettierTailwindPlugin];
|
|
18
|
+
|
|
15
19
|
const errors = [];
|
|
16
20
|
|
|
17
21
|
// Read all files, run them through the formatter and save them back to disk
|
|
@@ -21,7 +25,7 @@ export async function prettierFix(inputFiles) {
|
|
|
21
25
|
async (filepath) => {
|
|
22
26
|
try {
|
|
23
27
|
const content = await read(filepath);
|
|
24
|
-
const options = { ...config, filepath };
|
|
28
|
+
const options = { ...config, plugins, filepath };
|
|
25
29
|
const result = await prettierFormat(content, options);
|
|
26
30
|
await write(result, filepath);
|
|
27
31
|
} catch (error) {
|
package/lib/html.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { _ } from 'golgoth';
|
|
2
|
+
import { findHostFiles } from 'aberlaas-helper';
|
|
3
|
+
import { prettierFix } from './helpers/prettierFix.js';
|
|
4
|
+
|
|
5
|
+
export let __;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Lint HTML files
|
|
9
|
+
* @returns {boolean} True on success
|
|
10
|
+
*/
|
|
11
|
+
export async function run() {
|
|
12
|
+
// We do not currently have an HTML Linter, only a Formatter
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Autofix HTML files in place
|
|
18
|
+
* @param {Array} userPatterns Patterns to narrow the search down
|
|
19
|
+
* @returns {boolean} True on success
|
|
20
|
+
*/
|
|
21
|
+
export async function fix(userPatterns) {
|
|
22
|
+
const files = await __.getInputFiles(userPatterns);
|
|
23
|
+
if (_.isEmpty(files)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
await __.prettierFix(files);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
__ = {
|
|
30
|
+
/**
|
|
31
|
+
* Find all relevant HTML files
|
|
32
|
+
* @param {Array} userPatterns Patterns to narrow the search down
|
|
33
|
+
* @returns {Array} Array of files
|
|
34
|
+
*/
|
|
35
|
+
async getInputFiles(userPatterns) {
|
|
36
|
+
const filePatterns = _.isEmpty(userPatterns)
|
|
37
|
+
? ['./**/*.html']
|
|
38
|
+
: userPatterns;
|
|
39
|
+
return await findHostFiles(filePatterns, ['.html']);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
prettierFix,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
run,
|
|
47
|
+
fix,
|
|
48
|
+
};
|
package/lib/js.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from 'golgoth';
|
|
2
2
|
import { firostError } from 'firost';
|
|
3
|
-
import {
|
|
3
|
+
import { findHostFiles } from 'aberlaas-helper';
|
|
4
4
|
import { eslintRun } from './helpers/eslintRun.js';
|
|
5
5
|
|
|
6
6
|
export let __;
|
|
@@ -45,7 +45,7 @@ __ = {
|
|
|
45
45
|
: userPatterns;
|
|
46
46
|
const allowedExtensions = ['.js', '.jsx', '.ts', '.tsx', '.vue'];
|
|
47
47
|
|
|
48
|
-
return await
|
|
48
|
+
return await findHostFiles(filePatterns, allowedExtensions);
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
|
package/lib/json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from 'golgoth';
|
|
2
2
|
import { firostError } from 'firost';
|
|
3
|
-
import {
|
|
3
|
+
import { findHostFiles } from 'aberlaas-helper';
|
|
4
4
|
import { eslintRun } from './helpers/eslintRun.js';
|
|
5
5
|
import { prettierFix } from './helpers/prettierFix.js';
|
|
6
6
|
|
|
@@ -57,7 +57,7 @@ __ = {
|
|
|
57
57
|
const filePatterns = _.isEmpty(userPatterns)
|
|
58
58
|
? ['./**/*.json']
|
|
59
59
|
: userPatterns;
|
|
60
|
-
return await
|
|
60
|
+
return await findHostFiles(filePatterns, ['.json']);
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
prettierFix,
|
package/lib/main.js
CHANGED
package/lib/yml.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { _, pMap } from 'golgoth';
|
|
3
3
|
import { firostError, read } from 'firost';
|
|
4
|
-
import {
|
|
4
|
+
import { findHostFiles, hostGitRoot } from 'aberlaas-helper';
|
|
5
5
|
import yamlLint from 'yaml-lint';
|
|
6
6
|
import { prettierFix } from './helpers/prettierFix.js';
|
|
7
7
|
|
|
@@ -61,7 +61,7 @@ __ = {
|
|
|
61
61
|
const filePatterns = _.isEmpty(userPatterns)
|
|
62
62
|
? ['./**/*.yml', './**/*.yaml']
|
|
63
63
|
: userPatterns;
|
|
64
|
-
return await
|
|
64
|
+
return await findHostFiles(filePatterns, ['.yml', '.yaml']);
|
|
65
65
|
},
|
|
66
66
|
|
|
67
67
|
prettierFix,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aberlaas-lint",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "aberlaas lint command: Lint files",
|
|
6
6
|
"author": "Tim Carry <tim@pixelastic.com>",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@eslint/json": "1.0.0",
|
|
30
30
|
"@typescript-eslint/utils": "8.55.0",
|
|
31
31
|
"@vitest/eslint-plugin": "1.6.7",
|
|
32
|
-
"aberlaas-helper": "2.
|
|
33
|
-
"aberlaas-versions": "2.
|
|
32
|
+
"aberlaas-helper": "2.27.0",
|
|
33
|
+
"aberlaas-versions": "2.27.0",
|
|
34
34
|
"ci-info": "4.4.0",
|
|
35
35
|
"eslint": "9.39.2",
|
|
36
36
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"golgoth": "3.1.0",
|
|
47
47
|
"jsonc-eslint-parser": "2.4.2",
|
|
48
48
|
"prettier": "3.8.1",
|
|
49
|
+
"prettier-plugin-tailwindcss": "0.7.2",
|
|
49
50
|
"stylelint": "17.2.0",
|
|
50
51
|
"typescript": "5.9.3",
|
|
51
52
|
"vue-eslint-parser": "10.4.0",
|