@averay/codeformat 0.2.18 → 0.2.20
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.
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
declare(strict_types=1);
|
|
3
|
+
|
|
4
|
+
$base = [
|
|
5
|
+
'@PhpCsFixer' => true,
|
|
6
|
+
'@Symfony' => true,
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
$prettier = [
|
|
10
|
+
'array_indentation' => false,
|
|
11
|
+
'array_syntax' => false,
|
|
12
|
+
'blank_line_before_statement' => false,
|
|
13
|
+
'braces_position' => false,
|
|
14
|
+
'cast_spaces' => false,
|
|
15
|
+
'class_definition' => false,
|
|
16
|
+
'compact_nullable_type_declaration' => false,
|
|
17
|
+
'concat_space' => false,
|
|
18
|
+
'constant_case' => false,
|
|
19
|
+
'control_structure_braces' => false,
|
|
20
|
+
'control_structure_continuation_position' => false,
|
|
21
|
+
'declare_parentheses' => false,
|
|
22
|
+
'function_declaration' => ['closure_fn_spacing' => 'none'],
|
|
23
|
+
'heredoc_indentation' => ['indentation' => 'same_as_start'],
|
|
24
|
+
'indentation_type' => false,
|
|
25
|
+
'line_ending' => false,
|
|
26
|
+
'lowercase_cast' => false,
|
|
27
|
+
'lowercase_keywords' => false,
|
|
28
|
+
'lowercase_static_reference' => false,
|
|
29
|
+
'magic_constant_casing' => false,
|
|
30
|
+
'method_chaining_indentation' => false,
|
|
31
|
+
'multiline_whitespace_before_semicolons' => false,
|
|
32
|
+
'native_type_declaration_casing' => false,
|
|
33
|
+
'new_with_parentheses' => false,
|
|
34
|
+
'no_blank_lines_after_class_opening' => false,
|
|
35
|
+
'no_extra_blank_lines' => false,
|
|
36
|
+
'no_multiline_whitespace_around_double_arrow' => false,
|
|
37
|
+
'no_multiple_statements_per_line' => false,
|
|
38
|
+
'no_spaces_around_offset' => false,
|
|
39
|
+
'no_trailing_comma_in_singleline' => false,
|
|
40
|
+
'no_trailing_whitespace' => false,
|
|
41
|
+
'no_unneeded_control_parentheses' => [
|
|
42
|
+
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from'],
|
|
43
|
+
],
|
|
44
|
+
'no_whitespace_before_comma_in_array' => false,
|
|
45
|
+
'no_whitespace_in_blank_line' => false,
|
|
46
|
+
'operator_linebreak' => false,
|
|
47
|
+
'single_blank_line_at_eof' => false,
|
|
48
|
+
'single_line_empty_body' => false,
|
|
49
|
+
'single_line_throw' => false,
|
|
50
|
+
'single_space_around_construct' => false,
|
|
51
|
+
'spaces_inside_parentheses' => false,
|
|
52
|
+
'statement_indentation' => false,
|
|
53
|
+
'trim_array_spaces' => false,
|
|
54
|
+
'types_spaces' => false,
|
|
55
|
+
'type_declaration_spaces' => false,
|
|
56
|
+
'whitespace_after_comma_in_array' => false,
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
$custom = [
|
|
60
|
+
'blank_line_after_opening_tag' => false,
|
|
61
|
+
'combine_consecutive_issets' => false,
|
|
62
|
+
'combine_consecutive_unsets' => false,
|
|
63
|
+
'fully_qualified_strict_types' => ['leading_backslash_in_global_namespace' => true],
|
|
64
|
+
'increment_style' => ['style' => 'post'],
|
|
65
|
+
'native_function_invocation' => ['include' => ['@internal']],
|
|
66
|
+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
|
|
67
|
+
'no_useless_else' => false,
|
|
68
|
+
'phpdoc_align' => false,
|
|
69
|
+
'phpdoc_annotation_without_dot' => false,
|
|
70
|
+
'phpdoc_tag_casing' => true,
|
|
71
|
+
'phpdoc_to_comment' => ['ignored_tags' => ['lang', 'noinspection', 'psalm-suppress', 'psalm-type', 'var']],
|
|
72
|
+
'return_assignment' => false,
|
|
73
|
+
'string_implicit_backslashes' => ['single_quoted' => 'escape', 'double_quoted' => 'escape', 'heredoc' => 'escape'],
|
|
74
|
+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
|
|
75
|
+
|
|
76
|
+
'ordered_class_elements' => [
|
|
77
|
+
'order' => [
|
|
78
|
+
'use_trait',
|
|
79
|
+
'case',
|
|
80
|
+
'constant_public',
|
|
81
|
+
'constant_protected',
|
|
82
|
+
'constant_private',
|
|
83
|
+
'property_static',
|
|
84
|
+
'property',
|
|
85
|
+
'construct',
|
|
86
|
+
'destruct',
|
|
87
|
+
// 'method',
|
|
88
|
+
// 'method_static',
|
|
89
|
+
],
|
|
90
|
+
],
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
return $base + $prettier + $custom;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Config } from 'prettier';
|
|
2
2
|
interface Plugins {
|
|
3
|
+
ini?: boolean;
|
|
3
4
|
php?: boolean;
|
|
4
5
|
xml?: boolean;
|
|
5
6
|
}
|
|
@@ -8,5 +9,5 @@ interface Plugins {
|
|
|
8
9
|
* @param root2 Project-specific customisations.
|
|
9
10
|
* @returns The complete Prettier config.
|
|
10
11
|
*/
|
|
11
|
-
export default function makePrettierConfig({ php, xml }?: Plugins, { plugins, ...config }?: Config): Config;
|
|
12
|
+
export default function makePrettierConfig({ ini, php, xml }?: Plugins, { plugins, overrides, ...config }?: Config): Config;
|
|
12
13
|
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/* eslint sort-keys: "error" -- Organise rules */
|
|
2
|
+
/* eslint unicorn/no-useless-spread: "off" -- Keep the basic settings together. */
|
|
2
3
|
/**
|
|
3
4
|
* @param root1 Included plugins to enable.
|
|
4
5
|
* @param root2 Project-specific customisations.
|
|
5
6
|
* @returns The complete Prettier config.
|
|
6
7
|
*/
|
|
7
|
-
export default function makePrettierConfig({ php = false, xml = false } = {}, { plugins = [], ...config } = {}) {
|
|
8
|
+
export default function makePrettierConfig({ ini = false, php = false, xml = false } = {}, { plugins = [], overrides = [], ...config } = {}) {
|
|
9
|
+
if (ini) {
|
|
10
|
+
plugins.push('prettier-plugin-ini');
|
|
11
|
+
}
|
|
8
12
|
if (php) {
|
|
9
13
|
plugins.push('@prettier/plugin-php');
|
|
10
14
|
}
|
|
@@ -12,12 +16,21 @@ export default function makePrettierConfig({ php = false, xml = false } = {}, {
|
|
|
12
16
|
plugins.push('@prettier/plugin-xml');
|
|
13
17
|
}
|
|
14
18
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
...{
|
|
20
|
+
arrowParens: 'always',
|
|
21
|
+
plugins,
|
|
22
|
+
proseWrap: 'never',
|
|
23
|
+
semi: true,
|
|
24
|
+
singleQuote: true,
|
|
25
|
+
trailingComma: 'all',
|
|
26
|
+
},
|
|
27
|
+
overrides: [
|
|
28
|
+
{
|
|
29
|
+
files: ['**/*.yml', '**/*.yaml'],
|
|
30
|
+
options: { proseWrap: 'preserve' }, // Prevents Prettier bug (https://github.com/prettier/prettier/issues/10776)
|
|
31
|
+
},
|
|
32
|
+
...overrides,
|
|
33
|
+
],
|
|
21
34
|
...config,
|
|
22
35
|
};
|
|
23
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makePrettierConfig.js","sourceRoot":"","sources":["../../src/makePrettierConfig.ts"],"names":[],"mappings":"AAAA,iDAAiD;
|
|
1
|
+
{"version":3,"file":"makePrettierConfig.js","sourceRoot":"","sources":["../../src/makePrettierConfig.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,kFAAkF;AAUlF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,KAAc,EAAE,EACvD,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,MAAM,KAAa,EAAE;IAExD,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;QACL,GAAG;YACD,WAAW,EAAE,QAAQ;YACrB,OAAO;YACP,SAAS,EAAE,OAAO;YAClB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;YACjB,aAAa,EAAE,KAAK;SACrB;QACD,SAAS,EAAE;YACT;gBACE,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;gBAChC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,4EAA4E;aACjH;YACD,GAAG,SAAS;SACb;QACD,GAAG,MAAM;KACV,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@averay/codeformat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"author": "Adam Averay (https://adamaveray.com.au/)",
|
|
5
5
|
"homepage": "https://github.com/adamaveray/codeformat",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"description": "A very opinionated collection of configurations for a number of code formatting tools.",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"engines": {
|
|
14
|
-
"bun": ">=1.
|
|
14
|
+
"bun": ">=1.3"
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
17
|
"codeformat": "dist/bin/codeformat.js"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "rm -rf dist && bun run build:tsc && bun run build:php && chmod +x dist/bin/*.js",
|
|
23
23
|
"build:tsc": "bun --bun x tsc --project tsconfig.build.json --outDir dist",
|
|
24
|
-
"build:php": "cp -R src/php dist/src/",
|
|
24
|
+
"build:php": "cp -R src/php dist/src/ && cp -R rulesets/php dist/rulesets/",
|
|
25
25
|
"test": "bun test",
|
|
26
26
|
"format": "dist/bin/codeformat.js fix",
|
|
27
27
|
"lint": "dist/bin/codeformat.js check",
|
|
@@ -32,33 +32,34 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@averay/css-properties-sort-order": "^1.0.3",
|
|
35
|
-
"@eslint/js": "^9.
|
|
36
|
-
"@eslint/markdown": "^7.
|
|
35
|
+
"@eslint/js": "^9.39.1",
|
|
36
|
+
"@eslint/markdown": "^7.5.0",
|
|
37
37
|
"@prettier/plugin-php": "^0.24.0",
|
|
38
38
|
"@prettier/plugin-xml": "^3.4.2",
|
|
39
|
-
"@stylistic/eslint-plugin": "^5.
|
|
39
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
40
40
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
42
|
-
"@typescript-eslint/parser": "^8.46.
|
|
43
|
-
"@typescript-eslint/utils": "^8.46.
|
|
44
|
-
"eslint": "^9.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
42
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
43
|
+
"@typescript-eslint/utils": "^8.46.3",
|
|
44
|
+
"eslint": "^9.39.1",
|
|
45
45
|
"eslint-config-prettier": "^10.1.8",
|
|
46
46
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
47
47
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
48
48
|
"eslint-plugin-import-x": "^4.16.1",
|
|
49
|
-
"eslint-plugin-jsdoc": "^61.1.
|
|
49
|
+
"eslint-plugin-jsdoc": "^61.1.12",
|
|
50
50
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
51
51
|
"eslint-plugin-promise": "^7.2.1",
|
|
52
52
|
"eslint-plugin-react": "^7.37.5",
|
|
53
|
-
"eslint-plugin-react-hooks": "^7.0.
|
|
54
|
-
"eslint-plugin-react-you-might-not-need-an-effect": "^0.
|
|
53
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
54
|
+
"eslint-plugin-react-you-might-not-need-an-effect": "^0.6.1",
|
|
55
55
|
"eslint-plugin-regexp": "^2.10.0",
|
|
56
56
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
57
57
|
"eslint-plugin-unicorn": "^61.0.2",
|
|
58
|
-
"globals": "^16.
|
|
59
|
-
"knip": "^5.
|
|
58
|
+
"globals": "^16.5.0",
|
|
59
|
+
"knip": "^5.67.1",
|
|
60
60
|
"postcss-scss": "^4.0.9",
|
|
61
61
|
"prettier": "^3.6.2",
|
|
62
|
+
"prettier-plugin-ini": "^1.3.0",
|
|
62
63
|
"stylelint": "^16.25.0",
|
|
63
64
|
"stylelint-config-recommended": "^17.0.0",
|
|
64
65
|
"stylelint-config-recommended-scss": "^16.0.2",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"stylelint-plugin-defensive-css": "^1.0.4",
|
|
69
70
|
"stylelint-scss": "^6.12.1",
|
|
70
71
|
"stylelint-use-logical": "^2.1.2",
|
|
71
|
-
"typescript-eslint": "^8.46.
|
|
72
|
+
"typescript-eslint": "^8.46.3"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@types/bun": "latest",
|