@averay/codeformat 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -8,20 +8,20 @@ A very opinionated collection of configurations for a number of code formatting
8
8
 
9
9
  2. Symlink the static configuration files to the project root:
10
10
 
11
- ```sh
12
- ln -s node_modules/@averay/codeformat/.editorconfig node_modules/@averay/codeformat/.prettierrc.json ./
13
- ```
11
+ ```sh
12
+ ln -s node_modules/@averay/codeformat/.editorconfig node_modules/@averay/codeformat/.prettierrc.json ./
13
+ ```
14
14
 
15
15
  3. Generate the ESLint configuration after any custom ignore definitions:
16
16
 
17
- ```js
18
- // eslint.config.js
19
- import { makeEslintConfig } from '@adamaveray/codeformat';
20
-
21
- export default [
22
- {
23
- ignores: ['dist/**/*'],
24
- },
25
- ...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
26
- ];
27
- ```
17
+ ```js
18
+ // eslint.config.js
19
+ import { makeEslintConfig } from '@averay/codeformat';
20
+
21
+ export default [
22
+ {
23
+ ignores: ['dist/**/*'],
24
+ },
25
+ ...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
26
+ ];
27
+ ```
package/eslint.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { FlatCompat } from '@eslint/eslintrc';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import js from '@eslint/js';
4
5
  import typescript from '@typescript-eslint/eslint-plugin';
5
6
  import typescriptParser from '@typescript-eslint/parser';
6
7
  import prettierConfig from 'eslint-config-prettier';
@@ -8,17 +9,20 @@ import prettierConfig from 'eslint-config-prettier';
8
9
  const compat = new FlatCompat({ baseDirectory: path.dirname(fileURLToPath(import.meta.url)) });
9
10
 
10
11
  export default [
11
- 'eslint:recommended',
12
- prettierConfig,
13
- ...compat.plugins('@typescript-eslint'),
14
- { files: ['**/*.{js,jsx,cjs,cjsx,mjs,mjsx}'] },
15
12
  {
16
- files: ['**/*.{ts,tsx}'],
13
+ files: ['**/*.{js,jsx,cjs,cjsx,mjs,mjsx}'],
14
+ rules: js.configs.recommended.rules,
15
+ },
16
+ {
17
+ ...compat.plugins('@typescript-eslint')[0],
18
+ files: ['**/*.{ts,tsx,cts,ctsx,mts,mtsx}'],
17
19
  languageOptions: { parser: typescriptParser },
18
20
  rules: {
21
+ ...js.configs.recommended.rules,
19
22
  ...typescript.configs.base.rules,
20
23
  ...typescript.configs['eslint-recommended'].rules,
21
24
  ...typescript.configs.strict.rules,
22
25
  },
23
26
  },
27
+ prettierConfig,
24
28
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@averay/codeformat",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "author": "Adam Averay (https://adamaveray.com.au/)",
5
5
  "homepage": "https://github.com/adamaveray/codeformat",
6
6
  "repository": {
@@ -14,11 +14,31 @@
14
14
  "engines": {
15
15
  "node": ">=18"
16
16
  },
17
+ "files": [
18
+ ".editorconfig",
19
+ ".prettierrc.json",
20
+ "eslint.config.js",
21
+ "index.js"
22
+ ],
23
+ "scripts": {
24
+ "format": "prettier --write .",
25
+ "lint": "prettier --check .",
26
+ "prepare": "husky install"
27
+ },
28
+ "husky": {
29
+ "hooks": {
30
+ "pre-push": "npm run lint"
31
+ }
32
+ },
17
33
  "dependencies": {
18
- "@eslint/eslintrc": "^1.4.1",
19
- "@typescript-eslint/eslint-plugin": "^5.50.0",
20
- "@typescript-eslint/parser": "^5.50.0",
34
+ "@eslint/eslintrc": "^2.0.0",
35
+ "@eslint/js": "^8.35.0",
36
+ "@typescript-eslint/eslint-plugin": "^5.54.0",
37
+ "@typescript-eslint/parser": "^5.54.0",
21
38
  "eslint-config-prettier": "^8.6.0",
22
- "prettier": "^2.8.3"
39
+ "prettier": "^2.8.4"
40
+ },
41
+ "devDependencies": {
42
+ "husky": "^8.0.3"
23
43
  }
24
44
  }
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
@@ -1,179 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0" is_locked="false">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="BadExceptionsProcessingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
5
- <inspection_tool class="ComparisonOperandsOrderInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
6
- <inspection_tool class="CssInvalidImportInspection" enabled="true" level="ERROR" enabled_by_default="true" />
7
- <inspection_tool class="CssNoGenericFontName" enabled="true" level="ERROR" enabled_by_default="true" />
8
- <inspection_tool class="CssUnknownProperty" enabled="true" level="WARNING" enabled_by_default="true">
9
- <option name="myCustomPropertiesEnabled" value="true" />
10
- <option name="myIgnoreVendorSpecificProperties" value="false" />
11
- <option name="myCustomPropertiesList">
12
- <value>
13
- <list size="2">
14
- <item index="0" class="java.lang.String" itemvalue="overflow-scrolling" />
15
- <item index="1" class="java.lang.String" itemvalue="backdrop-filter" />
16
- </list>
17
- </value>
18
- </option>
19
- </inspection_tool>
20
- <inspection_tool class="EmptyClassInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
21
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
22
- <inspection_tool class="ForeachSourceInspection" enabled="true" level="WARNING" enabled_by_default="true" />
23
- <inspection_tool class="ForgottenDebugOutputInspection" enabled="true" level="ERROR" enabled_by_default="true">
24
- <option name="configuration">
25
- <list>
26
- <option value="\Codeception\Util\Debug::debug" />
27
- <option value="\Codeception\Util\Debug::pause" />
28
- <option value="\Illuminate\Support\Debug\Dumper::dump" />
29
- <option value="\Symfony\Component\Debug\Debug::enable" />
30
- <option value="\Symfony\Component\Debug\DebugClassLoader::enable" />
31
- <option value="\Symfony\Component\Debug\ErrorHandler::register" />
32
- <option value="\Symfony\Component\Debug\ExceptionHandler::register" />
33
- <option value="\Zend\Debug\Debug::dump" />
34
- <option value="\Zend\Di\Display\Console::export" />
35
- <option value="dd" />
36
- <option value="debug_print_backtrace" />
37
- <option value="debug_zval_dump" />
38
- <option value="error_log" />
39
- <option value="phpinfo" />
40
- <option value="print_r" />
41
- <option value="var_dump" />
42
- <option value="var_export" />
43
- </list>
44
- </option>
45
- <option name="migratedIntoUserSpace" value="true" />
46
- </inspection_tool>
47
- <inspection_tool class="HostnameSubstitutionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
48
- <inspection_tool class="HtmlDeprecatedTag" enabled="true" level="ERROR" enabled_by_default="true" />
49
- <inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
50
- <option name="myValues">
51
- <value>
52
- <list size="8">
53
- <item index="0" class="java.lang.String" itemvalue="nobr" />
54
- <item index="1" class="java.lang.String" itemvalue="noembed" />
55
- <item index="2" class="java.lang.String" itemvalue="comment" />
56
- <item index="3" class="java.lang.String" itemvalue="noscript" />
57
- <item index="4" class="java.lang.String" itemvalue="embed" />
58
- <item index="5" class="java.lang.String" itemvalue="script" />
59
- <item index="6" class="java.lang.String" itemvalue="picture" />
60
- <item index="7" class="java.lang.String" itemvalue="hgroup" />
61
- </list>
62
- </value>
63
- </option>
64
- <option name="myCustomValuesEnabled" value="true" />
65
- </inspection_tool>
66
- <inspection_tool class="InvisibleCharacter" enabled="true" level="ERROR" enabled_by_default="true" />
67
- <inspection_tool class="IssetConstructsCanBeMergedInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
68
- <inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
69
- <inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
70
- <inspection_tool class="OffsetOperationsInspection" enabled="true" level="ERROR" enabled_by_default="true" />
71
- <inspection_tool class="PhpAssignmentInConditionInspection" enabled="true" level="WARNING" enabled_by_default="true" />
72
- <inspection_tool class="PhpClassNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
73
- <option name="m_minLength" value="3" />
74
- <option name="m_maxLength" value="30" />
75
- </inspection_tool>
76
- <inspection_tool class="PhpConstantNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
77
- <option name="m_minLength" value="3" />
78
- </inspection_tool>
79
- <inspection_tool class="PhpDocMissingThrowsInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
80
- <inspection_tool class="PhpDynamicAsStaticMethodCallInspection" enabled="true" level="ERROR" enabled_by_default="true" />
81
- <inspection_tool class="PhpFunctionNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
82
- <option name="m_regex" value="[a-z][A-Za-z\d]*" />
83
- <option name="m_minLength" value="3" />
84
- <option name="m_maxLength" value="30" />
85
- </inspection_tool>
86
- <inspection_tool class="PhpIllegalArrayKeyTypeInspection" enabled="true" level="ERROR" enabled_by_default="true" />
87
- <inspection_tool class="PhpIllegalStringOffsetInspection" enabled="true" level="ERROR" enabled_by_default="true" />
88
- <inspection_tool class="PhpMethodNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
89
- <option name="m_minLength" value="3" />
90
- <option name="m_maxLength" value="30" />
91
- </inspection_tool>
92
- <inspection_tool class="PhpMethodOrClassCallIsNotCaseSensitiveInspection" enabled="true" level="WARNING" enabled_by_default="true" />
93
- <inspection_tool class="PhpMissingStrictTypesDeclarationInspection" enabled="true" level="ERROR" enabled_by_default="true" />
94
- <inspection_tool class="PhpNonCanonicalElementsOrderInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
95
- <inspection_tool class="PhpPropertyNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
96
- <option name="m_minLength" value="2" />
97
- <option name="m_maxLength" value="30" />
98
- </inspection_tool>
99
- <inspection_tool class="PhpShortOpenTagInspection" enabled="true" level="ERROR" enabled_by_default="true" />
100
- <inspection_tool class="PhpStaticAsDynamicMethodCallInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
101
- <inspection_tool class="PhpTraditionalSyntaxArrayLiteralInspection" enabled="true" level="WARNING" enabled_by_default="true" />
102
- <inspection_tool class="PhpUndefinedCallbackInspection" enabled="true" level="WARNING" enabled_by_default="true" />
103
- <inspection_tool class="PhpVariableNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
104
- <option name="m_regex" value="([a-z][A-Za-z\d]*|_\d*|ROOT)" />
105
- <option name="m_minLength" value="1" />
106
- <option name="m_maxLength" value="30" />
107
- </inspection_tool>
108
- <inspection_tool class="PhpVariableVariableInspection" enabled="true" level="WARNING" enabled_by_default="true" />
109
- <inspection_tool class="RequiredAttributes" enabled="true" level="ERROR" enabled_by_default="true">
110
- <option name="myAdditionalRequiredHtmlAttributes" value="" />
111
- </inspection_tool>
112
- <inspection_tool class="SecurityAdvisoriesInspection" enabled="true" level="WARNING" enabled_by_default="true">
113
- <option name="optionConfiguration">
114
- <list>
115
- <option value="barryvdh/laravel-debugbar" />
116
- <option value="behat/behat" />
117
- <option value="brianium/paratest" />
118
- <option value="codeception/codeception" />
119
- <option value="codedungeon/phpunit-result-printer" />
120
- <option value="composer/composer" />
121
- <option value="doctrine/coding-standard" />
122
- <option value="filp/whoops" />
123
- <option value="friendsofphp/php-cs-fixer" />
124
- <option value="humbug/humbug" />
125
- <option value="infection/infection" />
126
- <option value="jakub-onderka/php-parallel-lint" />
127
- <option value="johnkary/phpunit-speedtrap" />
128
- <option value="kalessil/production-dependencies-guard" />
129
- <option value="mikey179/vfsStream" />
130
- <option value="mockery/mockery" />
131
- <option value="mybuilder/phpunit-accelerator" />
132
- <option value="orchestra/testbench" />
133
- <option value="pdepend/pdepend" />
134
- <option value="phan/phan" />
135
- <option value="phing/phing" />
136
- <option value="phpcompatibility/php-compatibility" />
137
- <option value="phpmd/phpmd" />
138
- <option value="phpro/grumphp" />
139
- <option value="phpspec/phpspec" />
140
- <option value="phpspec/prophecy" />
141
- <option value="phpstan/phpstan" />
142
- <option value="phpunit/dbunit" />
143
- <option value="phpunit/phpcov" />
144
- <option value="phpunit/phpunit" />
145
- <option value="phpunit/phpunit-selenium" />
146
- <option value="povils/phpmnd" />
147
- <option value="roave/security-advisories" />
148
- <option value="satooshi/php-coveralls" />
149
- <option value="sebastian/phpcpd" />
150
- <option value="slevomat/coding-standard" />
151
- <option value="spatie/phpunit-watcher" />
152
- <option value="squizlabs/php_codesniffer" />
153
- <option value="sstalle/php7cc" />
154
- <option value="symfony/debug" />
155
- <option value="symfony/maker-bundle" />
156
- <option value="symfony/phpunit-bridge" />
157
- <option value="symfony/var-dumper" />
158
- <option value="vimeo/psalm" />
159
- <option value="wimg/php-compatibility" />
160
- <option value="wp-coding-standards/wpcs" />
161
- <option value="yiisoft/yii2-coding-standards" />
162
- <option value="yiisoft/yii2-debug" />
163
- <option value="yiisoft/yii2-gii" />
164
- <option value="zendframework/zend-coding-standard" />
165
- <option value="zendframework/zend-debug" />
166
- <option value="zendframework/zend-test" />
167
- </list>
168
- </option>
169
- </inspection_tool>
170
- <inspection_tool class="ShortEchoTagCanBeUsedInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
171
- <inspection_tool class="SlowArrayOperationsInLoopInspection" enabled="true" level="WARNING" enabled_by_default="true" />
172
- <inspection_tool class="SubStrUsedAsStrPosInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
173
- <inspection_tool class="UnSafeIsSetOverArrayInspection" enabled="true" level="WARNING" enabled_by_default="true">
174
- <option name="SUGGEST_TO_USE_NULL_COMPARISON" value="true" />
175
- </inspection_tool>
176
- <inspection_tool class="UnqualifiedReferenceInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
177
- <inspection_tool class="UntrustedInclusionInspection" enabled="true" level="ERROR" enabled_by_default="true" />
178
- </profile>
179
- </component>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/codeformat.iml" filepath="$PROJECT_DIR$/.idea/codeformat.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/php.xml DELETED
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="MessDetectorOptionsConfiguration">
4
- <option name="transferred" value="true" />
5
- </component>
6
- <component name="PHPCSFixerOptionsConfiguration">
7
- <option name="transferred" value="true" />
8
- </component>
9
- <component name="PHPCodeSnifferOptionsConfiguration">
10
- <option name="transferred" value="true" />
11
- </component>
12
- <component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
13
- <component name="PhpStanOptionsConfiguration">
14
- <option name="transferred" value="true" />
15
- </component>
16
- <component name="PsalmOptionsConfiguration">
17
- <option name="transferred" value="true" />
18
- </component>
19
- </project>
package/.idea/vcs.xml DELETED
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GitSharedSettings">
4
- <option name="FORCE_PUSH_PROHIBITED_PATTERNS">
5
- <list>
6
- <option value="master,main" />
7
- </list>
8
- </option>
9
- </component>
10
- <component name="VcsDirectoryMappings">
11
- <mapping directory="" vcs="Git" />
12
- </component>
13
- </project>
@@ -1,64 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="AutoImportSettings">
4
- <option name="autoReloadType" value="SELECTIVE" />
5
- </component>
6
- <component name="ChangeListManager">
7
- <list default="true" id="32f0bacf-7b30-4936-83b7-7850bcaef340" name="Changes" comment="" />
8
- <option name="SHOW_DIALOG" value="false" />
9
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
- <option name="LAST_RESOLUTION" value="IGNORE" />
12
- </component>
13
- <component name="ComposerSettings">
14
- <execution />
15
- </component>
16
- <component name="Git.Settings">
17
- <option name="SAVE_CHANGES_POLICY" value="STASH" />
18
- </component>
19
- <component name="MacroExpansionManager">
20
- <option name="directoryName" value="5vkr3mki" />
21
- </component>
22
- <component name="MarkdownSettingsMigration">
23
- <option name="stateVersion" value="1" />
24
- </component>
25
- <component name="PhpDebugGeneral" xdebug_force_break_when_no_path_mapping="false" xdebug_force_break_when_outside_project="false" />
26
- <component name="ProjectId" id="2LA5kJRs74BcC8BbgAu25HNy8ub" />
27
- <component name="ProjectLevelVcsManager">
28
- <ConfirmationsSetting value="1" id="Add" />
29
- <ConfirmationsSetting value="1" id="Remove" />
30
- </component>
31
- <component name="ProjectViewState">
32
- <option name="showLibraryContents" value="true" />
33
- <option name="showMembers" value="true" />
34
- <option name="showVisibilityIcons" value="true" />
35
- </component>
36
- <component name="PropertiesComponent"><![CDATA[{
37
- "keyToString": {
38
- "RunOnceActivity.OpenProjectViewOnStart": "true",
39
- "RunOnceActivity.ShowReadmeOnStart": "true",
40
- "WebServerToolWindowFactoryState": "false",
41
- "node.js.detected.package.eslint": "true",
42
- "node.js.selected.package.eslint": "(autodetect)",
43
- "nodejs_package_manager_path": "npm",
44
- "prettierjs.PrettierConfiguration.Package": "/Users/adamaveray/Development/Libraries/NPM Modules/codeformat/node_modules/prettier",
45
- "ruby.rails.projectView.checked": "true",
46
- "settings.editor.selected.configurable": "vcs.Git",
47
- "vue.rearranger.settings.migration": "true"
48
- }
49
- }]]></component>
50
- <component name="RustProjectSettings">
51
- <option name="version" value="2" />
52
- </component>
53
- <component name="RustfmtProjectSettings">
54
- <option name="runRustfmtOnSave" value="true" />
55
- <option name="useRustfmt" value="true" />
56
- </component>
57
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
58
- <component name="TypeScriptGeneratedFilesManager">
59
- <option name="version" value="3" />
60
- </component>
61
- <component name="VcsManagerConfiguration">
62
- <confirmRemoveEmptyChangelist value="1" />
63
- </component>
64
- </project>