Skip to content
New issue

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

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

Already on GitHub? # to your account

docs: add document web site #20

Merged
merged 5 commits into from
Nov 17, 2024
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
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: eslint-plugin-cdk CI
on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
pages: write
pull-requests: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
test-and-build:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 22.11.0
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.7.6
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Run Tests
run: pnpm run test
- name: Lint
run: pnpm run lint
- name: Build docs
run: pnpm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
deploy:
if: github.ref == 'refs/heads/main'
needs: test-and-build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules/
src/
examples/
docs/
eslint.config.mjs
tsconfig.json
vitest.config.mjs
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"source.organizeImports",
"source.fixAll.eslint"
],
"typescript.preferences.importModuleSpecifier": "relative"
"typescript.preferences.importModuleSpecifier": "relative",
"cSpell.words": ["vitepress"]
}
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.vitepress/cache
.vitepress/dist
141 changes: 141 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { defineConfig } from "vitepress";
import defaultConfig from "./sharedConfig.mjs";

// https://vitepress.dev/reference/site-config
export default defineConfig({
...defaultConfig,
title: "eslint-plugin-cdk",
description: "documentation",
head: [
[
"link",
{
rel: "icon",
type: "image/png",
href: "/img/eslint-plugin-cdk.png",
},
],
],
locales: {
root: {
label: "English",
lang: "en",
themeConfig: {
...defaultConfig.themeConfig,
logo: "/img/eslint-plugin-cdk.png",
sidebar: [
{
text: "Getting Started",
collapsed: true,
link: "/getting-started/",
items: [
{
text: "Example",
link: "/getting-started/example",
},
],
},
{
text: "Rules",
collapsed: true,
items: [
{
text: "pascal-case-construct-id",
link: "/rules/pascal-case-construct-id",
},
{
text: "no-parent-name-construct-id-match",
link: "/rules/no-parent-name-construct-id-match",
},
{
text: "no-construct-stack-suffix",
link: "/rules/no-construct-stack-suffix",
},
{
text: "no-class-in-interface",
link: "/rules/no-class-in-interface",
},
{
text: "no-public-class-fields",
link: "/rules/no-public-class-fields",
},
{
text: "no-import-private",
link: "/rules/no-import-private",
},
],
},
],
socialLinks: [
{
icon: {
svg: `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"></path></svg>`,
},
link: "https://github.com/ren-yamanashi/eslint-plugin-cdk/tree/main",
},
],
},
},
ja: {
label: "Japanese",
lang: "ja",
link: "/ja/",
title: "eslint-plugin-cdk",
themeConfig: {
...defaultConfig.themeConfig,
logo: "/img/eslint-plugin-cdk.png",
sidebar: [
{
text: "Getting Started",
collapsed: true,
link: "/ja/getting-started/",
items: [
{
text: "Example",
link: "/ja/getting-started/example",
},
],
},
{
text: "Rules",
collapsed: true,
items: [
{
text: "pascal-case-construct-id",
link: "/ja/rules/pascal-case-construct-id",
},
{
text: "no-parent-name-construct-id-match",
link: "/ja/rules/no-parent-name-construct-id-match",
},
{
text: "no-construct-stack-suffix",
link: "/ja/rules/no-construct-stack-suffix",
},
{
text: "no-class-in-interface",
link: "/ja/rules/no-class-in-interface",
},
{
text: "no-public-class-fields",
link: "/ja/rules/no-public-class-fields",
},
{
text: "no-import-private",
link: "/ja/rules/no-import-private",
},
],
},
],
socialLinks: [
{
icon: {
svg: `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"></path></svg>`,
},
link: "https://github.com/ren-yamanashi/eslint-plugin-cdk/tree/main",
},
],
},
},
},
});
11 changes: 11 additions & 0 deletions docs/.vitepress/sharedConfig.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DefaultTheme, UserConfig } from "vitepress";

export default {
themeConfig: {
outline: "deep",
search: {
provider: "local",
},
},
lastUpdated: true,
} satisfies UserConfig<DefaultTheme.Config>;
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultTheme from 'vitepress/theme-without-fonts';
import './main.css';

export default DefaultTheme;
67 changes: 67 additions & 0 deletions docs/.vitepress/theme/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* TODO: theme color */
:root {
/* --vp-button-brand-bg: #00A5EF;
--vp-c-brand: #00A5EF;
--vp-button-brand-border: #00A5EF;
--vp-button-brand-hover-bg: #00A5EF;
--vp-button-brand-hover-border: #00A5EF;
--vp-button-brand-active-bg: #00A5EF;
--vp-button-brand-active-border: #00A5EF;
--vp-home-hero-name-color: #00A5EF;
--vp-c-brand-1: #00A5EF; */
}

/* https://stackoverflow.com/questions/68789475/how-can-i-style-checkbox-with-css */

/* Basic styling */

[type='checkbox'] {
width: 1rem;
height: 1rem;
color: green;
vertical-align: middle;
-webkit-appearance: none;
background: none;
border: 0;
outline: 0;
flex-grow: 0;
border-radius: 50%;
background-color: #ffffff;
transition: background 300ms;
cursor: pointer;
}

/* Pseudo element for check styling */

[type='checkbox']::before {
content: '';
color: transparent;
display: block;
width: inherit;
height: inherit;
border-radius: inherit;
border: 0;
background-color: transparent;
background-size: contain;
box-shadow: inset 0 0 0 1px #ccd3d8;
}

/* Checked */

[type='checkbox']:checked {
background-color: currentcolor;
}

[type='checkbox']:checked::before {
box-shadow: none;
/* cSpell:disable */
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cpath d='M15.88 8.29L10 14.17l-1.88-1.88a.996.996 0 1 0-1.41 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7a.996.996 0 0 0 0-1.41c-.39-.39-1.03-.39-1.42 0z' fill='%23fff'/%3E %3C/svg%3E");
}

/* Disabled */

[type='checkbox']:disabled {
background-color: #ccd3d8;
opacity: 0.84;
cursor: not-allowed;
}
45 changes: 45 additions & 0 deletions docs/getting-started/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: eslint-plugin-cdk - ESLint plugin for AWS CDK
titleTemplate: ":title"
prev: false
next: false
---

# Example

Below is an example of eslint.config.mjs.

Note: We recommend using typescript-eslint together.

```js
import eslint from "@eslint/js";
import cdkPlugin from "@nigg/eslint-plugin-cdk";
import tsEslint from "typescript-eslint";

export default tsEslint.config(
eslint.configs.recommended,
...tsEslint.configs.strict,
...tsEslint.configs.stylistic,
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
projectService: true,
project: "./tsconfig.json",
},
},
plugins: {
cdk: cdkPlugin,
},
rules: {
...cdkPlugin.configs.recommended.rules,
"cdk/no-import-private": "error",
},
},
{
ignores: ["node_modules"],
}
);
```
Loading
Loading