Project Cleanup and Organization #26
+24
-1
@@ -10,6 +10,10 @@
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# npm cache (should never be committed)
|
||||
.npm-cache/
|
||||
npm-cache/
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
@@ -17,6 +21,9 @@
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
|
||||
# Lighthouse CI results
|
||||
/lhci-results/
|
||||
|
||||
# Ignore other image files (but not visual regression snapshots)
|
||||
*.png
|
||||
*.jpg
|
||||
@@ -40,9 +47,15 @@
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
@@ -57,6 +70,7 @@ yarn-error.log*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
tsconfig.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
*storybook.log
|
||||
@@ -65,3 +79,12 @@ storybook-static
|
||||
# storybook config files (to avoid git changes when switching between local and production)
|
||||
.storybook/main.js
|
||||
.storybook/preview.js
|
||||
|
||||
# Gitea runner runtime files
|
||||
.runner
|
||||
.runner.pid
|
||||
act_runner
|
||||
|
||||
# OS files
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
||||
+80
-8
@@ -1,23 +1,95 @@
|
||||
{
|
||||
"ci": {
|
||||
"collect": {
|
||||
"url": ["http://127.0.0.1:3010/"],
|
||||
"url": [
|
||||
"http://127.0.0.1:3010/",
|
||||
"http://127.0.0.1:3010/blog",
|
||||
"http://127.0.0.1:3010/blog/resolving-active-conflicts"
|
||||
],
|
||||
"numberOfRuns": 3,
|
||||
"settings": {
|
||||
"chromeFlags": "--no-sandbox --disable-dev-shm-usage --disable-gpu --headless"
|
||||
"preset": "desktop",
|
||||
"throttling": {
|
||||
"rttMs": 40,
|
||||
"throughputKbps": 10240,
|
||||
"cpuSlowdownMultiplier": 1,
|
||||
"requestLatencyMs": 0,
|
||||
"downloadThroughputKbps": 0,
|
||||
"uploadThroughputKbps": 0
|
||||
},
|
||||
"chromeFlags": [
|
||||
"--disable-web-security",
|
||||
"--disable-features=VizDisplayCompositor",
|
||||
"--ignore-certificate-errors",
|
||||
"--ignore-ssl-errors",
|
||||
"--ignore-certificate-errors-spki-list",
|
||||
"--allow-running-insecure-content",
|
||||
"--disable-extensions",
|
||||
"--no-sandbox",
|
||||
"--disable-setuid-sandbox",
|
||||
"--disable-dev-shm-usage",
|
||||
"--disable-gpu",
|
||||
"--headless"
|
||||
]
|
||||
}
|
||||
},
|
||||
"assert": {
|
||||
"assertions": {
|
||||
"categories:performance": ["warn", { "minScore": 0.8 }],
|
||||
"categories:accessibility": ["warn", { "minScore": 0.8 }],
|
||||
"first-contentful-paint": ["warn", { "maxNumericValue": 3000 }],
|
||||
"interactive": ["warn", { "maxNumericValue": 5000 }]
|
||||
"categories:performance": ["error", { "minScore": 0.9 }],
|
||||
"categories:accessibility": ["warn", { "minScore": 0.95 }],
|
||||
"categories:best-practices": ["warn", { "minScore": 0.9 }],
|
||||
"categories:seo": ["warn", { "minScore": 0.9 }],
|
||||
"first-contentful-paint": ["warn", { "maxNumericValue": 2000 }],
|
||||
"largest-contentful-paint": ["warn", { "maxNumericValue": 2500 }],
|
||||
"first-meaningful-paint": ["warn", { "maxNumericValue": 2000 }],
|
||||
"speed-index": ["warn", { "maxNumericValue": 3000 }],
|
||||
"interactive": ["warn", { "maxNumericValue": 3000 }],
|
||||
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
|
||||
"cumulative-layout-shift": ["warn", { "maxNumericValue": 0.1 }],
|
||||
"max-potential-fid": ["warn", { "maxNumericValue": 130 }],
|
||||
"server-response-time": ["warn", { "maxNumericValue": 600 }],
|
||||
"render-blocking-resources": ["warn", { "maxLength": 0 }],
|
||||
"unused-css-rules": ["warn", { "maxLength": 0 }],
|
||||
"unused-javascript": ["warn", { "maxLength": 0 }],
|
||||
"modern-image-formats": ["warn", { "maxLength": 0 }],
|
||||
"uses-optimized-images": ["warn", { "maxLength": 0 }],
|
||||
"uses-text-compression": ["warn", { "maxLength": 0 }],
|
||||
"uses-responsive-images": ["warn", { "maxLength": 0 }],
|
||||
"efficient-animated-content": ["warn", { "maxLength": 0 }],
|
||||
"preload-lcp-image": ["warn", { "maxLength": 0 }],
|
||||
"total-byte-weight": ["warn", { "maxNumericValue": 500000 }],
|
||||
"uses-long-cache-ttl": ["warn", { "maxLength": 0 }],
|
||||
"dom-size": ["warn", { "maxNumericValue": 1500 }],
|
||||
"critical-request-chains": ["warn", { "maxLength": 0 }],
|
||||
"user-timings": ["warn", { "maxLength": 0 }],
|
||||
"bootup-time": ["warn", { "maxNumericValue": 1000 }],
|
||||
"mainthread-work-breakdown": ["warn", { "maxLength": 0 }],
|
||||
"font-display": ["warn", { "maxLength": 0 }],
|
||||
"resource-summary": ["warn", { "maxLength": 0 }],
|
||||
"third-party-summary": ["warn", { "maxLength": 0 }],
|
||||
"largest-contentful-paint-element": ["warn", { "maxLength": 0 }],
|
||||
"layout-shift-elements": ["warn", { "maxLength": 0 }],
|
||||
"long-tasks": ["warn", { "maxLength": 0 }],
|
||||
"non-composited-animations": ["warn", { "maxLength": 0 }],
|
||||
"unsized-images": ["warn", { "maxLength": 0 }]
|
||||
}
|
||||
},
|
||||
"upload": {
|
||||
"target": "filesystem",
|
||||
"outputDir": "lhci-results"
|
||||
"target": "temporary-public-storage",
|
||||
"outputDir": "./lighthouse-results"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"onlyCategories": ["performance", "accessibility", "best-practices", "seo"],
|
||||
"skipAudits": ["uses-http2"],
|
||||
"formFactor": "desktop",
|
||||
"throttling": {
|
||||
"rttMs": 40,
|
||||
"throughputKbps": 10240,
|
||||
"cpuSlowdownMultiplier": 1,
|
||||
"requestLatencyMs": 0,
|
||||
"downloadThroughputKbps": 0,
|
||||
"uploadThroughputKbps": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
-2
@@ -1,2 +0,0 @@
|
||||
|
||||
69fac7faa40107339e1a7882984c15d963d97643 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz","integrity":"sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==","time":1765469060972,"size":2182973,"metadata":{"time":1765469060779,"url":"https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz","reqHeaders":{},"resHeaders":{"cache-control":"public, immutable, max-age=31557600","content-type":"application/octet-stream","date":"Thu, 11 Dec 2025 16:04:20 GMT","etag":"\"924eeee9d36e511ef6c7ddc8e19c6362\"","last-modified":"Wed, 03 Dec 2025 04:35:25 GMT","vary":"Accept-Encoding"},"options":{"compress":true}}}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
|
||||
fdd7567bfebbd4aeeca3079769824eebfb85a415 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/prettier","integrity":"sha512-sOi5vnANiJgqKg3QGjCoFe+HKxAMYysTQsbTQ/2VwT06qWABnhqsxjuHtvNFQ4Fg+zyO23xM0sczwTOshsWPgw==","time":1765469060369,"size":214021,"metadata":{"time":1765469060357,"url":"https://registry.npmjs.org/prettier","reqHeaders":{"accept":"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},"resHeaders":{"cache-control":"public, max-age=300","content-encoding":"gzip","content-type":"application/vnd.npm.install-v1+json","date":"Thu, 11 Dec 2025 16:04:20 GMT","etag":"W/\"632a0a6a03b15ed7b9e899fa745be81c\"","last-modified":"Wed, 03 Dec 2025 04:35:25 GMT","vary":"accept-encoding, accept"},"options":{"compress":true}}}
|
||||
2338d9920f2010a709e5b23cac3996dc304ae877 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/prettier","integrity":"sha512-qI1KIhqVI6/z+dhm/M0sNoXTx9kdSlL6IXY5INgn8huH6Z+Cpt7C1ERXY/nYxx9BppuJyrFqNcutZ74k/dCogA==","time":1765469060648,"size":642387,"metadata":{"time":1765469060638,"url":"https://registry.npmjs.org/prettier","reqHeaders":{"accept":"application/json"},"resHeaders":{"cache-control":"public, max-age=300","content-encoding":"gzip","content-type":"application/json","date":"Thu, 11 Dec 2025 16:04:20 GMT","etag":"W/\"0d46398e4d0387ebb8ac788fc4a6de3f\"","last-modified":"Wed, 03 Dec 2025 04:35:25 GMT","vary":"accept-encoding, accept"},"options":{"compress":true}}}
|
||||
@@ -1,35 +0,0 @@
|
||||
0 verbose cli /Users/Vinod/.nvm/versions/node/v18.20.8/bin/node /Users/Vinod/.nvm/versions/node/v18.20.8/lib/node_modules/npm/bin/npm-cli.js
|
||||
1 info using npm@10.8.2
|
||||
2 info using node@v18.20.8
|
||||
3 silly config load:file:/Users/Vinod/.nvm/versions/node/v18.20.8/lib/node_modules/npm/npmrc
|
||||
4 silly config load:file:/Users/Vinod/Documents/GitHub/community-rule/.npmrc
|
||||
5 silly config load:file:/Users/Vinod/.npmrc
|
||||
6 silly config load:file:/Users/Vinod/.nvm/versions/node/v18.20.8/etc/npmrc
|
||||
7 verbose title npm exec prettier --write .
|
||||
8 verbose argv "exec" "--" "prettier" "--write" "."
|
||||
9 verbose logfile logs-max:10 dir:/Users/Vinod/Documents/GitHub/community-rule/.npm-cache/_logs/2025-12-11T16_04_19_689Z-
|
||||
10 verbose logfile /Users/Vinod/Documents/GitHub/community-rule/.npm-cache/_logs/2025-12-11T16_04_19_689Z-debug-0.log
|
||||
11 silly logfile done cleaning log files
|
||||
12 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
|
||||
13 http fetch GET 200 https://registry.npmjs.org/prettier 172ms (cache miss)
|
||||
14 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
|
||||
15 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
|
||||
16 warn exec The following package was not found and will be installed: prettier@3.7.4
|
||||
17 silly idealTree buildDeps
|
||||
18 silly fetch manifest prettier@3.7.4
|
||||
19 silly packumentCache full:https://registry.npmjs.org/prettier cache-miss
|
||||
20 http fetch GET 200 https://registry.npmjs.org/prettier 64ms (cache miss)
|
||||
21 silly packumentCache full:https://registry.npmjs.org/prettier set size:undefined disposed:false
|
||||
22 silly placeDep ROOT prettier@3.7.4 OK for: want: 3.7.4
|
||||
23 silly reify moves {}
|
||||
24 silly audit bulk request { prettier: [ '3.7.4' ] }
|
||||
25 silly tarball no local data for prettier@https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz. Extracting by manifest.
|
||||
26 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 103ms
|
||||
27 silly audit report {}
|
||||
28 http fetch GET 200 https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz 307ms (cache miss)
|
||||
29 verbose cwd /Users/Vinod/Documents/GitHub/community-rule
|
||||
30 verbose os Darwin 24.6.0
|
||||
31 verbose node v18.20.8
|
||||
32 verbose npm v10.8.2
|
||||
33 verbose exit 0
|
||||
34 info ok
|
||||
@@ -1,18 +0,0 @@
|
||||
0 verbose cli /Users/Vinod/.nvm/versions/node/v18.20.8/bin/node /Users/Vinod/.nvm/versions/node/v18.20.8/lib/node_modules/npm/bin/npm-cli.js
|
||||
1 info using npm@10.8.2
|
||||
2 info using node@v18.20.8
|
||||
3 silly config load:file:/Users/Vinod/.nvm/versions/node/v18.20.8/lib/node_modules/npm/npmrc
|
||||
4 silly config load:file:/Users/Vinod/Documents/GitHub/community-rule/.npmrc
|
||||
5 silly config load:file:/Users/Vinod/.npmrc
|
||||
6 silly config load:file:/Users/Vinod/.nvm/versions/node/v18.20.8/etc/npmrc
|
||||
7 verbose title npm exec prettier --write .
|
||||
8 verbose argv "exec" "--" "prettier" "--write" "."
|
||||
9 verbose logfile logs-max:10 dir:/Users/Vinod/Documents/GitHub/community-rule/.npm-cache/_logs/2025-12-11T17_35_22_890Z-
|
||||
10 verbose logfile /Users/Vinod/Documents/GitHub/community-rule/.npm-cache/_logs/2025-12-11T17_35_22_890Z-debug-0.log
|
||||
11 silly logfile done cleaning log files
|
||||
12 verbose cwd /Users/Vinod/Documents/GitHub/community-rule
|
||||
13 verbose os Darwin 24.6.0
|
||||
14 verbose node v18.20.8
|
||||
15 verbose npm v10.8.2
|
||||
16 verbose exit 0
|
||||
17 info ok
|
||||
-1
@@ -1 +0,0 @@
|
||||
../prettier/bin/prettier.cjs
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"name": "b388654678d519d9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/prettier": {
|
||||
"version": "3.7.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz",
|
||||
"integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
Copyright © James Long and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
[](https://prettier.io)
|
||||
|
||||
<h2 align="center">Opinionated Code Formatter</h2>
|
||||
|
||||
<p align="center">
|
||||
<em>
|
||||
JavaScript
|
||||
· TypeScript
|
||||
· Flow
|
||||
· JSX
|
||||
· JSON
|
||||
</em>
|
||||
<br />
|
||||
<em>
|
||||
CSS
|
||||
· SCSS
|
||||
· Less
|
||||
</em>
|
||||
<br />
|
||||
<em>
|
||||
HTML
|
||||
· Vue
|
||||
· Angular
|
||||
</em>
|
||||
<br />
|
||||
<em>
|
||||
GraphQL
|
||||
· Markdown
|
||||
· YAML
|
||||
</em>
|
||||
<br />
|
||||
<em>
|
||||
<a href="https://prettier.io/docs/plugins">
|
||||
Your favorite language?
|
||||
</a>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/prettier/prettier/actions?query=branch%3Amain">
|
||||
<img alt="CI Status" src="https://img.shields.io/github/check-runs/prettier/prettier/main?style=flat-square&label=CI"></a>
|
||||
<a href="https://codecov.io/gh/prettier/prettier">
|
||||
<img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
|
||||
<a href="https://x.com/acdlite/status/974390255393505280">
|
||||
<img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a>
|
||||
<br/>
|
||||
<a href="https://www.npmjs.com/package/prettier">
|
||||
<img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a>
|
||||
<a href="https://www.npmjs.com/package/prettier">
|
||||
<img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/prettier/prettier#badge">
|
||||
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
|
||||
<a href="https://x.com/intent/follow?screen_name=PrettierCode">
|
||||
<img alt="Follow Prettier on X" src="https://img.shields.io/badge/%40PrettierCode-9f9f9f?style=flat-square&logo=x&labelColor=555"></a>
|
||||
</p>
|
||||
|
||||
## Intro
|
||||
|
||||
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
|
||||
|
||||
### Input
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```js
|
||||
foo(
|
||||
reallyLongArg(),
|
||||
omgSoManyParameters(),
|
||||
IShouldRefactorThis(),
|
||||
isThereSeriouslyAnotherOne(),
|
||||
);
|
||||
```
|
||||
|
||||
Prettier can be run [in your editor](https://prettier.io/docs/editors) on-save, in a [pre-commit hook](https://prettier.io/docs/precommit), or in [CI environments](https://prettier.io/docs/cli#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
|
||||
|
||||
---
|
||||
|
||||
**[Documentation](https://prettier.io/docs/)**
|
||||
|
||||
[Install](https://prettier.io/docs/install) ·
|
||||
[Options](https://prettier.io/docs/options) ·
|
||||
[CLI](https://prettier.io/docs/cli) ·
|
||||
[API](https://prettier.io/docs/api)
|
||||
|
||||
**[Playground](https://prettier.io/playground/)**
|
||||
|
||||
---
|
||||
|
||||
## Badge
|
||||
|
||||
Show the world you're using _Prettier_ → [](https://github.com/prettier/prettier)
|
||||
|
||||
```md
|
||||
[](https://github.com/prettier/prettier)
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
-6059
File diff suppressed because it is too large
Load Diff
-80
@@ -1,80 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __commonJS = function(cb, mod) {
|
||||
return function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
};
|
||||
|
||||
// node_modules/semver-compare/index.js
|
||||
var require_semver_compare = __commonJS({
|
||||
"node_modules/semver-compare/index.js": function(exports2, module2) {
|
||||
module2.exports = function cmp(a, b) {
|
||||
var pa = a.split(".");
|
||||
var pb = b.split(".");
|
||||
for (var i = 0; i < 3; i++) {
|
||||
var na = Number(pa[i]);
|
||||
var nb = Number(pb[i]);
|
||||
if (na > nb) return 1;
|
||||
if (nb > na) return -1;
|
||||
if (!isNaN(na) && isNaN(nb)) return 1;
|
||||
if (isNaN(na) && !isNaN(nb)) return -1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// node_modules/please-upgrade-node/index.js
|
||||
var require_please_upgrade_node = __commonJS({
|
||||
"node_modules/please-upgrade-node/index.js": function(exports2, module2) {
|
||||
var semverCompare = require_semver_compare();
|
||||
module2.exports = function pleaseUpgradeNode2(pkg, opts) {
|
||||
var opts = opts || {};
|
||||
var requiredVersion = pkg.engines.node.replace(">=", "");
|
||||
var currentVersion = process.version.replace("v", "");
|
||||
if (semverCompare(currentVersion, requiredVersion) === -1) {
|
||||
if (opts.message) {
|
||||
console.error(opts.message(requiredVersion));
|
||||
} else {
|
||||
console.error(
|
||||
pkg.name + " requires at least version " + requiredVersion + " of Node, please upgrade"
|
||||
);
|
||||
}
|
||||
if (opts.hasOwnProperty("exitCode")) {
|
||||
process.exit(opts.exitCode);
|
||||
} else {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// bin/prettier.cjs
|
||||
var nodeModule = require("module");
|
||||
if (typeof nodeModule.enableCompileCache === "function") {
|
||||
nodeModule.enableCompileCache();
|
||||
}
|
||||
var pleaseUpgradeNode = require_please_upgrade_node();
|
||||
var packageJson = require("../package.json");
|
||||
pleaseUpgradeNode(packageJson);
|
||||
var dynamicImport = new Function("module", "return import(module)");
|
||||
var promise;
|
||||
var index = process.argv.indexOf("--experimental-cli");
|
||||
if (process.env.PRETTIER_EXPERIMENTAL_CLI || index !== -1) {
|
||||
if (index !== -1) {
|
||||
process.argv.splice(index, 1);
|
||||
}
|
||||
promise = dynamicImport("../internal/experimental-cli.mjs").then(
|
||||
function(cli) {
|
||||
return cli.__promise;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
promise = dynamicImport("../internal/legacy-cli.mjs").then(function runCli(cli) {
|
||||
return cli.run();
|
||||
});
|
||||
}
|
||||
module.exports.__promise = promise;
|
||||
-254
@@ -1,254 +0,0 @@
|
||||
// https://github.com/prettier/prettier/blob/next/src/document/public.js
|
||||
export namespace builders {
|
||||
type DocCommand =
|
||||
| Align
|
||||
| BreakParent
|
||||
| Cursor
|
||||
| Fill
|
||||
| Group
|
||||
| IfBreak
|
||||
| Indent
|
||||
| IndentIfBreak
|
||||
| Label
|
||||
| Line
|
||||
| LineSuffix
|
||||
| LineSuffixBoundary
|
||||
| Trim;
|
||||
type Doc = string | Doc[] | DocCommand;
|
||||
|
||||
interface Align {
|
||||
type: "align";
|
||||
contents: Doc;
|
||||
n: number | string | { type: "root" };
|
||||
}
|
||||
|
||||
interface BreakParent {
|
||||
type: "break-parent";
|
||||
}
|
||||
|
||||
interface Cursor {
|
||||
type: "cursor";
|
||||
placeholder: symbol;
|
||||
}
|
||||
|
||||
interface Fill {
|
||||
type: "fill";
|
||||
parts: Doc[];
|
||||
}
|
||||
|
||||
interface Group {
|
||||
type: "group";
|
||||
id?: symbol;
|
||||
contents: Doc;
|
||||
break: boolean;
|
||||
expandedStates: Doc[];
|
||||
}
|
||||
|
||||
interface HardlineWithoutBreakParent extends Line {
|
||||
hard: true;
|
||||
}
|
||||
|
||||
interface IfBreak {
|
||||
type: "if-break";
|
||||
breakContents: Doc;
|
||||
flatContents: Doc;
|
||||
}
|
||||
|
||||
interface Indent {
|
||||
type: "indent";
|
||||
contents: Doc;
|
||||
}
|
||||
|
||||
interface IndentIfBreak {
|
||||
type: "indent-if-break";
|
||||
}
|
||||
|
||||
interface Label {
|
||||
type: "label";
|
||||
label: any;
|
||||
contents: Doc;
|
||||
}
|
||||
|
||||
interface Line {
|
||||
type: "line";
|
||||
soft?: boolean | undefined;
|
||||
hard?: boolean | undefined;
|
||||
literal?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface LineSuffix {
|
||||
type: "line-suffix";
|
||||
contents: Doc;
|
||||
}
|
||||
|
||||
interface LineSuffixBoundary {
|
||||
type: "line-suffix-boundary";
|
||||
}
|
||||
|
||||
interface LiterallineWithoutBreakParent extends Line {
|
||||
hard: true;
|
||||
literal: true;
|
||||
}
|
||||
|
||||
type LiteralLine = [LiterallineWithoutBreakParent, BreakParent];
|
||||
|
||||
interface Softline extends Line {
|
||||
soft: true;
|
||||
}
|
||||
|
||||
type Hardline = [HardlineWithoutBreakParent, BreakParent];
|
||||
|
||||
interface Trim {
|
||||
type: "trim";
|
||||
}
|
||||
|
||||
interface GroupOptions {
|
||||
shouldBreak?: boolean | undefined;
|
||||
id?: symbol | undefined;
|
||||
}
|
||||
|
||||
function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
|
||||
|
||||
/** @see [align](https://github.com/prettier/prettier/blob/main/commands.md#align) */
|
||||
function align(widthOrString: Align["n"], doc: Doc): Align;
|
||||
|
||||
/** @see [breakParent](https://github.com/prettier/prettier/blob/main/commands.md#breakparent) */
|
||||
const breakParent: BreakParent;
|
||||
|
||||
/** @see [conditionalGroup](https://github.com/prettier/prettier/blob/main/commands.md#conditionalgroup) */
|
||||
function conditionalGroup(alternatives: Doc[], options?: GroupOptions): Group;
|
||||
|
||||
/** @see [dedent](https://github.com/prettier/prettier/blob/main/commands.md#dedent) */
|
||||
function dedent(doc: Doc): Align;
|
||||
|
||||
/** @see [dedentToRoot](https://github.com/prettier/prettier/blob/main/commands.md#dedenttoroot) */
|
||||
function dedentToRoot(doc: Doc): Align;
|
||||
|
||||
/** @see [fill](https://github.com/prettier/prettier/blob/main/commands.md#fill) */
|
||||
function fill(docs: Doc[]): Fill;
|
||||
|
||||
/** @see [group](https://github.com/prettier/prettier/blob/main/commands.md#group) */
|
||||
function group(doc: Doc, opts?: GroupOptions): Group;
|
||||
|
||||
/** @see [hardline](https://github.com/prettier/prettier/blob/main/commands.md#hardline) */
|
||||
const hardline: Hardline;
|
||||
|
||||
/** @see [hardlineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
|
||||
const hardlineWithoutBreakParent: HardlineWithoutBreakParent;
|
||||
|
||||
/** @see [ifBreak](https://github.com/prettier/prettier/blob/main/commands.md#ifbreak) */
|
||||
function ifBreak(
|
||||
ifBreak: Doc,
|
||||
noBreak?: Doc,
|
||||
options?: { groupId?: symbol | undefined },
|
||||
): IfBreak;
|
||||
|
||||
/** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */
|
||||
function indent(doc: Doc): Indent;
|
||||
|
||||
/** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */
|
||||
function indentIfBreak(
|
||||
doc: Doc,
|
||||
opts: { groupId: symbol; negate?: boolean | undefined },
|
||||
): IndentIfBreak;
|
||||
|
||||
/** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */
|
||||
function join(sep: Doc, docs: Doc[]): Doc[];
|
||||
|
||||
/** @see [label](https://github.com/prettier/prettier/blob/main/commands.md#label) */
|
||||
function label(label: any | undefined, contents: Doc): Doc;
|
||||
|
||||
/** @see [line](https://github.com/prettier/prettier/blob/main/commands.md#line) */
|
||||
const line: Line;
|
||||
|
||||
/** @see [lineSuffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) */
|
||||
function lineSuffix(suffix: Doc): LineSuffix;
|
||||
|
||||
/** @see [lineSuffixBoundary](https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary) */
|
||||
const lineSuffixBoundary: LineSuffixBoundary;
|
||||
|
||||
/** @see [literalline](https://github.com/prettier/prettier/blob/main/commands.md#literalline) */
|
||||
const literalline: LiteralLine;
|
||||
|
||||
/** @see [literallineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
|
||||
const literallineWithoutBreakParent: LiterallineWithoutBreakParent;
|
||||
|
||||
/** @see [markAsRoot](https://github.com/prettier/prettier/blob/main/commands.md#markasroot) */
|
||||
function markAsRoot(doc: Doc): Align;
|
||||
|
||||
/** @see [softline](https://github.com/prettier/prettier/blob/main/commands.md#softline) */
|
||||
const softline: Softline;
|
||||
|
||||
/** @see [trim](https://github.com/prettier/prettier/blob/main/commands.md#trim) */
|
||||
const trim: Trim;
|
||||
|
||||
/** @see [cursor](https://github.com/prettier/prettier/blob/main/commands.md#cursor) */
|
||||
const cursor: Cursor;
|
||||
}
|
||||
|
||||
export namespace printer {
|
||||
function printDocToString(
|
||||
doc: builders.Doc,
|
||||
options: Options,
|
||||
): {
|
||||
formatted: string;
|
||||
/**
|
||||
* This property is a misnomer, and has been since the changes in
|
||||
* https://github.com/prettier/prettier/pull/15709.
|
||||
* The region of the document indicated by `cursorNodeStart` and `cursorNodeText` will
|
||||
* sometimes actually be what lies BETWEEN a pair of leaf nodes in the AST, rather than a node.
|
||||
*/
|
||||
cursorNodeStart?: number | undefined;
|
||||
|
||||
/**
|
||||
* Note that, like cursorNodeStart, this is a misnomer and may actually be the text between two
|
||||
* leaf nodes in the AST instead of the text of a node.
|
||||
*/
|
||||
cursorNodeText?: string | undefined;
|
||||
};
|
||||
interface Options {
|
||||
/**
|
||||
* Specify the line length that the printer will wrap on.
|
||||
* @default 80
|
||||
*/
|
||||
printWidth: number;
|
||||
/**
|
||||
* Specify the number of spaces per indentation-level.
|
||||
* @default 2
|
||||
*/
|
||||
tabWidth: number;
|
||||
/**
|
||||
* Indent lines with tabs instead of spaces
|
||||
* @default false
|
||||
*/
|
||||
useTabs?: boolean;
|
||||
parentParser?: string | undefined;
|
||||
__embeddedInHtml?: boolean | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace utils {
|
||||
function willBreak(doc: builders.Doc): boolean;
|
||||
function traverseDoc(
|
||||
doc: builders.Doc,
|
||||
onEnter?: (doc: builders.Doc) => void | boolean,
|
||||
onExit?: (doc: builders.Doc) => void,
|
||||
shouldTraverseConditionalGroups?: boolean,
|
||||
): void;
|
||||
function findInDoc<T = builders.Doc>(
|
||||
doc: builders.Doc,
|
||||
callback: (doc: builders.Doc) => T,
|
||||
defaultValue: T,
|
||||
): T;
|
||||
function mapDoc<T = builders.Doc>(
|
||||
doc: builders.Doc,
|
||||
callback: (doc: builders.Doc) => T,
|
||||
): T;
|
||||
function removeLines(doc: builders.Doc): builders.Doc;
|
||||
function stripTrailingHardline(doc: builders.Doc): builders.Doc;
|
||||
function replaceEndOfLine(
|
||||
doc: builders.Doc,
|
||||
replacement?: builders.Doc,
|
||||
): builders.Doc;
|
||||
function canBreak(doc: builders.Doc): boolean;
|
||||
}
|
||||
-1511
File diff suppressed because one or more lines are too long
-1480
File diff suppressed because one or more lines are too long
-720
File diff suppressed because one or more lines are too long
-968
@@ -1,968 +0,0 @@
|
||||
// Copied from `@types/prettier`
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5bb07fc4b087cb7ee91084afa6fe750551a7bbb1/types/prettier/index.d.ts
|
||||
|
||||
// Minimum TypeScript Version: 4.2
|
||||
|
||||
// Add `export {}` here to shut off automatic exporting from index.d.ts. There
|
||||
// are quite a few utility types here that don't need to be shipped with the
|
||||
// exported module.
|
||||
export {};
|
||||
|
||||
import { builders, printer, utils } from "./doc.js";
|
||||
|
||||
export namespace doc {
|
||||
export { builders, printer, utils };
|
||||
}
|
||||
|
||||
// This utility is here to handle the case where you have an explicit union
|
||||
// between string literals and the generic string type. It would normally
|
||||
// resolve out to just the string type, but this generic LiteralUnion maintains
|
||||
// the intellisense of the original union.
|
||||
//
|
||||
// It comes from this issue: microsoft/TypeScript#29729:
|
||||
// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
|
||||
export type LiteralUnion<T extends U, U = string> =
|
||||
| T
|
||||
| (Pick<U, never> & { _?: never | undefined });
|
||||
|
||||
export type AST = any;
|
||||
export type Doc = doc.builders.Doc;
|
||||
|
||||
// The type of elements that make up the given array T.
|
||||
type ArrayElement<T> = T extends Array<infer E> ? E : never;
|
||||
|
||||
// A union of the properties of the given object that are arrays.
|
||||
type ArrayProperties<T> = {
|
||||
[K in keyof T]: NonNullable<T[K]> extends readonly any[] ? K : never;
|
||||
}[keyof T];
|
||||
|
||||
// A union of the properties of the given array T that can be used to index it.
|
||||
// If the array is a tuple, then that's going to be the explicit indices of the
|
||||
// array, otherwise it's going to just be number.
|
||||
type IndexProperties<T extends { length: number }> =
|
||||
IsTuple<T> extends true ? Exclude<Partial<T>["length"], T["length"]> : number;
|
||||
|
||||
// Effectively performing T[P], except that it's telling TypeScript that it's
|
||||
// safe to do this for tuples, arrays, or objects.
|
||||
type IndexValue<T, P> = T extends any[]
|
||||
? P extends number
|
||||
? T[P]
|
||||
: never
|
||||
: P extends keyof T
|
||||
? T[P]
|
||||
: never;
|
||||
|
||||
// Determines if an object T is an array like string[] (in which case this
|
||||
// evaluates to false) or a tuple like [string] (in which case this evaluates to
|
||||
// true).
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
type IsTuple<T> = T extends []
|
||||
? true
|
||||
: T extends [infer First, ...infer Remain]
|
||||
? IsTuple<Remain>
|
||||
: false;
|
||||
|
||||
type CallProperties<T> = T extends any[] ? IndexProperties<T> : keyof T;
|
||||
type IterProperties<T> = T extends any[]
|
||||
? IndexProperties<T>
|
||||
: ArrayProperties<T>;
|
||||
|
||||
type CallCallback<T, U> = (path: AstPath<T>, index: number, value: any) => U;
|
||||
type EachCallback<T> = (
|
||||
path: AstPath<ArrayElement<T>>,
|
||||
index: number,
|
||||
value: any,
|
||||
) => void;
|
||||
type MapCallback<T, U> = (
|
||||
path: AstPath<ArrayElement<T>>,
|
||||
index: number,
|
||||
value: any,
|
||||
) => U;
|
||||
|
||||
// https://github.com/prettier/prettier/blob/next/src/common/ast-path.js
|
||||
export class AstPath<T = any> {
|
||||
constructor(value: T);
|
||||
|
||||
get key(): string | null;
|
||||
get index(): number | null;
|
||||
get node(): T;
|
||||
get parent(): T | null;
|
||||
get grandparent(): T | null;
|
||||
get isInArray(): boolean;
|
||||
get siblings(): T[] | null;
|
||||
get next(): T | null;
|
||||
get previous(): T | null;
|
||||
get isFirst(): boolean;
|
||||
get isLast(): boolean;
|
||||
get isRoot(): boolean;
|
||||
get root(): T;
|
||||
get ancestors(): T[];
|
||||
|
||||
stack: T[];
|
||||
|
||||
callParent<U>(callback: (path: this) => U, count?: number): U;
|
||||
|
||||
/**
|
||||
* @deprecated Please use `AstPath#key` or `AstPath#index`
|
||||
*/
|
||||
getName(): PropertyKey | null;
|
||||
|
||||
/**
|
||||
* @deprecated Please use `AstPath#node` or `AstPath#siblings`
|
||||
*/
|
||||
getValue(): T;
|
||||
|
||||
getNode(count?: number): T | null;
|
||||
|
||||
getParentNode(count?: number): T | null;
|
||||
|
||||
match(
|
||||
...predicates: Array<
|
||||
(node: any, name: string | null, number: number | null) => boolean
|
||||
>
|
||||
): boolean;
|
||||
|
||||
// For each of the tree walk functions (call, each, and map) this provides 5
|
||||
// strict type signatures, along with a fallback at the end if you end up
|
||||
// calling more than 5 properties deep. This helps a lot with typing because
|
||||
// for the majority of cases you're calling fewer than 5 properties, so the
|
||||
// tree walk functions have a clearer understanding of what you're doing.
|
||||
//
|
||||
// Note that resolving these types is somewhat complicated, and it wasn't
|
||||
// even supported until TypeScript 4.2 (before it would just say that the
|
||||
// type instantiation was excessively deep and possibly infinite).
|
||||
|
||||
call<U>(callback: CallCallback<T, U>): U;
|
||||
call<U, P1 extends CallProperties<T>>(
|
||||
callback: CallCallback<IndexValue<T, P1>, U>,
|
||||
prop1: P1,
|
||||
): U;
|
||||
call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>>(
|
||||
callback: CallCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
): U;
|
||||
call<
|
||||
U,
|
||||
P1 extends keyof T,
|
||||
P2 extends CallProperties<T[P1]>,
|
||||
P3 extends CallProperties<IndexValue<T[P1], P2>>,
|
||||
>(
|
||||
callback: CallCallback<
|
||||
IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>,
|
||||
U
|
||||
>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
): U;
|
||||
call<
|
||||
U,
|
||||
P1 extends keyof T,
|
||||
P2 extends CallProperties<T[P1]>,
|
||||
P3 extends CallProperties<IndexValue<T[P1], P2>>,
|
||||
P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
|
||||
>(
|
||||
callback: CallCallback<
|
||||
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
|
||||
U
|
||||
>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
prop4: P4,
|
||||
): U;
|
||||
call<U, P extends PropertyKey>(
|
||||
callback: CallCallback<any, U>,
|
||||
prop1: P,
|
||||
prop2: P,
|
||||
prop3: P,
|
||||
prop4: P,
|
||||
...props: P[]
|
||||
): U;
|
||||
|
||||
each(callback: EachCallback<T>): void;
|
||||
each<P1 extends IterProperties<T>>(
|
||||
callback: EachCallback<IndexValue<T, P1>>,
|
||||
prop1: P1,
|
||||
): void;
|
||||
each<P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
|
||||
callback: EachCallback<IndexValue<IndexValue<T, P1>, P2>>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
): void;
|
||||
each<
|
||||
P1 extends keyof T,
|
||||
P2 extends IterProperties<T[P1]>,
|
||||
P3 extends IterProperties<IndexValue<T[P1], P2>>,
|
||||
>(
|
||||
callback: EachCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
): void;
|
||||
each<
|
||||
P1 extends keyof T,
|
||||
P2 extends IterProperties<T[P1]>,
|
||||
P3 extends IterProperties<IndexValue<T[P1], P2>>,
|
||||
P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
|
||||
>(
|
||||
callback: EachCallback<
|
||||
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>
|
||||
>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
prop4: P4,
|
||||
): void;
|
||||
each(
|
||||
callback: EachCallback<any[]>,
|
||||
prop1: PropertyKey,
|
||||
prop2: PropertyKey,
|
||||
prop3: PropertyKey,
|
||||
prop4: PropertyKey,
|
||||
...props: PropertyKey[]
|
||||
): void;
|
||||
|
||||
map<U>(callback: MapCallback<T, U>): U[];
|
||||
map<U, P1 extends IterProperties<T>>(
|
||||
callback: MapCallback<IndexValue<T, P1>, U>,
|
||||
prop1: P1,
|
||||
): U[];
|
||||
map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
|
||||
callback: MapCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
): U[];
|
||||
map<
|
||||
U,
|
||||
P1 extends keyof T,
|
||||
P2 extends IterProperties<T[P1]>,
|
||||
P3 extends IterProperties<IndexValue<T[P1], P2>>,
|
||||
>(
|
||||
callback: MapCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
): U[];
|
||||
map<
|
||||
U,
|
||||
P1 extends keyof T,
|
||||
P2 extends IterProperties<T[P1]>,
|
||||
P3 extends IterProperties<IndexValue<T[P1], P2>>,
|
||||
P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
|
||||
>(
|
||||
callback: MapCallback<
|
||||
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
|
||||
U
|
||||
>,
|
||||
prop1: P1,
|
||||
prop2: P2,
|
||||
prop3: P3,
|
||||
prop4: P4,
|
||||
): U[];
|
||||
map<U>(
|
||||
callback: MapCallback<any[], U>,
|
||||
prop1: PropertyKey,
|
||||
prop2: PropertyKey,
|
||||
prop3: PropertyKey,
|
||||
prop4: PropertyKey,
|
||||
...props: PropertyKey[]
|
||||
): U[];
|
||||
}
|
||||
|
||||
/** @deprecated `FastPath` was renamed to `AstPath` */
|
||||
export type FastPath<T = any> = AstPath<T>;
|
||||
|
||||
export type BuiltInParser = (text: string, options?: any) => AST;
|
||||
export type BuiltInParserName =
|
||||
| "acorn"
|
||||
| "angular"
|
||||
| "babel-flow"
|
||||
| "babel-ts"
|
||||
| "babel"
|
||||
| "css"
|
||||
| "espree"
|
||||
| "flow"
|
||||
| "glimmer"
|
||||
| "graphql"
|
||||
| "html"
|
||||
| "json-stringify"
|
||||
| "json"
|
||||
| "json5"
|
||||
| "jsonc"
|
||||
| "less"
|
||||
| "lwc"
|
||||
| "markdown"
|
||||
| "mdx"
|
||||
| "meriyah"
|
||||
| "mjml"
|
||||
| "scss"
|
||||
| "typescript"
|
||||
| "vue"
|
||||
| "yaml";
|
||||
export type BuiltInParsers = Record<BuiltInParserName, BuiltInParser>;
|
||||
|
||||
/**
|
||||
* For use in `.prettierrc.js`, `.prettierrc.ts`, `.prettierrc.cjs`, `.prettierrc.cts`, `prettierrc.mjs`, `prettierrc.mts`, `prettier.config.js`, `prettier.config.ts`, `prettier.config.cjs`, `prettier.config.cts`, `prettier.config.mjs`, `prettier.config.mts`
|
||||
*/
|
||||
export interface Config extends Options {
|
||||
overrides?: Array<{
|
||||
files: string | string[];
|
||||
excludeFiles?: string | string[];
|
||||
options?: Options;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface Options extends Partial<RequiredOptions> {}
|
||||
|
||||
export interface RequiredOptions extends doc.printer.Options {
|
||||
/**
|
||||
* Print semicolons at the ends of statements.
|
||||
* @default true
|
||||
*/
|
||||
semi: boolean;
|
||||
/**
|
||||
* Use single quotes instead of double quotes.
|
||||
* @default false
|
||||
*/
|
||||
singleQuote: boolean;
|
||||
/**
|
||||
* Use single quotes in JSX.
|
||||
* @default false
|
||||
*/
|
||||
jsxSingleQuote: boolean;
|
||||
/**
|
||||
* Print trailing commas wherever possible.
|
||||
* @default "all"
|
||||
*/
|
||||
trailingComma: "none" | "es5" | "all";
|
||||
/**
|
||||
* Print spaces between brackets in object literals.
|
||||
* @default true
|
||||
*/
|
||||
bracketSpacing: boolean;
|
||||
/**
|
||||
* How to wrap object literals.
|
||||
* @default "preserve"
|
||||
*/
|
||||
objectWrap: "preserve" | "collapse";
|
||||
/**
|
||||
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
|
||||
* alone on the next line (does not apply to self closing elements).
|
||||
* @default false
|
||||
*/
|
||||
bracketSameLine: boolean;
|
||||
/**
|
||||
* Format only a segment of a file.
|
||||
* @default 0
|
||||
*/
|
||||
rangeStart: number;
|
||||
/**
|
||||
* Format only a segment of a file.
|
||||
* @default Number.POSITIVE_INFINITY
|
||||
*/
|
||||
rangeEnd: number;
|
||||
/**
|
||||
* Specify which parser to use.
|
||||
*/
|
||||
parser: LiteralUnion<BuiltInParserName>;
|
||||
/**
|
||||
* Specify the input filepath. This will be used to do parser inference.
|
||||
*/
|
||||
filepath: string;
|
||||
/**
|
||||
* Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
||||
* This is very useful when gradually transitioning large, unformatted codebases to prettier.
|
||||
* @default false
|
||||
*/
|
||||
requirePragma: boolean;
|
||||
/**
|
||||
* Prettier can insert a special @format marker at the top of files specifying that
|
||||
* the file has been formatted with prettier. This works well when used in tandem with
|
||||
* the --require-pragma option. If there is already a docblock at the top of
|
||||
* the file then this option will add a newline to it with the @format marker.
|
||||
* @default false
|
||||
*/
|
||||
insertPragma: boolean;
|
||||
/**
|
||||
* Prettier can allow individual files to opt out of formatting if they contain a special comment, called a pragma, at the top of the file.
|
||||
* @default false
|
||||
*/
|
||||
checkIgnorePragma: boolean;
|
||||
/**
|
||||
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
||||
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
||||
* @default "preserve"
|
||||
*/
|
||||
proseWrap: "always" | "never" | "preserve";
|
||||
/**
|
||||
* Include parentheses around a sole arrow function parameter.
|
||||
* @default "always"
|
||||
*/
|
||||
arrowParens: "avoid" | "always";
|
||||
/**
|
||||
* Provide ability to support new languages to prettier.
|
||||
*/
|
||||
plugins: Array<string | URL | Plugin>;
|
||||
/**
|
||||
* How to handle whitespaces in HTML.
|
||||
* @default "css"
|
||||
*/
|
||||
htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
|
||||
/**
|
||||
* Which end of line characters to apply.
|
||||
* @default "lf"
|
||||
*/
|
||||
endOfLine: "auto" | "lf" | "crlf" | "cr";
|
||||
/**
|
||||
* Change when properties in objects are quoted.
|
||||
* @default "as-needed"
|
||||
*/
|
||||
quoteProps: "as-needed" | "consistent" | "preserve";
|
||||
/**
|
||||
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
||||
* @default false
|
||||
*/
|
||||
vueIndentScriptAndStyle: boolean;
|
||||
/**
|
||||
* Control whether Prettier formats quoted code embedded in the file.
|
||||
* @default "auto"
|
||||
*/
|
||||
embeddedLanguageFormatting: "auto" | "off";
|
||||
/**
|
||||
* Enforce single attribute per line in HTML, Vue and JSX.
|
||||
* @default false
|
||||
*/
|
||||
singleAttributePerLine: boolean;
|
||||
/**
|
||||
* Where to print operators when binary expressions wrap lines.
|
||||
* @default "end"
|
||||
*/
|
||||
experimentalOperatorPosition: "start" | "end";
|
||||
/**
|
||||
* Use curious ternaries, with the question mark after the condition, instead
|
||||
* of on the same line as the consequent.
|
||||
* @default false
|
||||
*/
|
||||
experimentalTernaries: boolean;
|
||||
/**
|
||||
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
||||
* @default false
|
||||
* @deprecated use bracketSameLine instead
|
||||
*/
|
||||
jsxBracketSameLine?: boolean;
|
||||
/**
|
||||
* Arbitrary additional values on an options object are always allowed.
|
||||
*/
|
||||
[_: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ParserOptions<T = any> extends RequiredOptions {
|
||||
locStart: (node: T) => number;
|
||||
locEnd: (node: T) => number;
|
||||
originalText: string;
|
||||
}
|
||||
|
||||
export interface Plugin<T = any> {
|
||||
languages?: SupportLanguage[] | undefined;
|
||||
parsers?: { [parserName: string]: Parser<T> } | undefined;
|
||||
printers?: { [astFormat: string]: Printer<T> } | undefined;
|
||||
options?: SupportOptions | undefined;
|
||||
defaultOptions?: Partial<RequiredOptions> | undefined;
|
||||
}
|
||||
|
||||
export interface Parser<T = any> {
|
||||
parse: (text: string, options: ParserOptions<T>) => T | Promise<T>;
|
||||
astFormat: string;
|
||||
hasPragma?: ((text: string) => boolean) | undefined;
|
||||
hasIgnorePragma?: ((text: string) => boolean) | undefined;
|
||||
locStart: (node: T) => number;
|
||||
locEnd: (node: T) => number;
|
||||
preprocess?:
|
||||
| ((text: string, options: ParserOptions<T>) => string | Promise<string>)
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export interface Printer<T = any> {
|
||||
print(
|
||||
path: AstPath<T>,
|
||||
options: ParserOptions<T>,
|
||||
print: (path: AstPath<T>) => Doc,
|
||||
args?: unknown,
|
||||
): Doc;
|
||||
printPrettierIgnored?(
|
||||
path: AstPath<T>,
|
||||
options: ParserOptions<T>,
|
||||
print: (path: AstPath<T>) => Doc,
|
||||
args?: unknown,
|
||||
): Doc;
|
||||
embed?:
|
||||
| ((
|
||||
path: AstPath,
|
||||
options: Options,
|
||||
) =>
|
||||
| ((
|
||||
textToDoc: (text: string, options: Options) => Promise<Doc>,
|
||||
print: (
|
||||
selector?: string | number | Array<string | number> | AstPath,
|
||||
) => Doc,
|
||||
path: AstPath,
|
||||
options: Options,
|
||||
) => Promise<Doc | undefined> | Doc | undefined)
|
||||
| Doc
|
||||
| null)
|
||||
| undefined;
|
||||
preprocess?:
|
||||
| ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
|
||||
| undefined;
|
||||
insertPragma?: (text: string) => string;
|
||||
/**
|
||||
* @returns `null` if you want to remove this node
|
||||
* @returns `void` if you want to use modified `cloned`
|
||||
* @returns anything if you want to replace the node with it
|
||||
*/
|
||||
massageAstNode?:
|
||||
| ((original: any, cloned: any, parent: any) => any)
|
||||
| undefined;
|
||||
hasPrettierIgnore?: ((path: AstPath<T>) => boolean) | undefined;
|
||||
canAttachComment?: ((node: T, ancestors: T[]) => boolean) | undefined;
|
||||
isBlockComment?: ((node: T) => boolean) | undefined;
|
||||
willPrintOwnComments?: ((path: AstPath<T>) => boolean) | undefined;
|
||||
printComment?:
|
||||
| ((commentPath: AstPath<T>, options: ParserOptions<T>) => Doc)
|
||||
| undefined;
|
||||
/**
|
||||
* By default, Prettier searches all object properties (except for a few predefined ones) of each node recursively.
|
||||
* This function can be provided to override that behavior.
|
||||
* @param node The node whose children should be returned.
|
||||
* @param options Current options.
|
||||
* @returns `[]` if the node has no children or `undefined` to fall back on the default behavior.
|
||||
*/
|
||||
getCommentChildNodes?:
|
||||
| ((node: T, options: ParserOptions<T>) => T[] | undefined)
|
||||
| undefined;
|
||||
handleComments?:
|
||||
| {
|
||||
ownLine?:
|
||||
| ((
|
||||
commentNode: any,
|
||||
text: string,
|
||||
options: ParserOptions<T>,
|
||||
ast: T,
|
||||
isLastComment: boolean,
|
||||
) => boolean)
|
||||
| undefined;
|
||||
endOfLine?:
|
||||
| ((
|
||||
commentNode: any,
|
||||
text: string,
|
||||
options: ParserOptions<T>,
|
||||
ast: T,
|
||||
isLastComment: boolean,
|
||||
) => boolean)
|
||||
| undefined;
|
||||
remaining?:
|
||||
| ((
|
||||
commentNode: any,
|
||||
text: string,
|
||||
options: ParserOptions<T>,
|
||||
ast: T,
|
||||
isLastComment: boolean,
|
||||
) => boolean)
|
||||
| undefined;
|
||||
}
|
||||
| undefined;
|
||||
getVisitorKeys?:
|
||||
| ((node: T, nonTraversableKeys: Set<string>) => string[])
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export interface CursorOptions extends Options {
|
||||
/**
|
||||
* Specify where the cursor is.
|
||||
*/
|
||||
cursorOffset: number;
|
||||
}
|
||||
|
||||
export interface CursorResult {
|
||||
formatted: string;
|
||||
cursorOffset: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* `format` is used to format text using Prettier. [Options](https://prettier.io/docs/options) may be provided to override the defaults.
|
||||
*/
|
||||
export function format(source: string, options?: Options): Promise<string>;
|
||||
|
||||
/**
|
||||
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
||||
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
||||
*/
|
||||
export function check(source: string, options?: Options): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* `formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code.
|
||||
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted.
|
||||
*
|
||||
* The `cursorOffset` option should be provided, to specify where the cursor is.
|
||||
*/
|
||||
export function formatWithCursor(
|
||||
source: string,
|
||||
options: CursorOptions,
|
||||
): Promise<CursorResult>;
|
||||
|
||||
export interface ResolveConfigOptions {
|
||||
/**
|
||||
* If set to `false`, all caching will be bypassed.
|
||||
*/
|
||||
useCache?: boolean | undefined;
|
||||
/**
|
||||
* Pass directly the path of the config file if you don't wish to search for it.
|
||||
*/
|
||||
config?: string | URL | undefined;
|
||||
/**
|
||||
* If set to `true` and an `.editorconfig` file is in your project,
|
||||
* Prettier will parse it and convert its properties to the corresponding prettier configuration.
|
||||
* This configuration will be overridden by `.prettierrc`, etc. Currently,
|
||||
* the following EditorConfig properties are supported:
|
||||
* - indent_style
|
||||
* - indent_size/tab_width
|
||||
* - max_line_length
|
||||
*/
|
||||
editorconfig?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* `resolveConfig` can be used to resolve configuration for a given source file,
|
||||
* passing its path or url as the first argument. The config search will start at
|
||||
* the directory of the file location and continue to search up the directory.
|
||||
*
|
||||
* A promise is returned which will resolve to:
|
||||
*
|
||||
* - An options object, providing a [config file](https://prettier.io/docs/configuration) was found.
|
||||
* - `null`, if no file was found.
|
||||
*
|
||||
* The promise will be rejected if there was an error parsing the configuration file.
|
||||
*/
|
||||
export function resolveConfig(
|
||||
fileUrlOrPath: string | URL,
|
||||
options?: ResolveConfigOptions,
|
||||
): Promise<Options | null>;
|
||||
|
||||
/**
|
||||
* `resolveConfigFile` can be used to find the path of the Prettier configuration file,
|
||||
* that will be used when resolving the config (i.e. when calling `resolveConfig`).
|
||||
*
|
||||
* A promise is returned which will resolve to:
|
||||
*
|
||||
* - The path of the configuration file.
|
||||
* - `null`, if no file was found.
|
||||
*
|
||||
* The promise will be rejected if there was an error parsing the configuration file.
|
||||
*/
|
||||
export function resolveConfigFile(
|
||||
fileUrlOrPath?: string | URL,
|
||||
): Promise<string | null>;
|
||||
|
||||
/**
|
||||
* As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache.
|
||||
* Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.
|
||||
*/
|
||||
export function clearConfigCache(): Promise<void>;
|
||||
|
||||
export interface SupportLanguage {
|
||||
name: string;
|
||||
parsers: BuiltInParserName[] | string[];
|
||||
group?: string | undefined;
|
||||
tmScope?: string | undefined;
|
||||
aceMode?: string | undefined;
|
||||
codemirrorMode?: string | undefined;
|
||||
codemirrorMimeType?: string | undefined;
|
||||
aliases?: string[] | undefined;
|
||||
extensions?: string[] | undefined;
|
||||
filenames?: string[] | undefined;
|
||||
linguistLanguageId?: number | undefined;
|
||||
vscodeLanguageIds?: string[] | undefined;
|
||||
interpreters?: string[] | undefined;
|
||||
isSupported?: ((options: { filepath: string }) => boolean) | undefined;
|
||||
}
|
||||
|
||||
export interface SupportOptionRange {
|
||||
start: number;
|
||||
end: number;
|
||||
step: number;
|
||||
}
|
||||
|
||||
export type SupportOptionType =
|
||||
| "int"
|
||||
| "string"
|
||||
| "boolean"
|
||||
| "choice"
|
||||
| "path";
|
||||
|
||||
export type CoreCategoryType =
|
||||
| "Config"
|
||||
| "Editor"
|
||||
| "Format"
|
||||
| "Other"
|
||||
| "Output"
|
||||
| "Global"
|
||||
| "Special";
|
||||
|
||||
export interface BaseSupportOption<Type extends SupportOptionType> {
|
||||
readonly name?: string | undefined;
|
||||
/**
|
||||
* Usually you can use {@link CoreCategoryType}
|
||||
*/
|
||||
category: string;
|
||||
/**
|
||||
* The type of the option.
|
||||
*
|
||||
* When passing a type other than the ones listed below, the option is
|
||||
* treated as taking any string as argument, and `--option <${type}>` will
|
||||
* be displayed in --help.
|
||||
*/
|
||||
type: Type;
|
||||
/**
|
||||
* Indicate that the option is deprecated.
|
||||
*
|
||||
* Use a string to add an extra message to --help for the option,
|
||||
* for example to suggest a replacement option.
|
||||
*/
|
||||
deprecated?: true | string | undefined;
|
||||
/**
|
||||
* Description to be displayed in --help. If omitted, the option won't be
|
||||
* shown at all in --help.
|
||||
*/
|
||||
description?: string | undefined;
|
||||
}
|
||||
|
||||
export interface IntSupportOption extends BaseSupportOption<"int"> {
|
||||
default?: number | undefined;
|
||||
array?: false | undefined;
|
||||
range?: SupportOptionRange | undefined;
|
||||
}
|
||||
|
||||
export interface IntArraySupportOption extends BaseSupportOption<"int"> {
|
||||
default?: Array<{ value: number[] }> | undefined;
|
||||
array: true;
|
||||
}
|
||||
|
||||
export interface StringSupportOption extends BaseSupportOption<"string"> {
|
||||
default?: string | undefined;
|
||||
array?: false | undefined;
|
||||
}
|
||||
|
||||
export interface StringArraySupportOption extends BaseSupportOption<"string"> {
|
||||
default?: Array<{ value: string[] }> | undefined;
|
||||
array: true;
|
||||
}
|
||||
|
||||
export interface BooleanSupportOption extends BaseSupportOption<"boolean"> {
|
||||
default?: boolean | undefined;
|
||||
array?: false | undefined;
|
||||
description: string;
|
||||
oppositeDescription?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BooleanArraySupportOption extends BaseSupportOption<"boolean"> {
|
||||
default?: Array<{ value: boolean[] }> | undefined;
|
||||
array: true;
|
||||
}
|
||||
|
||||
export interface ChoiceSupportOption<
|
||||
Value = any,
|
||||
> extends BaseSupportOption<"choice"> {
|
||||
default?: Value | Array<{ value: Value }> | undefined;
|
||||
description: string;
|
||||
choices: Array<{
|
||||
value: Value;
|
||||
description: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface PathSupportOption extends BaseSupportOption<"path"> {
|
||||
default?: string | undefined;
|
||||
array?: false | undefined;
|
||||
}
|
||||
|
||||
export interface PathArraySupportOption extends BaseSupportOption<"path"> {
|
||||
default?: Array<{ value: string[] }> | undefined;
|
||||
array: true;
|
||||
}
|
||||
|
||||
export type SupportOption =
|
||||
| IntSupportOption
|
||||
| IntArraySupportOption
|
||||
| StringSupportOption
|
||||
| StringArraySupportOption
|
||||
| BooleanSupportOption
|
||||
| BooleanArraySupportOption
|
||||
| ChoiceSupportOption
|
||||
| PathSupportOption
|
||||
| PathArraySupportOption;
|
||||
|
||||
export interface SupportOptions extends Record<string, SupportOption> {}
|
||||
|
||||
export interface SupportInfo {
|
||||
languages: SupportLanguage[];
|
||||
options: SupportOption[];
|
||||
}
|
||||
|
||||
export interface FileInfoOptions {
|
||||
ignorePath?: string | URL | (string | URL)[] | undefined;
|
||||
withNodeModules?: boolean | undefined;
|
||||
plugins?: Array<string | URL | Plugin> | undefined;
|
||||
resolveConfig?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface FileInfoResult {
|
||||
ignored: boolean;
|
||||
inferredParser: string | null;
|
||||
}
|
||||
|
||||
export function getFileInfo(
|
||||
file: string | URL,
|
||||
options?: FileInfoOptions,
|
||||
): Promise<FileInfoResult>;
|
||||
|
||||
export interface SupportInfoOptions {
|
||||
plugins?: Array<string | URL | Plugin> | undefined;
|
||||
showDeprecated?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
|
||||
*/
|
||||
export function getSupportInfo(
|
||||
options?: SupportInfoOptions,
|
||||
): Promise<SupportInfo>;
|
||||
|
||||
/**
|
||||
* `version` field in `package.json`
|
||||
*/
|
||||
export const version: string;
|
||||
|
||||
// https://github.com/prettier/prettier/blob/main/src/utilities/public.js
|
||||
export namespace util {
|
||||
interface SkipOptions {
|
||||
backwards?: boolean | undefined;
|
||||
}
|
||||
|
||||
type Quote = "'" | '"';
|
||||
|
||||
function getMaxContinuousCount(text: string, searchString: string): number;
|
||||
|
||||
function getStringWidth(text: string): number;
|
||||
|
||||
function getAlignmentSize(
|
||||
text: string,
|
||||
tabWidth: number,
|
||||
startIndex?: number | undefined,
|
||||
): number;
|
||||
|
||||
function getIndentSize(value: string, tabWidth: number): number;
|
||||
|
||||
function skipNewline(
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions | undefined,
|
||||
): number | false;
|
||||
|
||||
function skipInlineComment(
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
): number | false;
|
||||
|
||||
function skipTrailingComment(
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
): number | false;
|
||||
|
||||
function skipTrailingComment(
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
): number | false;
|
||||
|
||||
function hasNewline(
|
||||
text: string,
|
||||
startIndex: number,
|
||||
options?: SkipOptions | undefined,
|
||||
): boolean;
|
||||
|
||||
function hasNewlineInRange(
|
||||
text: string,
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
): boolean;
|
||||
|
||||
function hasSpaces(
|
||||
text: string,
|
||||
startIndex: number,
|
||||
options?: SkipOptions | undefined,
|
||||
): boolean;
|
||||
|
||||
function getNextNonSpaceNonCommentCharacterIndex(
|
||||
text: string,
|
||||
startIndex: number,
|
||||
): number | false;
|
||||
|
||||
function getNextNonSpaceNonCommentCharacter(
|
||||
text: string,
|
||||
startIndex: number,
|
||||
): string;
|
||||
|
||||
function isNextLineEmpty(text: string, startIndex: number): boolean;
|
||||
|
||||
function isPreviousLineEmpty(text: string, startIndex: number): boolean;
|
||||
|
||||
function makeString(
|
||||
rawText: string,
|
||||
enclosingQuote: Quote,
|
||||
unescapeUnnecessaryEscapes?: boolean | undefined,
|
||||
): string;
|
||||
|
||||
function skip(
|
||||
characters: string | RegExp,
|
||||
): (
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions,
|
||||
) => number | false;
|
||||
|
||||
const skipWhitespace: (
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions,
|
||||
) => number | false;
|
||||
|
||||
const skipSpaces: (
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions,
|
||||
) => number | false;
|
||||
|
||||
const skipToLineEnd: (
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions,
|
||||
) => number | false;
|
||||
|
||||
const skipEverythingButNewLine: (
|
||||
text: string,
|
||||
startIndex: number | false,
|
||||
options?: SkipOptions,
|
||||
) => number | false;
|
||||
|
||||
function addLeadingComment(node: any, comment: any): void;
|
||||
|
||||
function addDanglingComment(node: any, comment: any, marker: any): void;
|
||||
|
||||
function addTrailingComment(node: any, comment: any): void;
|
||||
|
||||
function getPreferredQuote(
|
||||
text: string,
|
||||
preferredQuoteOrPreferSingleQuote: Quote | boolean,
|
||||
): Quote;
|
||||
}
|
||||
-18793
File diff suppressed because one or more lines are too long
Generated
Vendored
-2841
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-12790
File diff suppressed because one or more lines are too long
-6229
File diff suppressed because it is too large
Load Diff
-203
@@ -1,203 +0,0 @@
|
||||
{
|
||||
"name": "prettier",
|
||||
"version": "3.7.4",
|
||||
"description": "Prettier is an opinionated code formatter",
|
||||
"bin": "./bin/prettier.cjs",
|
||||
"repository": "prettier/prettier",
|
||||
"funding": "https://github.com/prettier/prettier?sponsor=1",
|
||||
"homepage": "https://prettier.io",
|
||||
"author": "James Long",
|
||||
"license": "MIT",
|
||||
"main": "./index.cjs",
|
||||
"browser": "./standalone.js",
|
||||
"unpkg": "./standalone.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"require": "./index.cjs",
|
||||
"browser": {
|
||||
"import": "./standalone.mjs",
|
||||
"default": "./standalone.js"
|
||||
},
|
||||
"default": "./index.mjs"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./doc": {
|
||||
"types": "./doc.d.ts",
|
||||
"require": "./doc.js",
|
||||
"default": "./doc.mjs"
|
||||
},
|
||||
"./standalone": {
|
||||
"types": "./standalone.d.ts",
|
||||
"require": "./standalone.js",
|
||||
"default": "./standalone.mjs"
|
||||
},
|
||||
"./plugins/estree": {
|
||||
"types": "./plugins/estree.d.ts",
|
||||
"require": "./plugins/estree.js",
|
||||
"default": "./plugins/estree.mjs"
|
||||
},
|
||||
"./plugins/babel": {
|
||||
"types": "./plugins/babel.d.ts",
|
||||
"require": "./plugins/babel.js",
|
||||
"default": "./plugins/babel.mjs"
|
||||
},
|
||||
"./plugins/flow": {
|
||||
"types": "./plugins/flow.d.ts",
|
||||
"require": "./plugins/flow.js",
|
||||
"default": "./plugins/flow.mjs"
|
||||
},
|
||||
"./plugins/typescript": {
|
||||
"types": "./plugins/typescript.d.ts",
|
||||
"require": "./plugins/typescript.js",
|
||||
"default": "./plugins/typescript.mjs"
|
||||
},
|
||||
"./plugins/acorn": {
|
||||
"types": "./plugins/acorn.d.ts",
|
||||
"require": "./plugins/acorn.js",
|
||||
"default": "./plugins/acorn.mjs"
|
||||
},
|
||||
"./plugins/meriyah": {
|
||||
"types": "./plugins/meriyah.d.ts",
|
||||
"require": "./plugins/meriyah.js",
|
||||
"default": "./plugins/meriyah.mjs"
|
||||
},
|
||||
"./plugins/angular": {
|
||||
"types": "./plugins/angular.d.ts",
|
||||
"require": "./plugins/angular.js",
|
||||
"default": "./plugins/angular.mjs"
|
||||
},
|
||||
"./plugins/postcss": {
|
||||
"types": "./plugins/postcss.d.ts",
|
||||
"require": "./plugins/postcss.js",
|
||||
"default": "./plugins/postcss.mjs"
|
||||
},
|
||||
"./plugins/graphql": {
|
||||
"types": "./plugins/graphql.d.ts",
|
||||
"require": "./plugins/graphql.js",
|
||||
"default": "./plugins/graphql.mjs"
|
||||
},
|
||||
"./plugins/markdown": {
|
||||
"types": "./plugins/markdown.d.ts",
|
||||
"require": "./plugins/markdown.js",
|
||||
"default": "./plugins/markdown.mjs"
|
||||
},
|
||||
"./plugins/glimmer": {
|
||||
"types": "./plugins/glimmer.d.ts",
|
||||
"require": "./plugins/glimmer.js",
|
||||
"default": "./plugins/glimmer.mjs"
|
||||
},
|
||||
"./plugins/html": {
|
||||
"types": "./plugins/html.d.ts",
|
||||
"require": "./plugins/html.js",
|
||||
"default": "./plugins/html.mjs"
|
||||
},
|
||||
"./plugins/yaml": {
|
||||
"types": "./plugins/yaml.d.ts",
|
||||
"require": "./plugins/yaml.js",
|
||||
"default": "./plugins/yaml.mjs"
|
||||
},
|
||||
"./esm/standalone.mjs": "./standalone.mjs",
|
||||
"./parser-babel": "./plugins/babel.js",
|
||||
"./parser-babel.js": "./plugins/babel.js",
|
||||
"./esm/parser-babel.mjs": "./plugins/babel.mjs",
|
||||
"./parser-flow": "./plugins/flow.js",
|
||||
"./parser-flow.js": "./plugins/flow.js",
|
||||
"./esm/parser-flow.mjs": "./plugins/flow.mjs",
|
||||
"./parser-typescript": "./plugins/typescript.js",
|
||||
"./parser-typescript.js": "./plugins/typescript.js",
|
||||
"./esm/parser-typescript.mjs": "./plugins/typescript.mjs",
|
||||
"./parser-espree": "./plugins/acorn.js",
|
||||
"./parser-espree.js": "./plugins/acorn.js",
|
||||
"./esm/parser-espree.mjs": "./plugins/acorn.mjs",
|
||||
"./parser-meriyah": "./plugins/meriyah.js",
|
||||
"./parser-meriyah.js": "./plugins/meriyah.js",
|
||||
"./esm/parser-meriyah.mjs": "./plugins/meriyah.mjs",
|
||||
"./parser-angular": "./plugins/angular.js",
|
||||
"./parser-angular.js": "./plugins/angular.js",
|
||||
"./esm/parser-angular.mjs": "./plugins/angular.mjs",
|
||||
"./parser-postcss": "./plugins/postcss.js",
|
||||
"./parser-postcss.js": "./plugins/postcss.js",
|
||||
"./esm/parser-postcss.mjs": "./plugins/postcss.mjs",
|
||||
"./parser-graphql": "./plugins/graphql.js",
|
||||
"./parser-graphql.js": "./plugins/graphql.js",
|
||||
"./esm/parser-graphql.mjs": "./plugins/graphql.mjs",
|
||||
"./parser-markdown": "./plugins/markdown.js",
|
||||
"./parser-markdown.js": "./plugins/markdown.js",
|
||||
"./esm/parser-markdown.mjs": "./plugins/markdown.mjs",
|
||||
"./parser-glimmer": "./plugins/glimmer.js",
|
||||
"./parser-glimmer.js": "./plugins/glimmer.js",
|
||||
"./esm/parser-glimmer.mjs": "./plugins/glimmer.mjs",
|
||||
"./parser-html": "./plugins/html.js",
|
||||
"./parser-html.js": "./plugins/html.js",
|
||||
"./esm/parser-html.mjs": "./plugins/html.mjs",
|
||||
"./parser-yaml": "./plugins/yaml.js",
|
||||
"./parser-yaml.js": "./plugins/yaml.js",
|
||||
"./esm/parser-yaml.mjs": "./plugins/yaml.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"THIRD-PARTY-NOTICES.md",
|
||||
"bin/prettier.cjs",
|
||||
"doc.d.ts",
|
||||
"doc.js",
|
||||
"doc.mjs",
|
||||
"index.cjs",
|
||||
"index.d.ts",
|
||||
"index.d.ts",
|
||||
"index.mjs",
|
||||
"internal/experimental-cli-worker.mjs",
|
||||
"internal/experimental-cli.mjs",
|
||||
"internal/legacy-cli.mjs",
|
||||
"package.json",
|
||||
"plugins/acorn.d.ts",
|
||||
"plugins/acorn.js",
|
||||
"plugins/acorn.mjs",
|
||||
"plugins/angular.d.ts",
|
||||
"plugins/angular.js",
|
||||
"plugins/angular.mjs",
|
||||
"plugins/babel.d.ts",
|
||||
"plugins/babel.js",
|
||||
"plugins/babel.mjs",
|
||||
"plugins/estree.d.ts",
|
||||
"plugins/estree.js",
|
||||
"plugins/estree.mjs",
|
||||
"plugins/flow.d.ts",
|
||||
"plugins/flow.js",
|
||||
"plugins/flow.mjs",
|
||||
"plugins/glimmer.d.ts",
|
||||
"plugins/glimmer.js",
|
||||
"plugins/glimmer.mjs",
|
||||
"plugins/graphql.d.ts",
|
||||
"plugins/graphql.js",
|
||||
"plugins/graphql.mjs",
|
||||
"plugins/html.d.ts",
|
||||
"plugins/html.js",
|
||||
"plugins/html.mjs",
|
||||
"plugins/markdown.d.ts",
|
||||
"plugins/markdown.js",
|
||||
"plugins/markdown.mjs",
|
||||
"plugins/meriyah.d.ts",
|
||||
"plugins/meriyah.js",
|
||||
"plugins/meriyah.mjs",
|
||||
"plugins/postcss.d.ts",
|
||||
"plugins/postcss.js",
|
||||
"plugins/postcss.mjs",
|
||||
"plugins/typescript.d.ts",
|
||||
"plugins/typescript.js",
|
||||
"plugins/typescript.mjs",
|
||||
"plugins/yaml.d.ts",
|
||||
"plugins/yaml.js",
|
||||
"plugins/yaml.mjs",
|
||||
"standalone.d.ts",
|
||||
"standalone.js",
|
||||
"standalone.mjs"
|
||||
],
|
||||
"preferUnplugged": true,
|
||||
"sideEffects": false,
|
||||
"type": "commonjs"
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
acorn: Parser;
|
||||
espree: Parser;
|
||||
};
|
||||
-16
File diff suppressed because one or more lines are too long
-16
File diff suppressed because one or more lines are too long
-8
@@ -1,8 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
__ng_action: Parser;
|
||||
__ng_binding: Parser;
|
||||
__ng_directive: Parser;
|
||||
__ng_interpolation: Parser;
|
||||
};
|
||||
-4
File diff suppressed because one or more lines are too long
-4
File diff suppressed because one or more lines are too long
-18
@@ -1,18 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
__babel_estree: Parser;
|
||||
__js_expression: Parser;
|
||||
__ts_expression: Parser;
|
||||
__vue_event_binding: Parser;
|
||||
__vue_expression: Parser;
|
||||
__vue_ts_event_binding: Parser;
|
||||
__vue_ts_expression: Parser;
|
||||
babel: Parser;
|
||||
"babel-flow": Parser;
|
||||
"babel-ts": Parser;
|
||||
json: Parser;
|
||||
"json-stringify": Parser;
|
||||
json5: Parser;
|
||||
jsonc: Parser;
|
||||
};
|
||||
-15
File diff suppressed because one or more lines are too long
-15
File diff suppressed because one or more lines are too long
-1
@@ -1 +0,0 @@
|
||||
export {};
|
||||
-44
File diff suppressed because one or more lines are too long
-44
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
flow: Parser;
|
||||
};
|
||||
-20
File diff suppressed because one or more lines are too long
-20
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
glimmer: Parser;
|
||||
};
|
||||
-37
File diff suppressed because one or more lines are too long
-37
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
graphql: Parser;
|
||||
};
|
||||
-28
File diff suppressed because one or more lines are too long
-28
File diff suppressed because one or more lines are too long
-9
@@ -1,9 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
angular: Parser;
|
||||
html: Parser;
|
||||
lwc: Parser;
|
||||
mjml: Parser;
|
||||
vue: Parser;
|
||||
};
|
||||
-24
File diff suppressed because one or more lines are too long
-24
File diff suppressed because one or more lines are too long
-7
@@ -1,7 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
markdown: Parser;
|
||||
mdx: Parser;
|
||||
remark: Parser;
|
||||
};
|
||||
-62
File diff suppressed because one or more lines are too long
-62
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
meriyah: Parser;
|
||||
};
|
||||
-5
File diff suppressed because one or more lines are too long
-5
File diff suppressed because one or more lines are too long
-7
@@ -1,7 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
css: Parser;
|
||||
less: Parser;
|
||||
scss: Parser;
|
||||
};
|
||||
-61
File diff suppressed because one or more lines are too long
-61
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
typescript: Parser;
|
||||
};
|
||||
-21
File diff suppressed because one or more lines are too long
-21
File diff suppressed because one or more lines are too long
-5
@@ -1,5 +0,0 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
yaml: Parser;
|
||||
};
|
||||
-159
File diff suppressed because one or more lines are too long
-159
File diff suppressed because one or more lines are too long
-33
@@ -1,33 +0,0 @@
|
||||
import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
|
||||
|
||||
/**
|
||||
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
|
||||
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted
|
||||
*
|
||||
* The cursorOffset option should be provided, to specify where the cursor is.
|
||||
*
|
||||
* ```js
|
||||
* await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
|
||||
* ```
|
||||
* `-> { formatted: "1;\n", cursorOffset: 1 }`
|
||||
*/
|
||||
export function formatWithCursor(
|
||||
source: string,
|
||||
options: CursorOptions,
|
||||
): Promise<CursorResult>;
|
||||
|
||||
/**
|
||||
* `format` is used to format text using Prettier. [Options](https://prettier.io/docs/options) may be provided to override the defaults.
|
||||
*/
|
||||
export function format(source: string, options?: Options): Promise<string>;
|
||||
|
||||
/**
|
||||
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
||||
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
||||
*/
|
||||
export function check(source: string, options?: Options): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
|
||||
*/
|
||||
export function getSupportInfo(): Promise<SupportInfo>;
|
||||
-29
File diff suppressed because one or more lines are too long
-29
File diff suppressed because one or more lines are too long
-27
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "b388654678d519d9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"prettier": "^3.7.4"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.7.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz",
|
||||
"integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"prettier": "^3.7.4"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"WARNING": "This file is automatically generated by act-runner. Do not edit it manually unless you know what you are doing. Removing this file will cause act runner to re-register as a new runner.",
|
||||
"id": 13,
|
||||
"uuid": "4ee0104d-dcfa-4132-82a8-7edcc28924d2",
|
||||
"name": "community-rule-test-runner",
|
||||
"token": "8691eca23d6825ace5acedb11253f42f95fa2ea5",
|
||||
"address": "https://git.medlab.host",
|
||||
"labels": [
|
||||
"self-hosted:host",
|
||||
"macos-latest:host"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
96184
|
||||
@@ -56,7 +56,7 @@ npm run monitor:all # All monitoring tools
|
||||
- **Performance monitoring**
|
||||
- **Code coverage reporting**
|
||||
|
||||
📖 **For detailed testing documentation, see [docs/TESTING.md](docs/TESTING.md)**
|
||||
📖 **For detailed testing documentation, see [docs/README.md](docs/README.md)**
|
||||
|
||||
## ⚡ Performance Optimizations
|
||||
|
||||
@@ -167,18 +167,34 @@ The Storybook configuration automatically detects the environment:
|
||||
community-rule/
|
||||
├── app/ # Next.js app directory
|
||||
│ ├── components/ # React components
|
||||
│ ├── layout.js # Root layout
|
||||
│ └── page.js # Homepage
|
||||
├── tests/ # Test files
|
||||
│ ├── unit/ # Unit tests (8 components)
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ ├── layout.tsx # Root layout
|
||||
│ └── page.tsx # Homepage
|
||||
├── config/ # Project-specific configuration
|
||||
│ ├── gitea-runner.yaml # Gitea runner configuration
|
||||
│ └── runner-config.yaml # Runner configuration
|
||||
├── docs/ # Documentation
|
||||
│ ├── README.md # Documentation index
|
||||
│ └── guides/ # Comprehensive guides
|
||||
│ ├── testing.md # Testing strategy
|
||||
│ ├── testing-framework.md # Testing framework details
|
||||
│ ├── testing-quick-reference.md # Quick reference
|
||||
│ ├── performance.md # Performance optimization
|
||||
│ ├── visual-regression.md # Visual testing
|
||||
│ └── content-creation.md # Content guidelines
|
||||
├── scripts/ # Utility scripts
|
||||
│ ├── start-runner.sh # Start Gitea runner
|
||||
│ ├── status-runner.sh # Check runner status
|
||||
│ └── stop-runner.sh # Stop Gitea runner
|
||||
├── tests/ # Test files
|
||||
│ ├── unit/ # Unit tests
|
||||
│ ├── integration/ # Integration tests
|
||||
│ └── e2e/ # E2E tests (4 test suites)
|
||||
├── docs/ # Documentation
|
||||
│ └── TESTING.md # Comprehensive testing guide
|
||||
│ ├── e2e/ # E2E tests
|
||||
│ └── accessibility/ # Accessibility tests
|
||||
├── .storybook/ # Storybook configuration
|
||||
├── .gitea/ # Gitea Actions workflows
|
||||
│ └── workflows/
|
||||
│ └── ci.yml # CI/CD pipeline
|
||||
│ └── ci.yaml # CI/CD pipeline
|
||||
└── public/ # Static assets
|
||||
```
|
||||
|
||||
@@ -193,15 +209,17 @@ community-rule/
|
||||
|
||||
## 📖 Documentation
|
||||
|
||||
- **[Testing Framework](docs/TESTING.md)** - Comprehensive testing guide
|
||||
- **[Documentation Index](docs/README.md)** - Complete documentation guide
|
||||
- **[Testing Guides](docs/guides/)** - Testing strategy, framework, and quick reference
|
||||
- **[Performance Guide](docs/guides/performance.md)** - Performance optimization guide
|
||||
- **[Visual Regression Guide](docs/guides/visual-regression.md)** - Visual testing guide
|
||||
- **[Storybook](http://localhost:6006)** - Component documentation (local)
|
||||
- **[GitHub Pages Storybook](https://your-username.github.io/communityrulestorybook/)** - Public component docs
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
1. **Fork the repository**
|
||||
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
|
||||
3. **Write tests first** (see [Testing Guide](docs/TESTING.md))
|
||||
3. **Write tests first** (see [Testing Guide](docs/guides/testing.md))
|
||||
4. **Make your changes**
|
||||
5. **Run tests**: `npm test && npm run e2e`
|
||||
6. **Commit changes**: `git commit -m "feat: add amazing feature"`
|
||||
@@ -219,16 +237,3 @@ community-rule/
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
<<<<<<< HEAD
|
||||
|
||||
# Test from working commit
|
||||
|
||||
=======
|
||||
|
||||
# Test trigger
|
||||
|
||||
> > > > > > > bead0c737303fb7e83b3be0c5dbd121b00351b90
|
||||
|
||||
# Test new runner
|
||||
|
||||
# Test host mode
|
||||
|
||||
BIN
Binary file not shown.
@@ -9,7 +9,7 @@
|
||||
<string>/Users/Vinod/Documents/GitHub/community-rule/act_runner</string>
|
||||
<string>daemon</string>
|
||||
<string>--config</string>
|
||||
<string>/Users/Vinod/Documents/GitHub/community-rule/config.yaml</string>
|
||||
<string>/Users/Vinod/Documents/GitHub/community-rule/config/gitea-runner.yaml</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Users/Vinod/Documents/GitHub/community-rule</string>
|
||||
+27
-77
@@ -1,86 +1,42 @@
|
||||
# Testing Documentation
|
||||
# Documentation Index
|
||||
|
||||
This directory contains comprehensive testing documentation for the CommunityRule platform.
|
||||
This directory contains all project documentation organized by topic.
|
||||
|
||||
## 📚 Documentation Structure
|
||||
|
||||
### 1. [testing-framework.md](./testing-framework.md) - **Main Guide**
|
||||
### Guides (`guides/`)
|
||||
|
||||
**Complete testing framework documentation** covering all aspects of testing:
|
||||
Comprehensive guides for different aspects of the project:
|
||||
|
||||
- Testing architecture and philosophy
|
||||
- Unit, integration, and E2E testing
|
||||
- Visual regression testing
|
||||
- Accessibility testing
|
||||
- Performance testing
|
||||
- CI/CD pipeline
|
||||
- Development workflow
|
||||
- Best practices and troubleshooting
|
||||
#### Testing
|
||||
- **[testing.md](./guides/testing.md)** - Complete testing strategy and philosophy
|
||||
- **[testing-framework.md](./guides/testing-framework.md)** - Detailed testing framework documentation
|
||||
- **[testing-quick-reference.md](./guides/testing-quick-reference.md)** - Quick reference for daily development
|
||||
- **[visual-regression.md](./guides/visual-regression.md)** - Visual regression testing guide
|
||||
|
||||
**Use this for**: Learning the testing framework, understanding architecture, comprehensive reference
|
||||
#### Performance
|
||||
- **[performance.md](./guides/performance.md)** - Performance optimization and monitoring guide
|
||||
|
||||
### 2. [testing-quick-reference.md](./testing-quick-reference.md) - **Quick Reference**
|
||||
#### Content
|
||||
- **[content-creation.md](./guides/content-creation.md)** - Content creation guidelines
|
||||
|
||||
**Essential commands and quick troubleshooting** for daily development:
|
||||
|
||||
- Essential test commands
|
||||
- Current test status and metrics
|
||||
- Common test patterns
|
||||
- Troubleshooting solutions
|
||||
- Performance budgets
|
||||
- CI/CD pipeline overview
|
||||
|
||||
**Use this for**: Daily development, quick commands, troubleshooting, reference
|
||||
|
||||
### 3. [visual-regression-guide.md](./visual-regression-guide.md) - **Visual Testing Guide**
|
||||
|
||||
**Focused guide for visual regression testing**:
|
||||
|
||||
- Visual regression workflow
|
||||
- Snapshot management
|
||||
- Configuration and best practices
|
||||
- Troubleshooting visual test issues
|
||||
- CI/CD integration for visual tests
|
||||
|
||||
**Use this for**: Visual regression testing, snapshot management, visual test troubleshooting
|
||||
|
||||
### 4. [performance-optimization-guide.md](./performance-optimization-guide.md) - **Performance Guide**
|
||||
|
||||
**Comprehensive performance optimization documentation**:
|
||||
|
||||
- Performance targets and metrics
|
||||
- Frontend optimizations (React.memo, code splitting, image optimization)
|
||||
- Performance monitoring and bundle analysis
|
||||
- Web Vitals tracking and dashboard
|
||||
- Performance testing and troubleshooting
|
||||
- Best practices and optimization strategies
|
||||
|
||||
**Use this for**: Performance optimization, monitoring, bundle analysis, Web Vitals tracking
|
||||
|
||||
## 🎯 How to Use These Documents
|
||||
## 🎯 Quick Navigation
|
||||
|
||||
### For New Team Members
|
||||
|
||||
1. Start with **testing-framework.md** to understand the complete testing strategy
|
||||
2. Use **testing-quick-reference.md** for daily development
|
||||
3. Reference **visual-regression-guide.md** when working with visual tests
|
||||
4. Review **performance-optimization-guide.md** for performance optimization
|
||||
1. Start with **[testing.md](./guides/testing.md)** to understand the testing strategy
|
||||
2. Use **[testing-quick-reference.md](./guides/testing-quick-reference.md)** for daily development
|
||||
3. Reference **[performance.md](./guides/performance.md)** for performance optimization
|
||||
|
||||
### For Daily Development
|
||||
- **[testing-quick-reference.md](./guides/testing-quick-reference.md)** - Essential commands and troubleshooting
|
||||
- **[testing-framework.md](./guides/testing-framework.md)** - Detailed testing explanations
|
||||
|
||||
1. Use **testing-quick-reference.md** for commands and troubleshooting
|
||||
2. Reference **testing-framework.md** for detailed explanations
|
||||
3. Use **visual-regression-guide.md** for visual test workflows
|
||||
4. Use **performance-optimization-guide.md** for performance monitoring
|
||||
### For Specific Topics
|
||||
- **Visual Testing**: [visual-regression.md](./guides/visual-regression.md)
|
||||
- **Performance**: [performance.md](./guides/performance.md)
|
||||
- **Content**: [content-creation.md](./guides/content-creation.md)
|
||||
|
||||
### For Troubleshooting
|
||||
|
||||
1. Check **testing-quick-reference.md** for common solutions
|
||||
2. Use **testing-framework.md** for detailed troubleshooting
|
||||
3. Reference **visual-regression-guide.md** for visual test issues
|
||||
4. Use **performance-optimization-guide.md** for performance issues
|
||||
|
||||
## 📊 Current Testing Status
|
||||
## 📊 Current Project Status
|
||||
|
||||
- **Unit Tests**: 94.88% coverage (exceeds 85% target)
|
||||
- **Integration Tests**: 5 comprehensive test suites
|
||||
@@ -90,17 +46,10 @@ This directory contains comprehensive testing documentation for the CommunityRul
|
||||
- **Performance**: Lighthouse CI with budgets
|
||||
- **Bundle Analysis**: Real-time monitoring with budgets
|
||||
- **Web Vitals Tracking**: Core Web Vitals collection
|
||||
- **Performance Optimization**: React.memo + code splitting
|
||||
|
||||
## 🔄 Documentation Updates
|
||||
|
||||
This documentation is maintained by the CommunityRule development team and updated regularly to reflect:
|
||||
|
||||
- Current testing framework status
|
||||
- Best practices and patterns
|
||||
- Troubleshooting solutions
|
||||
- CI/CD pipeline changes
|
||||
- New testing features
|
||||
This documentation is maintained by the CommunityRule development team and updated regularly.
|
||||
|
||||
## 📚 Additional Resources
|
||||
|
||||
@@ -108,8 +57,9 @@ This documentation is maintained by the CommunityRule development team and updat
|
||||
- **Playwright Documentation**: https://playwright.dev/
|
||||
- **React Testing Library**: https://testing-library.com/
|
||||
- **Lighthouse CI**: https://github.com/GoogleChrome/lighthouse-ci
|
||||
- **Next.js Documentation**: https://nextjs.org/docs
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: December 2024
|
||||
**Last Updated**: January 2025
|
||||
**Maintained by**: CommunityRule Development Team
|
||||
|
||||
@@ -1,275 +0,0 @@
|
||||
# Testing Quick Reference
|
||||
|
||||
## 🚀 Essential Commands
|
||||
|
||||
### Daily Development
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
npm test
|
||||
|
||||
# Watch mode (during development)
|
||||
npm run test:watch
|
||||
|
||||
# E2E tests
|
||||
npm run e2e
|
||||
|
||||
# Performance check
|
||||
npm run lhci
|
||||
```
|
||||
|
||||
### Manual Runner Management
|
||||
|
||||
```bash
|
||||
# Start runner (before creating PR)
|
||||
./start-runner.sh
|
||||
|
||||
# Check runner status
|
||||
./status-runner.sh
|
||||
|
||||
# Stop runner (after PR complete)
|
||||
./stop-runner.sh
|
||||
```
|
||||
|
||||
### Visual Regression
|
||||
|
||||
```bash
|
||||
# Update baselines after intentional changes
|
||||
npx playwright test tests/e2e/visual-regression.spec.ts --update-snapshots
|
||||
|
||||
# Check for visual changes
|
||||
npx playwright test tests/e2e/visual-regression.spec.ts
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
```bash
|
||||
# Debug unit tests
|
||||
npm run test:ui
|
||||
|
||||
# Debug E2E tests
|
||||
npm run e2e:ui
|
||||
|
||||
# Debug with browser
|
||||
npx playwright test --debug
|
||||
```
|
||||
|
||||
## 📝 Writing Tests
|
||||
|
||||
### Unit Test Template
|
||||
|
||||
```jsx
|
||||
// tests/unit/Component.test.jsx
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, test, expect, afterEach } from "vitest";
|
||||
import { cleanup } from "@testing-library/react";
|
||||
import Component from "../../app/components/Component";
|
||||
|
||||
describe("Component", () => {
|
||||
afterEach(() => cleanup());
|
||||
|
||||
test("renders correctly", () => {
|
||||
render(<Component />);
|
||||
expect(screen.getByRole("button")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### E2E Test Template
|
||||
|
||||
```typescript
|
||||
// tests/e2e/feature.spec.ts
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test.describe("Feature", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/");
|
||||
});
|
||||
|
||||
test("should work correctly", async ({ page }) => {
|
||||
await expect(page).toHaveTitle(/CommunityRule/);
|
||||
await expect(page.locator("h1")).toBeVisible();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## 🔧 Common Testing Patterns
|
||||
|
||||
### Testing User Interactions
|
||||
|
||||
```jsx
|
||||
// Unit test
|
||||
import userEvent from "@testing-library/user-event";
|
||||
|
||||
test("handles user input", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<Form />);
|
||||
|
||||
await user.type(screen.getByLabelText("Email"), "test@example.com");
|
||||
await user.click(screen.getByRole("button", { name: "Submit" }));
|
||||
|
||||
expect(screen.getByText("Success")).toBeInTheDocument();
|
||||
});
|
||||
```
|
||||
|
||||
### Testing Async Operations
|
||||
|
||||
```jsx
|
||||
// Unit test
|
||||
test("loads data", async () => {
|
||||
render(<DataComponent />);
|
||||
|
||||
expect(screen.getByText("Loading...")).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Data loaded")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Testing Accessibility
|
||||
|
||||
```typescript
|
||||
// E2E test
|
||||
import { runA11y } from "./axe";
|
||||
|
||||
test("meets accessibility standards", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const violations = await runA11y(page);
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
```
|
||||
|
||||
## 🎯 Test Coverage Targets
|
||||
|
||||
- **Lines**: 85%
|
||||
- **Functions**: 85%
|
||||
- **Statements**: 85%
|
||||
- **Branches**: 80%
|
||||
|
||||
## 🚨 Common Issues & Solutions
|
||||
|
||||
### Unit Tests
|
||||
|
||||
```bash
|
||||
# Issue: JSX not parsing in .js files
|
||||
# Solution: Ensure vitest.config.js has proper esbuild config
|
||||
|
||||
# Issue: Component not rendering
|
||||
# Solution: Check imports and component exports
|
||||
|
||||
# Issue: Test cleanup errors
|
||||
# Solution: Add afterEach(cleanup()) to test suites
|
||||
```
|
||||
|
||||
### E2E Tests
|
||||
|
||||
```bash
|
||||
# Issue: Element not found
|
||||
# Solution: Use semantic selectors (role, text, label)
|
||||
|
||||
# Issue: Test timeout
|
||||
# Solution: Add proper waitFor or waitForLoadState
|
||||
|
||||
# Issue: Multiple elements with same selector
|
||||
# Solution: Use .first(), .nth(), or more specific selectors
|
||||
```
|
||||
|
||||
### Visual Regression
|
||||
|
||||
```bash
|
||||
# Issue: Screenshots don't match
|
||||
# Solution: Check if changes are intentional, then update baselines
|
||||
|
||||
# Issue: Elements not visible
|
||||
# Solution: Ensure elements are in viewport before screenshot
|
||||
```
|
||||
|
||||
## 📊 Performance Budgets
|
||||
|
||||
### Lighthouse CI Targets
|
||||
|
||||
- **Performance Score**: >90
|
||||
- **Accessibility Score**: >95
|
||||
- **Best Practices**: >90
|
||||
- **SEO Score**: >90
|
||||
|
||||
### Core Web Vitals
|
||||
|
||||
- **LCP**: <2.5s
|
||||
- **FID**: <100ms
|
||||
- **CLS**: <0.1
|
||||
|
||||
## 🔄 CI/CD Pipeline Jobs
|
||||
|
||||
1. **Unit Tests** (Node 18, 20)
|
||||
2. **E2E Tests** (Chromium, Firefox, WebKit)
|
||||
3. **Visual Regression Tests**
|
||||
4. **Performance Tests**
|
||||
5. **Storybook Tests**
|
||||
6. **Lint & Format**
|
||||
7. **Build Verification**
|
||||
|
||||
## 📁 Test File Structure
|
||||
|
||||
```
|
||||
tests/
|
||||
├── unit/ # Component tests
|
||||
│ ├── Button.test.jsx
|
||||
│ ├── HeroBanner.test.jsx
|
||||
│ └── ...
|
||||
├── integration/ # Integration tests
|
||||
│ └── ContentLockup.integration.test.jsx
|
||||
└── e2e/ # E2E tests
|
||||
├── homepage.spec.ts
|
||||
├── user-journeys.spec.ts
|
||||
├── edge-cases.spec.ts
|
||||
└── visual-regression.spec.ts
|
||||
```
|
||||
|
||||
## 🎨 Visual Regression Screenshots
|
||||
|
||||
### Generated Screenshots
|
||||
|
||||
- Full page (mobile, tablet, desktop)
|
||||
- Component sections (hero, logo wall, cards)
|
||||
- Interactive states (hover, focus, loading)
|
||||
- Special modes (dark, high contrast, reduced motion)
|
||||
|
||||
### Managing Changes
|
||||
|
||||
```bash
|
||||
# Intentional changes
|
||||
npx playwright test tests/e2e/visual-regression.spec.ts --update-snapshots
|
||||
|
||||
# Review changes
|
||||
npx playwright test tests/e2e/visual-regression.spec.ts
|
||||
```
|
||||
|
||||
## 📈 Monitoring
|
||||
|
||||
### Test Metrics
|
||||
|
||||
- **Unit Tests**: 124 tests
|
||||
- **E2E Tests**: 308 tests (4 browsers)
|
||||
- **Visual Screenshots**: 92 baselines
|
||||
- **Coverage**: >85% target
|
||||
|
||||
### CI Metrics
|
||||
|
||||
- **Pipeline Jobs**: 7 parallel jobs
|
||||
- **Execution Time**: Monitor build performance
|
||||
- **Success Rate**: Track pipeline stability
|
||||
- **Artifacts**: Test results and screenshots
|
||||
|
||||
## 🔗 Useful Links
|
||||
|
||||
- [Full Testing Documentation](TESTING.md)
|
||||
- [Vitest Docs](https://vitest.dev/)
|
||||
- [Playwright Docs](https://playwright.dev/)
|
||||
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)
|
||||
- [Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci)
|
||||
|
||||
---
|
||||
|
||||
**Quick Reference Version**: December 2024
|
||||
@@ -345,7 +345,7 @@ git commit -m "Update visual regression snapshots for [describe changes]"
|
||||
|
||||
## 🔗 Useful Links
|
||||
|
||||
- **Full Testing Documentation**: [docs/testing-framework.md](./testing-framework.md)
|
||||
- **Full Testing Documentation**: [docs/guides/testing-framework.md](./testing-framework.md)
|
||||
- **Vitest Docs**: https://vitest.dev/
|
||||
- **Playwright Docs**: https://playwright.dev/
|
||||
- **React Testing Library**: https://testing-library.com/docs/react-testing-library/intro/
|
||||
@@ -379,10 +379,11 @@ Visual regression tests run automatically in the CI pipeline:
|
||||
|
||||
## 📚 Additional Resources
|
||||
|
||||
- **Main Testing Documentation**: [testing-framework.md](./testing-framework.md)
|
||||
- **Main Testing Documentation**: [testing-framework.md](./testing-framework.md) | [testing.md](./testing.md)
|
||||
- **Playwright Visual Testing**: https://playwright.dev/docs/screenshots
|
||||
- **Visual Regression Best Practices**: https://storybook.js.org/docs/writing-tests/visual-testing
|
||||
- **CI/CD Integration**: [testing-quick-reference.md](./testing-quick-reference.md)
|
||||
- **Performance Guide**: [performance.md](./performance.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
{
|
||||
"ci": {
|
||||
"collect": {
|
||||
"url": [
|
||||
"http://127.0.0.1:3010/",
|
||||
"http://127.0.0.1:3010/blog",
|
||||
"http://127.0.0.1:3010/blog/resolving-active-conflicts"
|
||||
],
|
||||
"numberOfRuns": 3,
|
||||
"settings": {
|
||||
"preset": "desktop",
|
||||
"throttling": {
|
||||
"rttMs": 40,
|
||||
"throughputKbps": 10240,
|
||||
"cpuSlowdownMultiplier": 1,
|
||||
"requestLatencyMs": 0,
|
||||
"downloadThroughputKbps": 0,
|
||||
"uploadThroughputKbps": 0
|
||||
},
|
||||
"chromeFlags": [
|
||||
"--disable-web-security",
|
||||
"--disable-features=VizDisplayCompositor",
|
||||
"--ignore-certificate-errors",
|
||||
"--ignore-ssl-errors",
|
||||
"--ignore-certificate-errors-spki-list",
|
||||
"--allow-running-insecure-content",
|
||||
"--disable-extensions",
|
||||
"--no-sandbox",
|
||||
"--disable-setuid-sandbox",
|
||||
"--disable-dev-shm-usage",
|
||||
"--disable-gpu",
|
||||
"--headless"
|
||||
]
|
||||
}
|
||||
},
|
||||
"assert": {
|
||||
"assertions": {
|
||||
"categories:performance": ["error", { "minScore": 0.9 }],
|
||||
"categories:accessibility": ["warn", { "minScore": 0.95 }],
|
||||
"categories:best-practices": ["warn", { "minScore": 0.9 }],
|
||||
"categories:seo": ["warn", { "minScore": 0.9 }],
|
||||
"first-contentful-paint": ["warn", { "maxNumericValue": 2000 }],
|
||||
"largest-contentful-paint": ["warn", { "maxNumericValue": 2500 }],
|
||||
"first-meaningful-paint": ["warn", { "maxNumericValue": 2000 }],
|
||||
"speed-index": ["warn", { "maxNumericValue": 3000 }],
|
||||
"interactive": ["warn", { "maxNumericValue": 3000 }],
|
||||
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
|
||||
"cumulative-layout-shift": ["warn", { "maxNumericValue": 0.1 }],
|
||||
"max-potential-fid": ["warn", { "maxNumericValue": 130 }],
|
||||
"server-response-time": ["warn", { "maxNumericValue": 600 }],
|
||||
"render-blocking-resources": ["warn", { "maxLength": 0 }],
|
||||
"unused-css-rules": ["warn", { "maxLength": 0 }],
|
||||
"unused-javascript": ["warn", { "maxLength": 0 }],
|
||||
"modern-image-formats": ["warn", { "maxLength": 0 }],
|
||||
"uses-optimized-images": ["warn", { "maxLength": 0 }],
|
||||
"uses-text-compression": ["warn", { "maxLength": 0 }],
|
||||
"uses-responsive-images": ["warn", { "maxLength": 0 }],
|
||||
"efficient-animated-content": ["warn", { "maxLength": 0 }],
|
||||
"preload-lcp-image": ["warn", { "maxLength": 0 }],
|
||||
"total-byte-weight": ["warn", { "maxNumericValue": 500000 }],
|
||||
"uses-long-cache-ttl": ["warn", { "maxLength": 0 }],
|
||||
"dom-size": ["warn", { "maxNumericValue": 1500 }],
|
||||
"critical-request-chains": ["warn", { "maxLength": 0 }],
|
||||
"user-timings": ["warn", { "maxLength": 0 }],
|
||||
"bootup-time": ["warn", { "maxNumericValue": 1000 }],
|
||||
"mainthread-work-breakdown": ["warn", { "maxLength": 0 }],
|
||||
"font-display": ["warn", { "maxLength": 0 }],
|
||||
"resource-summary": ["warn", { "maxLength": 0 }],
|
||||
"third-party-summary": ["warn", { "maxLength": 0 }],
|
||||
"largest-contentful-paint-element": ["warn", { "maxLength": 0 }],
|
||||
"layout-shift-elements": ["warn", { "maxLength": 0 }],
|
||||
"long-tasks": ["warn", { "maxLength": 0 }],
|
||||
"non-composited-animations": ["warn", { "maxLength": 0 }],
|
||||
"unsized-images": ["warn", { "maxLength": 0 }]
|
||||
}
|
||||
},
|
||||
"upload": {
|
||||
"target": "temporary-public-storage",
|
||||
"outputDir": "./lighthouse-results"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"onlyCategories": ["performance", "accessibility", "best-practices", "seo"],
|
||||
"skipAudits": ["uses-http2"],
|
||||
"formFactor": "desktop",
|
||||
"throttling": {
|
||||
"rttMs": 40,
|
||||
"throughputKbps": 10240,
|
||||
"cpuSlowdownMultiplier": 1,
|
||||
"requestLatencyMs": 0,
|
||||
"downloadThroughputKbps": 0,
|
||||
"uploadThroughputKbps": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -22,8 +22,8 @@
|
||||
"e2e:ui": "playwright test --ui",
|
||||
"e2e:performance": "playwright test tests/e2e/performance.spec.ts",
|
||||
"lhci": "lhci autorun",
|
||||
"lhci:mobile": "lhci autorun --config=.lighthouserc.json --settings.preset=mobile",
|
||||
"lhci:desktop": "lhci autorun --config=.lighthouserc.json --settings.preset=desktop",
|
||||
"lhci:mobile": "lhci autorun --settings.preset=mobile",
|
||||
"lhci:desktop": "lhci autorun --settings.preset=desktop",
|
||||
"performance:budget": "lhci autorun --budgetPath=performance-budgets.json",
|
||||
"performance:monitor": "node scripts/performance-monitor.js",
|
||||
"test:lhci": "node scripts/test-lhci.js",
|
||||
|
||||
@@ -17,12 +17,12 @@ echo "✅ Node.js found: $(which node) - $(node -v)"
|
||||
# Check if runner is already running
|
||||
if pgrep -f "act_runner daemon" > /dev/null; then
|
||||
echo "⚠️ Runner is already running!"
|
||||
echo "To stop it, run: ./stop-runner.sh"
|
||||
echo "To stop it, run: ./scripts/stop-runner.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start the runner in the background with proper PATH
|
||||
PATH="/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:$PATH" ./act_runner daemon --config config.yaml &
|
||||
PATH="/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:$PATH" ./act_runner daemon --config config/gitea-runner.yaml &
|
||||
RUNNER_PID=$!
|
||||
|
||||
# Save PID to file for easy stopping
|
||||
@@ -31,5 +31,5 @@ echo $RUNNER_PID > .runner.pid
|
||||
echo "✅ Runner started with PID: $RUNNER_PID"
|
||||
echo "📝 Logs will be written to: runner.log"
|
||||
echo ""
|
||||
echo "To stop the runner, run: ./stop-runner.sh"
|
||||
echo "To check status, run: ./status-runner.sh"
|
||||
echo "To stop the runner, run: ./scripts/stop-runner.sh"
|
||||
echo "To check status, run: ./scripts/status-runner.sh"
|
||||
@@ -15,11 +15,11 @@ if pgrep -f "act_runner daemon" > /dev/null; then
|
||||
echo "No log file found"
|
||||
fi
|
||||
echo ""
|
||||
echo "To stop the runner: ./stop-runner.sh"
|
||||
echo "To stop the runner: ./scripts/stop-runner.sh"
|
||||
else
|
||||
echo "❌ Runner is NOT RUNNING"
|
||||
echo ""
|
||||
echo "To start the runner: ./start-runner.sh"
|
||||
echo "To start the runner: ./scripts/start-runner.sh"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
Reference in New Issue
Block a user