Skip to content

Commit

Permalink
ci: add auto-prettier (#694)
Browse files Browse the repository at this point in the history
Co-authored-by: ascorbic <[email protected]>
  • Loading branch information
ascorbic and ascorbic authored Sep 19, 2024
1 parent 20dbe59 commit 2a352c7
Show file tree
Hide file tree
Showing 70 changed files with 854 additions and 2,254 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

43 changes: 0 additions & 43 deletions .eslintrc.cjs

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Format

on:
push:
branches: [main]
workflow_dispatch:
pull_request:
branches: [main]
permissions:
contents: write
pull-requests: write

jobs:
format:
runs-on: ubuntu-latest
name: Format Files
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: "pnpm"
check-latest: true
registry-url: "https://registry.npmjs.org"
node-version: latest
- name: Install dependencies
run: |
corepack enable
pnpm install
- name: Format
run: pnpm format
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: stefanzweifel/git-auto-commit-action@v4
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
with:
commit_message: "chore: format"
10 changes: 9 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
package.json
CHANGELOG..md
CHANGELOG.md
.angular
.astro
.netlify
.github
cache
.svelte-kit
svelte/build
pnpm-lock.yaml
6 changes: 2 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"proseWrap": "always",
"plugins": [
"prettier-plugin-astro"
],
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
Expand All @@ -11,4 +9,4 @@
}
}
]
}
}
10 changes: 3 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"deno.enablePaths": [
"docs/netlify/edge-functions"
],
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
"deno.enablePaths": ["docs/netlify/edge-functions"],
"githubPullRequests.ignoredPullRequestBranches": ["main"]
}
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm create astro@latest -- --template docs

## 🧞 Commands

All commands are run from the root of the project, from a terminal:
All commands are run from the root of the project, from a terminal:

| Command | Action |
| :--------------------- | :----------------------------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"jsx": "preserve",
"skipLibCheck": true,
"jsxImportSource": "preact",
"strictNullChecks": true,
"strictNullChecks": true
},
"include": ["./src/**/*"],
"exclude": ["./node_modules", "./dist"],
"exclude": ["./node_modules", "./dist"]
}
29 changes: 7 additions & 22 deletions examples/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@
"outputPath": "dist/angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -81,22 +74,14 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
}
}
}
}
}
}
}
68 changes: 52 additions & 16 deletions examples/angular/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
<main>
<img unpic
<img
unpic
src="https://images.unsplash.com/photo-1617718295766-0f839c2853e7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTczfHxyYWluZm9yZXN0JTIwYmVhY2h8ZW58MHx8MHx8&auto=format&fit=crop&w=900&q=60"
layout="fullWidth" alt="" priority height="400" background="auto" />
<img unpic src="https://cdn.shopify.com/static/sample-images/garnished.jpeg" layout="constrained" width="800"
height="600" alt="Shopify" />
<img unpic src="https://bunnyoptimizerdemo.b-cdn.net/bunny7.jpg?width=300" width="400" height="300" layout="fixed"
alt="Bunny.net" />
layout="fullWidth"
alt=""
priority
height="400"
background="auto"
/>
<img
unpic
src="https://cdn.shopify.com/static/sample-images/garnished.jpeg"
layout="constrained"
width="800"
height="600"
alt="Shopify"
/>
<img
unpic
src="https://bunnyoptimizerdemo.b-cdn.net/bunny7.jpg?width=300"
width="400"
height="300"
layout="fixed"
alt="Bunny.net"
/>
<form [formGroup]="imageForm">
<label>
Width:
Expand All @@ -17,18 +35,38 @@
</label>
</form>

<img unpic src="https://bunnyoptimizerdemo.b-cdn.net/bunny7.jpg?width=300" [width]="width" [height]="height" />
<img
unpic
src="https://bunnyoptimizerdemo.b-cdn.net/bunny7.jpg?width=300"
[width]="width"
[height]="height"
/>
<div>
<picture class="hero">
<!-- Large screens get a full-width hero image -->
<source unpic src="https://images.unsplash.com/photo-1694406805270-f3a93e91f4b6" media="(min-width: 601px)"
layout="fullWidth" />
<source
unpic
src="https://images.unsplash.com/photo-1694406805270-f3a93e91f4b6"
media="(min-width: 601px)"
layout="fullWidth"
/>
<!-- Small screens get a constrained square image -->
<source unpic src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364" media="(max-width: 600px)"
width="600" height="600" />
<source
unpic
src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364"
media="(max-width: 600px)"
width="600"
height="600"
/>
<!-- Always include an Image as the final element -->
<img unpic src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364" width="600" height="600"
alt="Aurora" unstyled />
<img
unpic
src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364"
width="600"
height="600"
alt="Aurora"
unstyled
/>
</picture>
</div>
<style>
Expand All @@ -39,20 +77,18 @@
}

@media (min-width: 601px) {

/* Style for full-width layout */
.hero img {
height: 600px;
}
}

@media (max-width: 600px) {

/* Style for constrained layout */
.hero img {
max-width: 600px;
aspect-ratio: 1/1;
}
}
</style>
</main>
</main>
8 changes: 4 additions & 4 deletions examples/angular/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
declarations: [AppComponent],
}).compileComponents();
});

Expand All @@ -26,6 +24,8 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('angular app is running!');
expect(compiled.querySelector('.content span')?.textContent).toContain(
'angular app is running!',
);
});
});
6 changes: 3 additions & 3 deletions examples/angular/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';


platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
8 changes: 2 additions & 6 deletions examples/angular/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"]
}
5 changes: 1 addition & 4 deletions examples/angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
"dom"
]
"lib": ["ES2022", "dom"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
9 changes: 2 additions & 7 deletions examples/angular/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
"types": ["jasmine"]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}
9 changes: 6 additions & 3 deletions examples/astro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ Inside of your Astro project, you'll see the following folders and files:
└── package.json
```

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page
is exposed as a route based on its file name.

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
There's nothing special about `src/components/`, but that's where we like to put
any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the `public/` directory.

Expand All @@ -43,4 +45,5 @@ All commands are run from the root of the project, from a terminal:

## 👀 Want to learn more?

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
Feel free to check [our documentation](https://docs.astro.build) or jump into
our [Discord server](https://astro.build/chat).
Loading

0 comments on commit 2a352c7

Please sign in to comment.