@adbayb/stack 1.16.0 → 2.0.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/README.md +36 -41
- package/bin/index.js +8 -0
- package/configs/eslint/README.md +39 -0
- package/configs/eslint/constants.js +10 -0
- package/configs/eslint/helpers.js +6 -0
- package/configs/eslint/index.js +29 -0
- package/configs/eslint/presets/base.js +26 -0
- package/configs/eslint/presets/eslint.js +105 -0
- package/configs/eslint/presets/import.js +71 -0
- package/configs/eslint/presets/jsdoc.js +79 -0
- package/configs/eslint/presets/node.js +51 -0
- package/configs/eslint/presets/overridable.js +33 -0
- package/configs/eslint/presets/react.js +75 -0
- package/configs/eslint/presets/sonar.js +225 -0
- package/configs/eslint/presets/stylistic.js +69 -0
- package/configs/eslint/presets/test.js +59 -0
- package/configs/eslint/presets/typescript.js +172 -0
- package/configs/eslint/presets/uncategorized.js +34 -0
- package/configs/prettier/README.md +65 -0
- package/configs/prettier/index.js +25 -0
- package/configs/typescript/README.md +46 -0
- package/configs/typescript/index.json +35 -0
- package/dist/index.js +761 -0
- package/package.json +48 -18
- package/{template → templates/multi-projects}/.editorconfig +1 -1
- package/templates/multi-projects/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/templates/multi-projects/.github/workflows/continuous_delivery.yml +61 -0
- package/templates/multi-projects/.github/workflows/continuous_integration.yml +9 -0
- package/templates/multi-projects/.github/workflows/conventional_commit.yml +48 -0
- package/templates/multi-projects/.github/workflows/dependency_changelog.yml +117 -0
- package/templates/multi-projects/.github/workflows/workflow.yml +39 -0
- package/templates/multi-projects/.gitignore.tmpl +134 -0
- package/templates/multi-projects/.npmrc.tmpl +8 -0
- package/templates/multi-projects/applications/README.md +6 -0
- package/templates/multi-projects/eslint.config.js.tmpl +1 -0
- package/templates/multi-projects/examples/README.md +6 -0
- package/{template → templates/multi-projects}/examples/default/package.json.tmpl +2 -2
- package/templates/multi-projects/libraries/README.md +3 -0
- package/templates/multi-projects/libraries/{{projectName}}/package.json.tmpl +39 -0
- package/templates/multi-projects/libraries/{{projectName}}/tsconfig.json +5 -0
- package/{template → templates/multi-projects}/package.json.tmpl +4 -3
- package/{template → templates/multi-projects}/pnpm-workspace.yaml.tmpl +0 -1
- package/{template → templates/multi-projects}/tools/README.md +1 -1
- package/templates/multi-projects/tsconfig.json +4 -0
- package/{template → templates/multi-projects}/turbo.json +2 -1
- package/templates/single-project/.changeset/README.md +8 -0
- package/templates/single-project/.changeset/config.json.tmpl +13 -0
- package/templates/single-project/.changeset/welcome.md.tmpl +5 -0
- package/templates/single-project/.editorconfig +4 -0
- package/templates/single-project/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
- package/templates/single-project/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/templates/single-project/.github/PULL_REQUEST_TEMPLATE.md.tmpl +29 -0
- package/templates/single-project/.github/renovate.json +69 -0
- package/templates/single-project/.github/workflows/continuous_delivery.yml +61 -0
- package/templates/single-project/.github/workflows/continuous_integration.yml +9 -0
- package/templates/single-project/.github/workflows/conventional_commit.yml +48 -0
- package/templates/single-project/.github/workflows/dependency_changelog.yml +117 -0
- package/templates/single-project/.github/workflows/workflow.yml +39 -0
- package/templates/single-project/.gitignore.tmpl +134 -0
- package/templates/single-project/.npmrc.tmpl +8 -0
- package/templates/single-project/.nvmrc.tmpl +1 -0
- package/templates/single-project/.vscode/extensions.json +8 -0
- package/templates/single-project/.vscode/settings.json +27 -0
- package/templates/single-project/CONTRIBUTING.md.tmpl +21 -0
- package/templates/single-project/LICENSE.tmpl +21 -0
- package/templates/single-project/eslint.config.js.tmpl +1 -0
- package/templates/single-project/examples/README.md +6 -0
- package/templates/single-project/examples/default/package.json.tmpl +14 -0
- package/templates/single-project/examples/default/src/index.ts.tmpl +3 -0
- package/templates/single-project/examples/default/tsconfig.json +5 -0
- package/templates/single-project/package.json.tmpl +27 -0
- package/templates/single-project/pnpm-workspace.yaml.tmpl +4 -0
- package/templates/single-project/tools/README.md +6 -0
- package/templates/single-project/tsconfig.json +4 -0
- package/templates/single-project/turbo.json +25 -0
- package/templates/single-project/{{projectName}}/README.md.tmpl +42 -0
- package/{template → templates/single-project}/{{projectName}}/package.json.tmpl +3 -5
- package/templates/single-project/{{projectName}}/src/index.test.ts.tmpl +5 -0
- package/templates/single-project/{{projectName}}/src/index.ts +1 -0
- package/bin/index.cjs +0 -7
- package/dist/index.cjs +0 -15
- package/dist/index.cjs.map +0 -7
- package/template/.commitlintrc.json +0 -3
- package/template/.eslintrc.json.tmpl +0 -3
- package/template/.github/ISSUE_TEMPLATE/config.yml +0 -4
- package/template/.github/workflows/continuous_delivery.yml +0 -49
- package/template/.github/workflows/continuous_integration.yml +0 -9
- package/template/.github/workflows/conventional_commit.yml +0 -48
- package/template/.github/workflows/dependency_changelog.yml +0 -117
- package/template/.github/workflows/workflow.yml +0 -96
- package/template/applications/README.md +0 -9
- package/template/examples/README.md +0 -6
- package/template/libraries/README.md +0 -9
- package/template/tsconfig.json +0 -3
- /package/{template → templates/multi-projects}/.changeset/README.md +0 -0
- /package/{template → templates/multi-projects}/.changeset/config.json.tmpl +0 -0
- /package/{template → templates/multi-projects}/.changeset/welcome.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- /package/{template → templates/multi-projects}/.github/PULL_REQUEST_TEMPLATE.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/.github/renovate.json +0 -0
- /package/{template → templates/multi-projects}/.nvmrc.tmpl +0 -0
- /package/{template → templates/multi-projects}/.vscode/extensions.json +0 -0
- /package/{template → templates/multi-projects}/.vscode/settings.json +0 -0
- /package/{template → templates/multi-projects}/CONTRIBUTING.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/LICENSE.tmpl +0 -0
- /package/{template → templates/multi-projects}/examples/default/src/index.ts.tmpl +0 -0
- /package/{template → templates/multi-projects}/examples/default/tsconfig.json +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/README.md.tmpl +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/src/index.test.ts.tmpl +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/src/index.ts +0 -0
- /package/{template → templates/single-project}/{{projectName}}/tsconfig.json +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import sonarjsPlugin from "eslint-plugin-sonarjs";
|
|
2
|
+
|
|
3
|
+
import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
export const config = [
|
|
6
|
+
{
|
|
7
|
+
files: JAVASCRIPT_LIKE_EXTENSIONS,
|
|
8
|
+
plugins: {
|
|
9
|
+
sonarjs: sonarjsPlugin,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"sonarjs/alt-text": "error",
|
|
13
|
+
"sonarjs/anchor-has-content": "error",
|
|
14
|
+
"sonarjs/anchor-is-valid": "error",
|
|
15
|
+
"sonarjs/anchor-precedence": "error",
|
|
16
|
+
"sonarjs/arguments-order": "error",
|
|
17
|
+
"sonarjs/arguments-usage": "error",
|
|
18
|
+
"sonarjs/array-constructor": "error",
|
|
19
|
+
"sonarjs/assertions-in-tests": "error",
|
|
20
|
+
"sonarjs/bitwise-operators": "error",
|
|
21
|
+
"sonarjs/bool-param-default": "error",
|
|
22
|
+
"sonarjs/call-argument-line": "error",
|
|
23
|
+
"sonarjs/certificate-transparency": "error",
|
|
24
|
+
"sonarjs/class-name": "error",
|
|
25
|
+
"sonarjs/class-prototype": "error",
|
|
26
|
+
"sonarjs/code-eval": "error",
|
|
27
|
+
"sonarjs/cognitive-complexity": ["error", 15], // Measure code readability (the more the code is nested, the more it's difficult to understand)
|
|
28
|
+
"sonarjs/comma-or-logical-or-case": "error",
|
|
29
|
+
"sonarjs/concise-regex": "error",
|
|
30
|
+
"sonarjs/confidential-information-logging": "error",
|
|
31
|
+
"sonarjs/constructor-for-side-effects": "error",
|
|
32
|
+
"sonarjs/content-length": "error",
|
|
33
|
+
"sonarjs/content-security-policy": "error",
|
|
34
|
+
"sonarjs/cookie-no-httponly": "error",
|
|
35
|
+
"sonarjs/cors": "error",
|
|
36
|
+
"sonarjs/csrf": "error",
|
|
37
|
+
"sonarjs/cyclomatic-complexity": ["error", { threshold: 10 }], // Measure code testability (the more paths are, the more test cases need to be implemented)
|
|
38
|
+
"sonarjs/different-types-comparison": "error",
|
|
39
|
+
"sonarjs/disabled-auto-escaping": "error",
|
|
40
|
+
"sonarjs/disabled-resource-integrity": "error",
|
|
41
|
+
"sonarjs/duplicates-in-character-class": "error",
|
|
42
|
+
"sonarjs/elseif-without-else": "error",
|
|
43
|
+
"sonarjs/empty-string-repetition": "error",
|
|
44
|
+
"sonarjs/encryption-secure-mode": "error",
|
|
45
|
+
"sonarjs/existing-groups": "error",
|
|
46
|
+
"sonarjs/expression-complexity": ["error", { max: 3 }],
|
|
47
|
+
"sonarjs/file-name-differ-from-class": "error",
|
|
48
|
+
"sonarjs/file-permissions": "error",
|
|
49
|
+
"sonarjs/file-uploads": "error",
|
|
50
|
+
"sonarjs/fixme-tag": "error",
|
|
51
|
+
"sonarjs/for-in": "error",
|
|
52
|
+
"sonarjs/for-loop-increment-sign": "error",
|
|
53
|
+
"sonarjs/frame-ancestors": "error",
|
|
54
|
+
"sonarjs/function-inside-loop": "error",
|
|
55
|
+
"sonarjs/function-name": "error",
|
|
56
|
+
"sonarjs/generator-without-yield": "error",
|
|
57
|
+
"sonarjs/hashing": "error",
|
|
58
|
+
"sonarjs/hidden-files": "error",
|
|
59
|
+
"sonarjs/html-has-lang": "error",
|
|
60
|
+
"sonarjs/in-operator-type-error": "error",
|
|
61
|
+
"sonarjs/inconsistent-function-call": "error",
|
|
62
|
+
"sonarjs/index-of-compare-to-positive-number": "error",
|
|
63
|
+
"sonarjs/insecure-cookie": "error",
|
|
64
|
+
"sonarjs/insecure-jwt-token": "error",
|
|
65
|
+
"sonarjs/inverted-assertion-arguments": "error",
|
|
66
|
+
"sonarjs/label-has-associated-control": "error",
|
|
67
|
+
"sonarjs/label-position": "error",
|
|
68
|
+
"sonarjs/link-with-target-blank": "error",
|
|
69
|
+
"sonarjs/max-switch-cases": "error",
|
|
70
|
+
"sonarjs/media-has-caption": "error",
|
|
71
|
+
"sonarjs/misplaced-loop-counter": "error",
|
|
72
|
+
"sonarjs/mouse-events-a11y": "error",
|
|
73
|
+
"sonarjs/new-cap": "error",
|
|
74
|
+
"sonarjs/new-operator-misuse": "error",
|
|
75
|
+
"sonarjs/no-all-duplicated-branches": "error",
|
|
76
|
+
"sonarjs/no-alphabetical-sort": "error",
|
|
77
|
+
"sonarjs/no-angular-bypass-sanitization": "error",
|
|
78
|
+
"sonarjs/no-array-delete": "error",
|
|
79
|
+
"sonarjs/no-array-index-key": "error",
|
|
80
|
+
"sonarjs/no-associative-arrays": "error",
|
|
81
|
+
"sonarjs/no-async-constructor": "error",
|
|
82
|
+
"sonarjs/no-base-to-string": "error",
|
|
83
|
+
"sonarjs/no-case-label-in-switch": "error",
|
|
84
|
+
"sonarjs/no-clear-text-protocols": "error",
|
|
85
|
+
"sonarjs/no-code-after-done": "error",
|
|
86
|
+
"sonarjs/no-collection-size-mischeck": "error",
|
|
87
|
+
"sonarjs/no-commented-code": "error",
|
|
88
|
+
"sonarjs/no-dead-store": "error",
|
|
89
|
+
"sonarjs/no-delete-var": "error",
|
|
90
|
+
"sonarjs/no-duplicate-in-composite": "error",
|
|
91
|
+
"sonarjs/no-duplicated-branches": "error",
|
|
92
|
+
"sonarjs/no-element-overwrite": "error",
|
|
93
|
+
"sonarjs/no-empty-after-reluctant": "error",
|
|
94
|
+
"sonarjs/no-empty-alternatives": "error",
|
|
95
|
+
"sonarjs/no-empty-collection": "error",
|
|
96
|
+
"sonarjs/no-empty-group": "error",
|
|
97
|
+
"sonarjs/no-empty-test-file": "error",
|
|
98
|
+
"sonarjs/no-equals-in-for-termination": "error",
|
|
99
|
+
"sonarjs/no-exclusive-tests": "error",
|
|
100
|
+
"sonarjs/no-extend-native": "error",
|
|
101
|
+
"sonarjs/no-extra-arguments": "error",
|
|
102
|
+
"sonarjs/no-global-this": "error",
|
|
103
|
+
"sonarjs/no-globals-shadowing": "error",
|
|
104
|
+
"sonarjs/no-gratuitous-expressions": "error",
|
|
105
|
+
"sonarjs/no-hardcoded-credentials": "error",
|
|
106
|
+
"sonarjs/no-hardcoded-ip": "error",
|
|
107
|
+
"sonarjs/no-hook-setter-in-body": "error",
|
|
108
|
+
"sonarjs/no-identical-conditions": "error",
|
|
109
|
+
"sonarjs/no-identical-expressions": "error",
|
|
110
|
+
"sonarjs/no-identical-functions": "error",
|
|
111
|
+
"sonarjs/no-ignored-exceptions": "error",
|
|
112
|
+
"sonarjs/no-ignored-return": "error",
|
|
113
|
+
"sonarjs/no-implicit-dependencies": "error",
|
|
114
|
+
"sonarjs/no-implicit-global": "error",
|
|
115
|
+
"sonarjs/no-in-misuse": "error",
|
|
116
|
+
"sonarjs/no-incomplete-assertions": "error",
|
|
117
|
+
"sonarjs/no-incorrect-string-concat": "error",
|
|
118
|
+
"sonarjs/no-infinite-loop": "error",
|
|
119
|
+
"sonarjs/no-internal-api-use": "error",
|
|
120
|
+
"sonarjs/no-intrusive-permissions": "error",
|
|
121
|
+
"sonarjs/no-invalid-await": "error",
|
|
122
|
+
"sonarjs/no-invariant-returns": "error",
|
|
123
|
+
"sonarjs/no-inverted-boolean-check": "error",
|
|
124
|
+
"sonarjs/no-ip-forward": "error",
|
|
125
|
+
"sonarjs/no-labels": "error",
|
|
126
|
+
"sonarjs/no-lonely-if": "error",
|
|
127
|
+
"sonarjs/no-mime-sniff": "error",
|
|
128
|
+
"sonarjs/no-misleading-array-reverse": "error",
|
|
129
|
+
"sonarjs/no-misused-promises": "error",
|
|
130
|
+
"sonarjs/no-mixed-content": "error",
|
|
131
|
+
"sonarjs/no-nested-assignment": "error",
|
|
132
|
+
"sonarjs/no-nested-functions": "error",
|
|
133
|
+
"sonarjs/no-nested-incdec": "error",
|
|
134
|
+
"sonarjs/no-nested-switch": "error",
|
|
135
|
+
"sonarjs/no-nested-template-literals": "error",
|
|
136
|
+
"sonarjs/no-one-iteration-loop": "error",
|
|
137
|
+
"sonarjs/no-os-command-from-path": "error",
|
|
138
|
+
"sonarjs/no-parameter-reassignment": "error",
|
|
139
|
+
"sonarjs/no-primitive-wrappers": "error",
|
|
140
|
+
"sonarjs/no-redundant-assignments": "error",
|
|
141
|
+
"sonarjs/no-redundant-boolean": "error",
|
|
142
|
+
"sonarjs/no-redundant-jump": "error",
|
|
143
|
+
"sonarjs/no-referrer-policy": "error",
|
|
144
|
+
"sonarjs/no-same-argument-assert": "error",
|
|
145
|
+
"sonarjs/no-selector-parameter": "error",
|
|
146
|
+
"sonarjs/no-self-compare": "error",
|
|
147
|
+
"sonarjs/no-self-import": "error",
|
|
148
|
+
"sonarjs/no-small-switch": "error",
|
|
149
|
+
"sonarjs/no-table-as-layout": "error",
|
|
150
|
+
"sonarjs/no-undefined-argument": "error",
|
|
151
|
+
"sonarjs/no-unenclosed-multiline-block": "error",
|
|
152
|
+
"sonarjs/no-uniq-key": "error",
|
|
153
|
+
"sonarjs/no-unsafe-unzip": "error",
|
|
154
|
+
"sonarjs/no-unstable-nested-components": "error",
|
|
155
|
+
"sonarjs/no-unthrown-error": "error",
|
|
156
|
+
"sonarjs/no-unused-collection": "error",
|
|
157
|
+
"sonarjs/no-useless-call": "error",
|
|
158
|
+
"sonarjs/no-useless-increment": "error",
|
|
159
|
+
"sonarjs/no-useless-intersection": "error",
|
|
160
|
+
"sonarjs/no-useless-react-setstate": "error",
|
|
161
|
+
"sonarjs/no-vue-bypass-sanitization": "error",
|
|
162
|
+
"sonarjs/no-weak-cipher": "error",
|
|
163
|
+
"sonarjs/no-weak-keys": "error",
|
|
164
|
+
"sonarjs/non-existent-operator": "error",
|
|
165
|
+
"sonarjs/null-dereference": "error",
|
|
166
|
+
"sonarjs/object-alt-content": "error",
|
|
167
|
+
"sonarjs/os-command": "error",
|
|
168
|
+
"sonarjs/post-message": "error",
|
|
169
|
+
"sonarjs/prefer-default-last": "error",
|
|
170
|
+
"sonarjs/prefer-enum-initializers": "error",
|
|
171
|
+
"sonarjs/prefer-function-type": "error",
|
|
172
|
+
"sonarjs/prefer-immediate-return": "error",
|
|
173
|
+
"sonarjs/prefer-namespace-keyword": "error",
|
|
174
|
+
"sonarjs/prefer-object-literal": "error",
|
|
175
|
+
"sonarjs/prefer-object-spread": "error",
|
|
176
|
+
"sonarjs/prefer-promise-shorthand": "error",
|
|
177
|
+
"sonarjs/prefer-single-boolean-return": "error",
|
|
178
|
+
"sonarjs/prefer-type-guard": "error",
|
|
179
|
+
"sonarjs/prefer-while": "error",
|
|
180
|
+
"sonarjs/production-debug": "error",
|
|
181
|
+
"sonarjs/pseudo-random": "error",
|
|
182
|
+
"sonarjs/public-static-readonly": "error",
|
|
183
|
+
"sonarjs/publicly-writable-directories": "error",
|
|
184
|
+
"sonarjs/reduce-initial-value": "error",
|
|
185
|
+
"sonarjs/session-regeneration": "error",
|
|
186
|
+
"sonarjs/single-char-in-character-classes": "error",
|
|
187
|
+
"sonarjs/single-character-alternation": "error",
|
|
188
|
+
"sonarjs/sonar-jsx-no-leaked-render": "error",
|
|
189
|
+
"sonarjs/sonar-max-lines": ["error", { maximum: 1000 }],
|
|
190
|
+
"sonarjs/sonar-max-lines-per-function": ["error", { maximum: 200 }],
|
|
191
|
+
"sonarjs/sonar-max-params": ["error", { max: 4 }],
|
|
192
|
+
"sonarjs/sonar-no-control-regex": "error",
|
|
193
|
+
"sonarjs/sonar-no-empty-character-class": "error",
|
|
194
|
+
"sonarjs/sonar-no-fallthrough": "error",
|
|
195
|
+
"sonarjs/sonar-no-invalid-regexp": "error",
|
|
196
|
+
"sonarjs/sonar-no-magic-numbers": "error",
|
|
197
|
+
"sonarjs/sonar-no-misleading-character-class": "error",
|
|
198
|
+
"sonarjs/sonar-no-regex-spaces": "error",
|
|
199
|
+
"sonarjs/sonar-no-unused-class-component-methods": "error",
|
|
200
|
+
"sonarjs/sonar-prefer-regexp-exec": "error",
|
|
201
|
+
"sonarjs/sql-queries": "error",
|
|
202
|
+
"sonarjs/stable-tests": "error",
|
|
203
|
+
"sonarjs/stateful-regex": "error",
|
|
204
|
+
"sonarjs/strict-transport-security": "error",
|
|
205
|
+
"sonarjs/super-invocation": "error",
|
|
206
|
+
"sonarjs/switch-without-default": "error",
|
|
207
|
+
"sonarjs/table-header": "error",
|
|
208
|
+
"sonarjs/table-header-reference": "error",
|
|
209
|
+
"sonarjs/test-check-exception": "error",
|
|
210
|
+
"sonarjs/todo-tag": "warn",
|
|
211
|
+
"sonarjs/unicode-aware-regex": "error",
|
|
212
|
+
"sonarjs/unnecessary-character-escapes": "error",
|
|
213
|
+
"sonarjs/unused-named-groups": "error",
|
|
214
|
+
"sonarjs/unverified-certificate": "error",
|
|
215
|
+
"sonarjs/unverified-hostname": "error",
|
|
216
|
+
"sonarjs/updated-loop-counter": "error",
|
|
217
|
+
"sonarjs/use-isnan": "error",
|
|
218
|
+
"sonarjs/use-type-alias": "error",
|
|
219
|
+
"sonarjs/void-use": "error",
|
|
220
|
+
"sonarjs/weak-ssl": "error",
|
|
221
|
+
"sonarjs/x-powered-by": "error",
|
|
222
|
+
"sonarjs/xml-parser-xxe": "error",
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
2
|
+
|
|
3
|
+
import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
export const config = [
|
|
6
|
+
{
|
|
7
|
+
files: JAVASCRIPT_LIKE_EXTENSIONS,
|
|
8
|
+
plugins: {
|
|
9
|
+
"@stylistic": stylistic,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"@stylistic/lines-between-class-members": ["error", "always"],
|
|
13
|
+
"@stylistic/multiline-comment-style": ["error", "starred-block"],
|
|
14
|
+
"@stylistic/padding-line-between-statements": [
|
|
15
|
+
"error",
|
|
16
|
+
{
|
|
17
|
+
blankLine: "always",
|
|
18
|
+
next: "*",
|
|
19
|
+
prev: "*",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
blankLine: "never",
|
|
23
|
+
next: ["const", "let", "var"],
|
|
24
|
+
prev: ["const", "let", "var"],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
blankLine: "never",
|
|
28
|
+
next: ["case", "default"],
|
|
29
|
+
prev: ["case", "default"],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
blankLine: "always",
|
|
33
|
+
next: ["const", "let", "var"],
|
|
34
|
+
prev: ["multiline-const", "multiline-let", "multiline-var"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
blankLine: "always",
|
|
38
|
+
next: ["multiline-const", "multiline-let", "multiline-var"],
|
|
39
|
+
prev: ["const", "let", "var"],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
blankLine: "any",
|
|
43
|
+
next: ["expression"],
|
|
44
|
+
prev: ["expression"],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
blankLine: "any",
|
|
48
|
+
next: ["const", "let", "var"],
|
|
49
|
+
prev: ["cjs-import"],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
blankLine: "any",
|
|
53
|
+
next: ["cjs-import", "import"],
|
|
54
|
+
prev: ["cjs-import", "import"],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
blankLine: "any",
|
|
58
|
+
next: ["cjs-export", "export"],
|
|
59
|
+
prev: ["cjs-export", "export"],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
"@stylistic/spaced-comment": [
|
|
63
|
+
"error",
|
|
64
|
+
"always",
|
|
65
|
+
{ block: { balanced: true } },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import jestFormattingPlugin from "eslint-plugin-jest-formatting";
|
|
2
|
+
import vitestPlugin from "@vitest/eslint-plugin";
|
|
3
|
+
|
|
4
|
+
export const config = [
|
|
5
|
+
{
|
|
6
|
+
files: [
|
|
7
|
+
"**/test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
|
|
8
|
+
"**/*.test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
|
|
9
|
+
],
|
|
10
|
+
plugins: {
|
|
11
|
+
"jest-formatting": jestFormattingPlugin,
|
|
12
|
+
"vitest": vitestPlugin,
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
"jest-formatting/padding-around-all": "error",
|
|
16
|
+
"vitest/consistent-test-it": [
|
|
17
|
+
"error",
|
|
18
|
+
{ fn: "test", withinDescribe: "test" },
|
|
19
|
+
],
|
|
20
|
+
"vitest/expect-expect": "error",
|
|
21
|
+
"vitest/max-nested-describe": ["error", { max: 1 }],
|
|
22
|
+
"vitest/no-alias-methods": "error",
|
|
23
|
+
"vitest/no-commented-out-tests": "error",
|
|
24
|
+
"vitest/no-conditional-expect": "error",
|
|
25
|
+
"vitest/no-conditional-in-test": "error",
|
|
26
|
+
"vitest/no-conditional-tests": "error",
|
|
27
|
+
"vitest/no-disabled-tests": "error",
|
|
28
|
+
"vitest/no-done-callback": "error",
|
|
29
|
+
"vitest/no-duplicate-hooks": "error",
|
|
30
|
+
"vitest/no-focused-tests": "error",
|
|
31
|
+
"vitest/no-identical-title": "error",
|
|
32
|
+
"vitest/no-import-node-test": "error",
|
|
33
|
+
"vitest/no-mocks-import": "error",
|
|
34
|
+
"vitest/no-standalone-expect": "error",
|
|
35
|
+
"vitest/no-test-return-statement": "error",
|
|
36
|
+
"vitest/prefer-called-with": "error",
|
|
37
|
+
"vitest/prefer-comparison-matcher": "error",
|
|
38
|
+
"vitest/prefer-each": "error",
|
|
39
|
+
"vitest/prefer-equality-matcher": "error",
|
|
40
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
41
|
+
"vitest/prefer-hooks-on-top": "error",
|
|
42
|
+
"vitest/prefer-lowercase-title": "error",
|
|
43
|
+
"vitest/prefer-mock-promise-shorthand": "error",
|
|
44
|
+
"vitest/prefer-strict-equal": "error",
|
|
45
|
+
"vitest/prefer-to-be": "error",
|
|
46
|
+
"vitest/prefer-to-be-object": "error",
|
|
47
|
+
"vitest/prefer-to-contain": "error",
|
|
48
|
+
"vitest/prefer-to-have-length": "error",
|
|
49
|
+
"vitest/prefer-todo": "error",
|
|
50
|
+
"vitest/require-hook": "error",
|
|
51
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
52
|
+
"vitest/require-to-throw-message": "error",
|
|
53
|
+
"vitest/require-top-level-describe": "error",
|
|
54
|
+
"vitest/valid-describe-callback": "error",
|
|
55
|
+
"vitest/valid-expect": "error",
|
|
56
|
+
"vitest/valid-title": ["error", { mustMatch: { test: ["^should "] } }],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
];
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import tseslint from "typescript-eslint";
|
|
2
|
+
|
|
3
|
+
import { CWD, JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
export const config = [
|
|
6
|
+
{
|
|
7
|
+
files: JAVASCRIPT_LIKE_EXTENSIONS,
|
|
8
|
+
languageOptions: {
|
|
9
|
+
parser: tseslint.parser,
|
|
10
|
+
parserOptions: {
|
|
11
|
+
project: "./tsconfig.json",
|
|
12
|
+
tsconfigRootDir: CWD,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
plugins: {
|
|
16
|
+
"@typescript-eslint": tseslint.plugin,
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
20
|
+
// https://www.totaltypescript.com/array-types-in-typescript
|
|
21
|
+
"@typescript-eslint/array-type": [
|
|
22
|
+
"error",
|
|
23
|
+
{ default: "array", readonly: "array" },
|
|
24
|
+
],
|
|
25
|
+
"@typescript-eslint/await-thenable": "error",
|
|
26
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
"minimumDescriptionLength": 3,
|
|
30
|
+
"ts-check": false,
|
|
31
|
+
"ts-expect-error": "allow-with-description",
|
|
32
|
+
"ts-ignore": "allow-with-description",
|
|
33
|
+
"ts-nocheck": "allow-with-description",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
37
|
+
"@typescript-eslint/class-literal-property-style": ["error", "fields"],
|
|
38
|
+
"@typescript-eslint/class-methods-use-this": "error",
|
|
39
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
40
|
+
"error",
|
|
41
|
+
"constructor",
|
|
42
|
+
],
|
|
43
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
|
44
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
45
|
+
"error",
|
|
46
|
+
{
|
|
47
|
+
assertionStyle: "as",
|
|
48
|
+
objectLiteralTypeAssertions: "allow-as-parameter",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
// https://www.totaltypescript.com/type-vs-interface-which-should-you-use
|
|
52
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
53
|
+
"@typescript-eslint/consistent-type-exports": [
|
|
54
|
+
"error",
|
|
55
|
+
{ fixMixedExportsWithInlineTypeSpecifier: false },
|
|
56
|
+
],
|
|
57
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
58
|
+
"error",
|
|
59
|
+
{
|
|
60
|
+
disallowTypeAnnotations: true,
|
|
61
|
+
fixStyle: "separate-type-imports",
|
|
62
|
+
prefer: "type-imports",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
"@typescript-eslint/default-param-last": "error",
|
|
66
|
+
"@typescript-eslint/dot-notation": "error",
|
|
67
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
68
|
+
"error",
|
|
69
|
+
{ accessibility: "explicit" },
|
|
70
|
+
],
|
|
71
|
+
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
72
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
73
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
74
|
+
"@typescript-eslint/no-base-to-string": "error",
|
|
75
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
76
|
+
"@typescript-eslint/no-confusing-void-expression": "error",
|
|
77
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
78
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
79
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
80
|
+
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
81
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
82
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
83
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
84
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
85
|
+
"@typescript-eslint/no-explicit-any": [
|
|
86
|
+
"error",
|
|
87
|
+
{ fixToUnknown: true, ignoreRestArgs: false },
|
|
88
|
+
],
|
|
89
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
90
|
+
"@typescript-eslint/no-extraneous-class": "error",
|
|
91
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
92
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
93
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
94
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
95
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
96
|
+
"@typescript-eslint/no-invalid-this": "error",
|
|
97
|
+
"@typescript-eslint/no-invalid-void-type": "error",
|
|
98
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
99
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
100
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
101
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
102
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
103
|
+
"@typescript-eslint/no-namespace": "error",
|
|
104
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
105
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
106
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
107
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
108
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
109
|
+
"@typescript-eslint/no-shadow": "error",
|
|
110
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
111
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
112
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
113
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
114
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
115
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
116
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
117
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
118
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
119
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
120
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
121
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
122
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
123
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
124
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
125
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
126
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
127
|
+
"@typescript-eslint/no-unused-vars": [
|
|
128
|
+
"error",
|
|
129
|
+
{ ignoreRestSiblings: true },
|
|
130
|
+
],
|
|
131
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
132
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
133
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
134
|
+
"@typescript-eslint/only-throw-error": "error",
|
|
135
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
136
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
137
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
138
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
139
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
140
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
141
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
142
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
143
|
+
"@typescript-eslint/prefer-promise-reject-errors": "error",
|
|
144
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
145
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
146
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
147
|
+
"@typescript-eslint/prefer-return-this-type": "error",
|
|
148
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
149
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
150
|
+
"@typescript-eslint/promise-function-async": "error",
|
|
151
|
+
"@typescript-eslint/require-await": "error",
|
|
152
|
+
"@typescript-eslint/restrict-plus-operands": [
|
|
153
|
+
"error",
|
|
154
|
+
{
|
|
155
|
+
allowAny: false,
|
|
156
|
+
allowBoolean: false,
|
|
157
|
+
allowNullish: false,
|
|
158
|
+
allowNumberAndString: false,
|
|
159
|
+
allowRegExp: false,
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
163
|
+
"@typescript-eslint/return-await": "error",
|
|
164
|
+
"@typescript-eslint/sort-type-constituents": "error",
|
|
165
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
166
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
167
|
+
"@typescript-eslint/unbound-method": "error",
|
|
168
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
169
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import sortKeysCustomOrderPlugin from "eslint-plugin-sort-keys-custom-order";
|
|
2
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
3
|
+
|
|
4
|
+
import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
|
|
5
|
+
|
|
6
|
+
export const config = [
|
|
7
|
+
{
|
|
8
|
+
files: JAVASCRIPT_LIKE_EXTENSIONS,
|
|
9
|
+
plugins: {
|
|
10
|
+
"sort-keys-custom-order": sortKeysCustomOrderPlugin,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
"sort-keys-custom-order/object-keys": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
orderedKeys: ["id", "key", "name", "title", "label", "description"],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"sort-keys-custom-order/type-keys": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
orderedKeys: ["id", "key", "name", "title", "label", "description"],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
...new FlatCompat().extends("plugin:mdx/recommended").map((mdxConfig) => ({
|
|
28
|
+
...mdxConfig,
|
|
29
|
+
files: ["**/*.{md,mdx}"],
|
|
30
|
+
settings: {
|
|
31
|
+
"mdx/code-blocks": true,
|
|
32
|
+
},
|
|
33
|
+
})),
|
|
34
|
+
];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<br>
|
|
2
|
+
<div align="center">
|
|
3
|
+
<h1>@adbayb/stack/prettier</h1>
|
|
4
|
+
<strong>My opinionated formatting standards</strong>
|
|
5
|
+
</div>
|
|
6
|
+
<br>
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
This package offers opinionated but extensible **[Prettier](https://prettier.io/)** configurations to align code formatting conventions across projects.
|
|
12
|
+
|
|
13
|
+
It allows to:
|
|
14
|
+
|
|
15
|
+
- Make collaboration across my projects effective (including onboarding with a consistent look and writing patterns).
|
|
16
|
+
- Include a minimum viable and required set of rules to foster maintainable, testable, secure, and green code over time.
|
|
17
|
+
- Accelerate development by reusing common configuration and convention defaults.
|
|
18
|
+
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
### 1️⃣ Installation
|
|
24
|
+
|
|
25
|
+
At the root level of your project, run the following command:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @adbayb/stack --save-dev --workspace-root
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2️⃣ Usage
|
|
32
|
+
|
|
33
|
+
Edit the root `package.json` file to include the following:
|
|
34
|
+
|
|
35
|
+
```jsonc
|
|
36
|
+
{
|
|
37
|
+
"scripts": {
|
|
38
|
+
"check:format": "prettier \"**/!(pnpm-lock.yaml)\" --check --ignore-unknown --ignore-path .gitignore --log-level warn",
|
|
39
|
+
"fix:format": "pnpm check:format --write",
|
|
40
|
+
// ...
|
|
41
|
+
},
|
|
42
|
+
"prettier": "@adbayb/stack/prettier",
|
|
43
|
+
// ...
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<br />
|
|
48
|
+
|
|
49
|
+
## 🤷♂️ Questions
|
|
50
|
+
|
|
51
|
+
### The tab size takes too much space, how to reduce it?
|
|
52
|
+
|
|
53
|
+
If you feel that tabbed indentation rendered on the GitHub web interface takes up too much (by default, most browsers display a tab character as 8 spaces), you can either:
|
|
54
|
+
|
|
55
|
+
- Edit your [GitHub profile appearance settings](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-user-account-settings/managing-your-tab-size-rendering-preference).
|
|
56
|
+
- Add (or update) a `.editorconfig` file at the root level to customize the tab size display on the GitHub interface.
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
root = true
|
|
60
|
+
|
|
61
|
+
[*]
|
|
62
|
+
indent_size = 2 # Depending on your tab indentation size preference.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<br />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import("prettier").Config}
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
arrowParens: "always",
|
|
6
|
+
bracketSameLine: false,
|
|
7
|
+
bracketSpacing: true,
|
|
8
|
+
embeddedLanguageFormatting: "auto",
|
|
9
|
+
endOfLine: "lf",
|
|
10
|
+
htmlWhitespaceSensitivity: "css",
|
|
11
|
+
insertPragma: false,
|
|
12
|
+
jsxSingleQuote: false,
|
|
13
|
+
plugins: [],
|
|
14
|
+
printWidth: 80,
|
|
15
|
+
proseWrap: "preserve",
|
|
16
|
+
quoteProps: "consistent",
|
|
17
|
+
requirePragma: false,
|
|
18
|
+
semi: true,
|
|
19
|
+
singleAttributePerLine: true,
|
|
20
|
+
singleQuote: false,
|
|
21
|
+
tabWidth: 2,
|
|
22
|
+
trailingComma: "all",
|
|
23
|
+
useTabs: true,
|
|
24
|
+
vueIndentScriptAndStyle: false,
|
|
25
|
+
};
|