Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 856f0ab

Browse files
authored
chore: Improve project-wide prettier formatting and ignored files (#5505)
* chore: Improve project-wide prettier formatting and ignored files * chore: `Run make fmt/prettier` * Fix gitignore for `.vscode` folder so that ! works * Add comment in `.prettierrc.yaml` to explain `.editorconfig` * Remove scripts/apidocgen/markdown-template/README.md * Use `yq` for processing prettierrc, update lib.sh dependency check * Add `yq` to Dockerfile and Nix
1 parent 5435bce commit 856f0ab

34 files changed

+783
-566
lines changed

.devcontainer/Dockerfile

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ ENV EDITOR=vim
66
RUN apt-get update && apt-get upgrade --yes
77

88
RUN apt-get install --yes \
9-
ca-certificates \
10-
bash-completion \
11-
build-essential \
12-
curl \
13-
cmake \
14-
direnv \
15-
emacs-nox \
16-
gnupg \
17-
htop \
18-
jq \
19-
less \
20-
lsb-release \
21-
lsof \
22-
man-db \
23-
nano \
24-
neovim \
25-
ssl-cert \
26-
sudo \
27-
unzip \
28-
xz-utils \
29-
zip
9+
ca-certificates \
10+
bash-completion \
11+
build-essential \
12+
curl \
13+
cmake \
14+
direnv \
15+
emacs-nox \
16+
gnupg \
17+
htop \
18+
jq \
19+
less \
20+
lsb-release \
21+
lsof \
22+
man-db \
23+
nano \
24+
neovim \
25+
ssl-cert \
26+
sudo \
27+
unzip \
28+
xz-utils \
29+
zip
3030

3131
# configure locales to UTF8
3232
RUN apt-get install locales && locale-gen en_US.UTF-8
@@ -39,22 +39,22 @@ RUN direnv hook bash >> $HOME/.bashrc
3939
RUN sh <(curl -L https://nixos.org/nix/install) --daemon
4040

4141
RUN mkdir -p $HOME/.config/nix $HOME/.config/nixpkgs \
42-
&& echo 'sandbox = false' >> $HOME/.config/nix/nix.conf \
43-
&& echo '{ allowUnfree = true; }' >> $HOME/.config/nixpkgs/config.nix \
44-
&& echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.bashrc
42+
&& echo 'sandbox = false' >> $HOME/.config/nix/nix.conf \
43+
&& echo '{ allowUnfree = true; }' >> $HOME/.config/nixpkgs/config.nix \
44+
&& echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.bashrc
4545

4646

4747
# install docker and configure daemon to use vfs as GitHub codespaces requires vfs
4848
# https://github.com/moby/moby/issues/13742#issuecomment-725197223
4949
RUN mkdir -p /etc/apt/keyrings \
50-
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
51-
&& echo \
52-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
53-
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
54-
&& apt-get update \
55-
&& apt-get install --yes docker-ce docker-ce-cli containerd.io docker-compose-plugin \
56-
&& mkdir -p /etc/docker \
57-
&& echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' >> /etc/docker/daemon.json
50+
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
51+
&& echo \
52+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
53+
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
54+
&& apt-get update \
55+
&& apt-get install --yes docker-ce docker-ce-cli containerd.io docker-compose-plugin \
56+
&& mkdir -p /etc/docker \
57+
&& echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' >> /etc/docker/daemon.json
5858

5959
# install golang and language tooling
6060
ENV GO_VERSION=1.19
@@ -67,6 +67,7 @@ RUN echo 'export PATH=$GOPATH/bin:$PATH' >> $HOME/.bashrc
6767
RUN bash -c ". $HOME/.bashrc \
6868
go install -v golang.org/x/tools/gopls@latest \
6969
&& go install -v mvdan.cc/sh/v3/cmd/shfmt@latest \
70+
&& go install -v github.com/mikefarah/yq/[email protected] \
7071
"
7172

7273
# install nodejs
@@ -80,4 +81,3 @@ RUN bash -c "$(curl -fsSL https://raw.githubusercontent.com/horta/zstd.install/m
8081
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list \
8182
&& apt update \
8283
&& apt install nfpm
83-

.devcontainer/devcontainer.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
// For format details, see https://aka.ms/devcontainer.json
22
{
3-
"name": "Development environments on your infrastructure",
3+
"name": "Development environments on your infrastructure",
44

5-
// Sets the run context to one level up instead of the .devcontainer folder.
6-
"context": ".",
5+
// Sets the run context to one level up instead of the .devcontainer folder.
6+
"context": ".",
77

8-
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
9-
"dockerFile": "Dockerfile",
8+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
9+
"dockerFile": "Dockerfile",
1010

11-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12-
// "forwardPorts": [],
13-
14-
"postStartCommand": "dockerd",
11+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12+
// "forwardPorts": [],
1513

16-
// privileged is required by GitHub codespaces - https://github.com/microsoft/vscode-dev-containers/issues/727
17-
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--privileged", "--init" ]
14+
"postStartCommand": "dockerd",
15+
16+
// privileged is required by GitHub codespaces - https://github.com/microsoft/vscode-dev-containers/issues/727
17+
"runArgs": [
18+
"--cap-add=SYS_PTRACE",
19+
"--security-opt",
20+
"seccomp=unconfined",
21+
"--privileged",
22+
"--init"
23+
]
1824
}

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trim_trailing_whitespace = true
77
insert_final_newline = true
88
indent_style = tab
99

10-
[*.{md,json,yaml,yml,tf,tfvars}]
10+
[*.{md,json,yaml,yml,tf,tfvars,nix}]
1111
indent_style = space
1212
indent_size = 2
1313

.github/dependabot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ updates:
3838
# Ignore patch updates for all dependencies
3939
- dependency-name: "*"
4040
update-types:
41-
- version-update:semver-patch
41+
- version-update:semver-patch
4242

4343
- package-ecosystem: "npm"
4444
directory: "/site/"
@@ -53,7 +53,7 @@ updates:
5353
# Ignore patch updates for all dependencies
5454
- dependency-name: "*"
5555
update-types:
56-
- version-update:semver-patch
56+
- version-update:semver-patch
5757
# Ignore major updates to Node.js types, because they need to
5858
# correspond to the Node.js engine version
5959
- dependency-name: "@types/node"

.github/workflows/cla.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
issue_comment:
44
types: [created]
55
pull_request_target:
6-
types: [opened,closed,synchronize]
6+
types: [opened, closed, synchronize]
77

88
jobs:
99
CLAssistant:
@@ -15,12 +15,12 @@ jobs:
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
# the below token should have repo scope and must be manually added by you in the repository's secret
18-
PERSONAL_ACCESS_TOKEN : ${{ secrets.CDRCOMMUNITY_GITHUB_TOKEN }}
18+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CDRCOMMUNITY_GITHUB_TOKEN }}
1919
with:
20-
remote-organization-name: 'coder'
21-
remote-repository-name: 'cla'
22-
path-to-signatures: 'v2022-09-04/signatures.json'
23-
path-to-document: 'https://github.com/coder/cla/blob/main/README.md'
20+
remote-organization-name: "coder"
21+
remote-repository-name: "cla"
22+
path-to-signatures: "v2022-09-04/signatures.json"
23+
path-to-document: "https://github.com/coder/cla/blob/main/README.md"
2424
# branch should not be protected
25-
branch: 'main'
25+
branch: "main"
2626
allowlist: dependabot*

.github/workflows/coder.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ jobs:
222222
run: go install storj.io/drpc/cmd/[email protected]
223223
- name: Install goimports
224224
run: go install golang.org/x/tools/cmd/goimports@latest
225+
- name: Install yq
226+
run: go run github.com/mikefarah/yq/[email protected]
225227

226228
- name: Install Protoc
227229
run: |
@@ -736,18 +738,18 @@ jobs:
736738
markdown-link-check:
737739
runs-on: ubuntu-latest
738740
steps:
739-
- uses: actions/checkout@master
740-
# For the main branch:
741-
- if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
742-
uses: gaurav-nelson/github-action-markdown-link-check@v1
743-
with:
741+
- uses: actions/checkout@master
742+
# For the main branch:
743+
- if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
744+
uses: gaurav-nelson/github-action-markdown-link-check@v1
745+
with:
744746
use-quiet-mode: yes
745747
use-verbose-mode: yes
746748
config-file: .github/workflows/mlc_config.json
747-
# For pull requests:
748-
- if: github.ref != 'refs/heads/main' || github.event.pull_request.head.repo.fork
749-
uses: gaurav-nelson/github-action-markdown-link-check@v1
750-
with:
749+
# For pull requests:
750+
- if: github.ref != 'refs/heads/main' || github.event.pull_request.head.repo.fork
751+
uses: gaurav-nelson/github-action-markdown-link-check@v1
752+
with:
751753
use-quiet-mode: yes
752754
use-verbose-mode: yes
753755
check-modified-files-only: yes

.github/workflows/mlc_config.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
2-
"ignorePatterns": [
3-
{
4-
"pattern": ":\/\/localhost"
5-
},
6-
{
7-
"pattern": ":\/\/.*.?example\\.com"
8-
},
9-
{
10-
"pattern": "developer.github.com"
11-
},
12-
{
13-
"pattern": "docs.github.com"
14-
},
15-
{
16-
"pattern": "support.google.com"
17-
},
18-
{
19-
"pattern": "tailscale.com"
20-
}
21-
]
2+
"ignorePatterns": [
3+
{
4+
"pattern": "://localhost"
5+
},
6+
{
7+
"pattern": "://.*.?example\\.com"
8+
},
9+
{
10+
"pattern": "developer.github.com"
11+
},
12+
{
13+
"pattern": "docs.github.com"
14+
},
15+
{
16+
"pattern": "support.google.com"
17+
},
18+
{
19+
"pattern": "tailscale.com"
20+
}
21+
]
2222
}

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
177177

178178
- name: Setup GCloud SDK
179-
uses: 'google-github-actions/setup-gcloud@v1'
179+
uses: "google-github-actions/setup-gcloud@v1"
180180

181181
- name: Publish Helm Chart
182182
run: |

.github/workflows/stale.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
# https://github.com/actions/stale/pull/775
1616
- uses: actions/[email protected]
1717
with:
18-
stale-issue-label: 'stale'
19-
stale-pr-label: 'stale'
18+
stale-issue-label: "stale"
19+
stale-pr-label: "stale"
2020
# Pull Requests become stale more quickly due to merge conflicts.
2121
# Also, we promote minimizing WIP.
2222
days-before-pr-stale: 7

.github/workflows/welcome.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
- uses: wow-actions/welcome@v1
1212
with:
1313
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14-
FIRST_PR_REACTIONS: '+1, hooray, rocket, heart'
14+
FIRST_PR_REACTIONS: "+1, hooray, rocket, heart"
1515
FIRST_PR_COMMENT: |
16-
👋 Welcome @{{ author }} to Coder! Yo @coder/docs this is @{{ author }}'s first pull-request here!
16+
👋 Welcome @{{ author }} to Coder! Yo @coder/docs this is @{{ author }}'s first pull-request here!
1717
FIRST_PR_MERGED: |
1818
🎉 Thanks for the contribution @{{ author }}! Yo @coder/docs @{{ author }}'s first contribution has been merged! 👀👀👀

.gitignore

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
1-
###############################################################################
2-
# NOTICE #
3-
# If you change this file, kindly copy-pasta your change into .prettierignore #
4-
# and .eslintignore as well. See the following discussions to understand why #
5-
# we have to resort to this duplication (at least for now): #
6-
# #
7-
# https://github.com/prettier/prettier/issues/8048 #
8-
# https://github.com/prettier/prettier/issues/8506 #
9-
# https://github.com/prettier/prettier/issues/8679 #
10-
###############################################################################
11-
12-
node_modules
13-
vendor
1+
# Common ignore patterns, these rules applies in both root and subdirectories.
2+
.DS_Store
143
.eslintcache
15-
yarn-error.log
4+
.gitpod.yml
5+
.idea
6+
**/*.swp
167
gotests.coverage
178
gotests.xml
189
gotestsum.json
19-
.idea
20-
.gitpod.yml
21-
.DS_Store
10+
node_modules/
11+
vendor/
12+
yarn-error.log
2213

23-
# Make target for updating golden files.
24-
cli/testdata/.gen-golden
14+
# VSCode settings.
15+
**/.vscode/*
16+
# Allow VSCode recommendations and default settings in project root.
17+
!/.vscode/extensions.json
18+
!/.vscode/settings.json
2519

26-
# Front-end ignore
20+
# Front-end ignore patterns.
2721
.next/
28-
site/.eslintcache
29-
site/.next/
30-
site/node_modules/
31-
site/storybook-static/
32-
site/test-results/
33-
site/yarn-error.log
34-
coverage/
3522
site/**/*.typegen.ts
3623
site/build-storybook.log
24+
site/coverage/
25+
site/storybook-static/
26+
site/test-results/
27+
28+
# Make target for updating golden files.
29+
cli/testdata/.gen-golden
3730

3831
# Build
3932
/build/
@@ -46,10 +39,7 @@ site/out/
4639
*.lock.hcl
4740
.terraform/
4841

49-
.vscode/*.log
50-
.vscode/launch.json
51-
**/*.swp
52-
.coderv2/*
42+
/.coderv2/*
5343
**/__debug_bin
5444

5545
# direnv

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ linters-settings:
103103
settings:
104104
ruleguard:
105105
failOn: all
106-
rules: '${configDir}/scripts/rules.go'
106+
rules: "${configDir}/scripts/rules.go"
107107

108108
staticcheck:
109109
# https://staticcheck.io/docs/options#checks

0 commit comments

Comments
 (0)