Skip to content

Commit

Permalink
ci: linter v2 (#30480)
Browse files Browse the repository at this point in the history
PR to start introducing Linter V2!

Primary improvements from this linter:

Better parsing of MDX (fewer false positives)
More flexibility
And suggested autofixes! (see auto-generated PR comment below for how that works)
Turning this on for only a small portion of the repo at first to avoid an avalanche of alerts, will slowly expand from there.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
charislam and github-actions[bot] authored Nov 22, 2024
1 parent dbbbc20 commit d9a1a61
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 139 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docs-lint-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: '[Docs] Lint v2'
on:
pull_request:
paths:
- '.github/workflows/docs-lint-v2.yml'
- 'supa-mdx-lint.config.toml'
- 'apps/docs/content/**'

env:
CARGO_NET_GIT_FETCH_WITH_CLI: true

jobs:
supa-mdx-lint:
name: supa-mdx-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: |
supa-mdx-lint.config.toml
apps/docs/content
- name: cache cargo
id: cache-cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: 9fd8c8fa7487a3d454a676e6e3d7409af34fc715
- name: install linter
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 9fd8c8fa7487a3d454a676e6e3d7409af34fc715
- name: install reviewdog
uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0
with:
reviewdog_version: v0.20.2
- name: run linter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
supa-mdx-lint apps/docs/content/guides/getting-started --format rdf | reviewdog -f=rdjsonl -reporter=github-pr-review
3 changes: 2 additions & 1 deletion .github/workflows/lint-prose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
echo "CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT origin/$BASE_REF $SHA | grep '^apps/docs/content/' | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_OUTPUT
- uses: errata-ai/vale-action@reviewdog
with:
files: ${{ steps.changed-files.outputs.CHANGED_FILES }}
files: '${{ steps.changed-files.outputs.CHANGED_FILES }}'
separator: ','
14 changes: 7 additions & 7 deletions apps/docs/content/guides/getting-started/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Every project is a full Postgres database. [Docs](/docs/guides/database).

Store vector embeddings right next to the rest of your data. [Docs](/docs/guides/ai).

### Auto-generated Rest API via PostgREST
### Auto-generated REST API via PostgREST

RESTful APIs are auto-generated from your database, without a single line of code. [Docs](/docs/guides/api#rest-api-overview).

Expand Down Expand Up @@ -66,13 +66,13 @@ Deploy read-only databases across multiple regions, for lower latency and better

Launch the Supabase stack on Fly.io edge network. [Docs](/docs/guides/platform/fly-postgres).

### Log Drains
### Log drains

Export Supabase logs at to 3rd party providers and external tooling. [Docs](/docs/guides/platform/log-drains).

## Studio

### Studio Single Sign On
### Studio Single Sign-On

Login to the Supabase dashboard via SSO. [Docs](/docs/guides/platform/sso).

Expand Down Expand Up @@ -118,7 +118,7 @@ Control the data each user can access with Postgres Policies. [Docs](/docs/guide

Add Captcha to your sign-in, sign-up, and password reset forms. [Docs](/docs/guides/auth/auth-captcha).

### Server-side Auth
### Server-Side Auth

Helpers for implementing user authentication in popular server-side languages and frameworks like Next.js, SvelteKit and Remix. [Docs](/docs/guides/auth/server-side).

Expand Down Expand Up @@ -183,19 +183,19 @@ Unofficial libraries are supported by the community.

Supabase Features are in 4 different states - Private Alpha, Public Alpha, Beta and Generally Available.

### Private Alpha
### Private alpha

Features are initially launched as a private alpha to gather feedback from the community. To join our early access program, send an email to product-ops@supabase.io.

### Public Alpha
### Public alpha

The alpha stage indicates that the API might change in the future, not that the service isn’t stable. Even though the [uptime Service Level Agreement](https://supabase.com/sla) does not cover products in Alpha, we do our best to have the service as stable as possible.

### Beta

Features in Beta are tested by an external penetration tester for security issues. The API is guaranteed to be stable and there is a strict communication process for breaking changes.

### Generally Available
### Generally available

In addition to the Beta requirements, features in GA are covered by the [uptime SLA](https://supabase.com/sla).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ plugins {
}
```

{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}

### Set up Hilt for dependency injection

In the `build.gradle` (app) file, add the following:
Expand Down Expand Up @@ -134,6 +136,8 @@ class MainActivity : ComponentActivity() {
}
```

{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}

### Provide Supabase instances with Hilt

To make the app easier to test, create a `SupabaseModule.kt` file as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ meta="utils/supabase/middleware.ts"

## Set up a login page

### Login and Signup form
### Login and signup form

Create a login/signup page for your application:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ You can find the full contents of this file [here](https://raw.githubusercontent

In order for us to add login and user profile pages in this App, we have to tweak the `<Refine />` component inside `App.tsx`.

### The `<Refine />` Component
### The `<Refine />` component

The `App.tsx` file initially looks like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ Update the entry point to the newly created `AppView`. Run in Xcode to launch yo
Every Supabase project is configured with [Storage](/docs/guides/storage) for managing large files like
photos and videos.

{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}

### Add PhotosPicker

Let's add support for the user to pick an image from the library and upload it.
Expand Down Expand Up @@ -332,6 +334,8 @@ enum TransferError: Error {
}
```

{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}

#### Add PhotosPicker to profile page

```swift ProfileView.swift
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"author": "Supabase, Inc.",
"license": "Apache-2.0",
"private": true,
"workspaces": ["apps/*", "tests", "playwright-tests", "packages/*"],
"workspaces": [
"apps/*",
"tests",
"playwright-tests",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"build:studio": "turbo run build --filter=studio",
Expand Down Expand Up @@ -53,6 +58,13 @@
"npm": "^10.0.0",
"node": "^20.0.0"
},
"keywords": ["postgres", "firebase", "storage", "functions", "database", "auth"],
"keywords": [
"postgres",
"firebase",
"storage",
"functions",
"database",
"auth"
],
"packageManager": "npm@10.7.0"
}
48 changes: 48 additions & 0 deletions supa-mdx-lint.config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
ignore_patterns = ["**/_*.mdx"]

# Heading should be sentence case
[Rule001HeadingCase]
# Words that may be uppercased even if they are not the first word in the sentence.
# Can also specify a regex that is compatible with the [Rust regex crate](https://docs.rs/regex/latest/regex/).
may_uppercase = [
"[A-Z]{3,5}",
"Android",
"Angular",
"Apple",
"Auth",
"Content Delivery Network",
"Dart",
"Edge Functions",
"Flutter",
"GoTrue",
"Google",
"GraphQL",
"Ionic Angular",
"Ionic React",
"Ionic Vue",
"JavaScript",
"Kotlin",
"Next.js",
"Nuxt",
"OpenAI",
"Postgres",
"PostgreSQL",
"PostgREST",
"React",
"React Native",
"RedwoodJS",
"Row Level Security",
"Server-Side Auth",
"Single Sign-On",
"SolidJS",
"Supabase",
"Svelte",
"SvelteKit",
"Swift",
"SwiftUI",
"Xcode",
"Vue",
]
# Words that may be lowercased even if they are the first word in the sentence.
# Can also specify a regex that is compatible with the [Rust regex crate](https://docs.rs/regex/latest/regex/).
may_lowercase = []
37 changes: 0 additions & 37 deletions vale/styles/Custom/Headings.yml

This file was deleted.

90 changes: 0 additions & 90 deletions vale/styles/Custom/WordList.yml

This file was deleted.

0 comments on commit d9a1a61

Please sign in to comment.