Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): check for diff after running prettier #2981

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ jobs:
run: npm ci --legacy-peer-deps
- name: Lint
run: npm run lint
# Lint changes should be pushed
# to the branch before the branch
# is merge eligible.
- name: Check Diff
run: git diff --exit-code
shell: bash
7 changes: 4 additions & 3 deletions versioned_docs/version-v5/api/item.md
Original file line number Diff line number Diff line change
Expand Up @@ -1033,13 +1033,14 @@ export class ItemExample {
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
,<ion-item lines="none">
<ion-item lines="none">
<ion-label>No Lines Item</ion-label>
</ion-item>,<ion-item>
<ion-label class="ion-text-wrap">
Multiline text that should wrap when it is too long to fit on one line in the item.
</ion-label>
</ion-item>,<ion-item>
</ion-item>
<ion-item>
<ion-label class="ion-text-wrap">
<ion-text color="primary">
<h3>H3 Primary Title</h3>
Expand All @@ -1049,7 +1050,7 @@ export class ItemExample {
<p>Paragraph line 2 secondary</p>
</ion-text>
</ion-label>
</ion-item>,
</ion-item>
<ion-item lines="full">
<ion-label>Item with Full Lines</ion-label>
</ion-item>
Expand Down
18 changes: 9 additions & 9 deletions versioned_docs/version-v5/native/background-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DocsCard from '@components/global/DocsCard';
import DocsButton from '@components/page/native/DocsButton';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

# Background Fetch

Expand Down Expand Up @@ -57,16 +56,17 @@ For more detail, please see https://github.com/transistorsoft/cordova-plugin-bac
]}
>
<TabItem value="Capacitor">
<CodeBlock className="language-shell">
$ npm install cordova-plugin-background-fetch {'\n'}$ npm install @awesome-cordova-plugins/background-fetch {'\n'}
$ ionic cap sync
</CodeBlock>

$ npm install cordova-plugin-background-fetch
$ npm install @awesome-cordova-plugins/background-fetch
$ ionic cap sync

</TabItem>
<TabItem value="Cordova">
<CodeBlock className="language-shell">
$ ionic cordova plugin add cordova-plugin-background-fetch {'\n'}$ npm install
@awesome-cordova-plugins/background-fetch {'\n'}
</CodeBlock>

Copy link
Contributor

@thetaPC thetaPC May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the removal of <CodeBlock> expected? Same question applies to the other files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the change is intentional here.

The project currently has a weird formatting issue, where every-other-time you run prettier, it will either format these files with additional whitespace or remove the additional whitespace.

To avoid this scenario and have consistent prettier formatting across runs, I removed the <CodeBlock> element from the offending pages and used the $ syntax highlighting directly for the code blocks. It does remove some syntax highlighting, but I think that is acceptable for a few reasons:

  1. The native plugin pages no longer exist (these are legacy pages)
  2. Prettier formatting inconsistently will block our CI process once the git diff check is enabled.
  3. The code blocks are still formatted/styled, they just don't have syntax highlighting on parts of the bash command (which I don't think exists when using markdown formatting anyways).

$ ionic cordova plugin add cordova-plugin-background-fetch
$ npm install @awesome-cordova-plugins/background-fetch

</TabItem>
<TabItem value="Enterprise">
<blockquote>
Expand Down
18 changes: 9 additions & 9 deletions versioned_docs/version-v5/native/bluetooth-serial.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DocsCard from '@components/global/DocsCard';
import DocsButton from '@components/page/native/DocsButton';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

# Bluetooth Serial

Expand Down Expand Up @@ -50,16 +49,17 @@ This plugin enables serial communication over Bluetooth. It was written for comm
]}
>
<TabItem value="Capacitor">
<CodeBlock className="language-shell">
$ npm install cordova-plugin-bluetooth-serial {'\n'}$ npm install @awesome-cordova-plugins/bluetooth-serial {'\n'}
$ ionic cap sync
</CodeBlock>

$ npm install cordova-plugin-bluetooth-serial
$ npm install @awesome-cordova-plugins/bluetooth-serial
$ ionic cap sync

</TabItem>
<TabItem value="Cordova">
<CodeBlock className="language-shell">
$ ionic cordova plugin add cordova-plugin-bluetooth-serial {'\n'}$ npm install
@awesome-cordova-plugins/bluetooth-serial {'\n'}
</CodeBlock>

$ ionic cordova plugin add cordova-plugin-bluetooth-serial
$ npm install @awesome-cordova-plugins/bluetooth-serial

</TabItem>
<TabItem value="Enterprise">
<blockquote>
Expand Down
18 changes: 9 additions & 9 deletions versioned_docs/version-v5/native/document-scanner.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DocsCard from '@components/global/DocsCard';
import DocsButton from '@components/page/native/DocsButton';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

# Document Scanner

Expand Down Expand Up @@ -55,16 +54,17 @@ This plugin processes images of documents, compensating for perspective.
]}
>
<TabItem value="Capacitor">
<CodeBlock className="language-shell">
$ npm install cordova-plugin-document-scanner {'\n'}$ npm install @awesome-cordova-plugins/document-scanner {'\n'}
$ ionic cap sync
</CodeBlock>

$ npm install cordova-plugin-document-scanner
$ npm install @awesome-cordova-plugins/document-scanner
$ ionic cap sync

</TabItem>
<TabItem value="Cordova">
<CodeBlock className="language-shell">
$ ionic cordova plugin add cordova-plugin-document-scanner {'\n'}$ npm install
@awesome-cordova-plugins/document-scanner {'\n'}
</CodeBlock>

$ ionic cordova plugin add cordova-plugin-document-scanner
$ npm install @awesome-cordova-plugins/document-scanner

</TabItem>
<TabItem value="Enterprise">
<blockquote>
Expand Down
18 changes: 9 additions & 9 deletions versioned_docs/version-v5/native/firebase-vision.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DocsCard from '@components/global/DocsCard';
import DocsButton from '@components/page/native/DocsButton';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

# Firebase Vision

Expand Down Expand Up @@ -55,16 +54,17 @@ Cordova plugin for Firebase MLKit Vision
]}
>
<TabItem value="Capacitor">
<CodeBlock className="language-shell">
$ npm install cordova-plugin-firebase-mlvision {'\n'}$ npm install @awesome-cordova-plugins/firebase-vision {'\n'}
$ ionic cap sync
</CodeBlock>

$ npm install cordova-plugin-firebase-mlvision
$ npm install @awesome-cordova-plugins/firebase-vision
$ ionic cap sync

</TabItem>
<TabItem value="Cordova">
<CodeBlock className="language-shell">
$ ionic cordova plugin add cordova-plugin-firebase-mlvision {'\n'}$ npm install
@awesome-cordova-plugins/firebase-vision {'\n'}
</CodeBlock>

$ ionic cordova plugin add cordova-plugin-firebase-mlvision
$ npm install @awesome-cordova-plugins/firebase-vision

</TabItem>
<TabItem value="Enterprise">
<blockquote>
Expand Down
18 changes: 9 additions & 9 deletions versioned_docs/version-v5/native/google-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DocsCard from '@components/global/DocsCard';
import DocsButton from '@components/page/native/DocsButton';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

# Google Analytics

Expand Down Expand Up @@ -55,16 +54,17 @@ Prerequisites:
]}
>
<TabItem value="Capacitor">
<CodeBlock className="language-shell">
$ npm install cordova-plugin-google-analytics {'\n'}$ npm install @awesome-cordova-plugins/google-analytics {'\n'}
$ ionic cap sync
</CodeBlock>

$ npm install cordova-plugin-google-analytics
$ npm install @awesome-cordova-plugins/google-analytics
$ ionic cap sync

</TabItem>
<TabItem value="Cordova">
<CodeBlock className="language-shell">
$ ionic cordova plugin add cordova-plugin-google-analytics {'\n'}$ npm install
@awesome-cordova-plugins/google-analytics {'\n'}
</CodeBlock>

$ ionic cordova plugin add cordova-plugin-google-analytics
$ npm install @awesome-cordova-plugins/google-analytics

</TabItem>
<TabItem value="Enterprise">
<blockquote>
Expand Down