Skip to content

Commit 584d8b9

Browse files
authored
Format JSON and YAML using Prettier (mastodon#17823)
* Format JSON and YAML using Prettier * Add prettier to devDep
1 parent cf5435b commit 584d8b9

17 files changed

+203
-129
lines changed

.codeclimate.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
version: '2'
22
checks:
33
argument-count:
44
enabled: false
@@ -34,8 +34,8 @@ plugins:
3434
sass-lint:
3535
enabled: true
3636
exclude_patterns:
37-
- spec/
38-
- vendor/asset/
37+
- spec/
38+
- vendor/asset/
3939

40-
- app/javascript/mastodon/locales/**/*.json
41-
- config/locales/**/*.yml
40+
- app/javascript/mastodon/locales/**/*.json
41+
- config/locales/**/*.yml

.devcontainer/devcontainer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
"workspaceFolder": "/workspaces/mastodon",
66

77
// Set *default* container specific settings.json values on container create.
8-
"settings": {},
8+
"settings": {},
99

1010
// Add the IDs of extensions you want installed when the container is created.
11-
"extensions": [
11+
"extensions": [
1212
"EditorConfig.EditorConfig",
1313
"dbaeumer.vscode-eslint",
14-
"rebornix.Ruby"
15-
],
14+
"rebornix.Ruby"
15+
],
1616

1717
// Use 'forwardPorts' to make a list of ports inside the container available locally.
18-
// This can be used to network with other containers or the host.
19-
"forwardPorts": [3000, 4000],
18+
// This can be used to network with other containers or the host.
19+
"forwardPorts": [3000, 4000],
2020

21-
// Use 'postCreateCommand' to run commands after the container is created.
22-
"postCreateCommand": "bundle install --path vendor/bundle && yarn install && ./bin/rails db:setup",
21+
// Use 'postCreateCommand' to run commands after the container is created.
22+
"postCreateCommand": "bundle install --path vendor/bundle && yarn install && ./bin/rails db:setup",
2323

24-
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
25-
"remoteUser": "vscode"
24+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
25+
"remoteUser": "vscode"
2626
}

.devcontainer/docker-compose.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ services:
99
# Update 'VARIANT' to pick a version of Ruby: 3, 3.1, 3.0, 2, 2.7, 2.6
1010
# Append -bullseye or -buster to pin to an OS version.
1111
# Use -bullseye variants on local arm64/Apple Silicon.
12-
VARIANT: "3.0-bullseye"
12+
VARIANT: '3.0-bullseye'
1313
# Optional Node.js version to install
14-
NODE_VERSION: "14"
14+
NODE_VERSION: '14'
1515
volumes:
1616
- ..:/workspaces/mastodon:cached
1717
environment:
@@ -34,7 +34,6 @@ services:
3434
- internal_network
3535
user: vscode
3636

37-
3837
db:
3938
image: postgres:14-alpine
4039
restart: unless-stopped

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
version: 2
77
updates:
88
- package-ecosystem: npm
9-
directory: "/"
9+
directory: '/'
1010
schedule:
1111
interval: weekly
1212
open-pull-requests-limit: 99
1313
allow:
1414
- dependency-type: direct
1515

1616
- package-ecosystem: bundler
17-
directory: "/"
17+
directory: '/'
1818
schedule:
1919
interval: weekly
2020
open-pull-requests-limit: 99

.github/workflows/build-image.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ on:
33
workflow_dispatch:
44
push:
55
branches:
6-
- "main"
6+
- 'main'
77
tags:
8-
- "*"
8+
- '*'
99
pull_request:
1010
paths:
1111
- .github/workflows/build-image.yml

.github/workflows/check-i18n.yml

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Check i18n
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
env:
1010
RAILS_ENV: test
@@ -14,21 +14,21 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Install system dependencies
19-
run: |
20-
sudo apt-get update
21-
sudo apt-get install -y libicu-dev libidn11-dev
22-
- name: Set up Ruby
23-
uses: ruby/setup-ruby@v1
24-
with:
25-
ruby-version: '3.0'
26-
bundler-cache: true
27-
- name: Check locale file normalization
28-
run: bundle exec i18n-tasks check-normalized
29-
- name: Check for unused strings
30-
run: bundle exec i18n-tasks unused -l en
31-
- name: Check for wrong string interpolations
32-
run: bundle exec i18n-tasks check-consistent-interpolations
33-
- name: Check that all required locale files exist
34-
run: bundle exec rake repo:check_locales_files
17+
- uses: actions/checkout@v2
18+
- name: Install system dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y libicu-dev libidn11-dev
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: '3.0'
26+
bundler-cache: true
27+
- name: Check locale file normalization
28+
run: bundle exec i18n-tasks check-normalized
29+
- name: Check for unused strings
30+
run: bundle exec i18n-tasks unused -l en
31+
- name: Check for wrong string interpolations
32+
run: bundle exec i18n-tasks check-consistent-interpolations
33+
- name: Check that all required locale files exist
34+
run: bundle exec rake repo:check_locales_files

.prettierignore

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config and downloaded libraries.
8+
/.bundle
9+
/vendor/bundle
10+
11+
# Ignore the default SQLite database.
12+
/db/*.sqlite3
13+
/db/*.sqlite3-journal
14+
15+
# Ignore all logfiles and tempfiles.
16+
.eslintcache
17+
/log/*
18+
!/log/.keep
19+
/tmp
20+
/coverage
21+
/public/system
22+
/public/assets
23+
/public/packs
24+
/public/packs-test
25+
.env
26+
.env.production
27+
.env.development
28+
/node_modules/
29+
/build/
30+
31+
# Ignore Vagrant files
32+
.vagrant/
33+
34+
# Ignore Capistrano customizations
35+
/config/deploy/*
36+
37+
# Ignore IDE files
38+
.vscode/
39+
.idea/
40+
41+
# Ignore postgres + redis + elasticsearch volume optionally created by docker-compose
42+
/postgres
43+
/postgres14
44+
/redis
45+
/elasticsearch
46+
47+
# ignore Helm dependency charts
48+
/chart/charts/*.tgz
49+
50+
# Ignore Apple files
51+
.DS_Store
52+
53+
# Ignore vim files
54+
*~
55+
*.swp
56+
57+
# Ignore npm debug log
58+
npm-debug.log
59+
60+
# Ignore yarn log files
61+
yarn-error.log
62+
yarn-debug.log
63+
64+
# Ignore vagrant log files
65+
*-cloudimg-console.log
66+
67+
# Ignore Docker option files
68+
docker-compose.override.yml
69+
70+
# Ignore Helm files
71+
/chart
72+
73+
# Ignore emoji map file
74+
/app/javascript/mastodon/features/emoji/emoji_map.json
75+
76+
# Ignore locale files
77+
/app/javascript/mastodon/locales
78+
/config/locales

.prettierrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
singleQuote: true
3+
}

.rubocop.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ AllCops:
55
TargetRubyVersion: 2.5
66
NewCops: disable
77
Exclude:
8-
- 'spec/**/*'
9-
- 'db/**/*'
10-
- 'app/views/**/*'
11-
- 'config/**/*'
12-
- 'bin/*'
13-
- 'Rakefile'
14-
- 'node_modules/**/*'
15-
- 'Vagrantfile'
16-
- 'vendor/**/*'
17-
- 'lib/json_ld/*'
18-
- 'lib/templates/**/*'
8+
- 'spec/**/*'
9+
- 'db/**/*'
10+
- 'app/views/**/*'
11+
- 'config/**/*'
12+
- 'bin/*'
13+
- 'Rakefile'
14+
- 'node_modules/**/*'
15+
- 'Vagrantfile'
16+
- 'vendor/**/*'
17+
- 'lib/json_ld/*'
18+
- 'lib/templates/**/*'
1919

2020
Bundler/OrderedGems:
2121
Enabled: false

app.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,5 @@
9595
"scripts": {
9696
"postdeploy": "bundle exec rails db:migrate && bundle exec rails db:seed"
9797
},
98-
"addons": [
99-
"heroku-postgresql",
100-
"heroku-redis"
101-
]
98+
"addons": ["heroku-postgresql", "heroku-redis"]
10299
}

boxfile.yml

+12-20
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,19 @@ run.config:
4343

4444
fs_watch: true
4545

46-
4746
deploy.config:
4847
extra_steps:
4948
- NODE_ENV=production bundle exec rake assets:precompile
5049
transform:
51-
- "envsubst < /app/.env.nanobox > /app/.env.production"
50+
- 'envsubst < /app/.env.nanobox > /app/.env.production'
5251
- |-
53-
if [ -z "$LOCAL_DOMAIN" ]
54-
then
55-
. /app/.env.production
56-
export LOCAL_DOMAIN
57-
fi
58-
erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
59-
erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
52+
if [ -z "$LOCAL_DOMAIN" ]
53+
then
54+
. /app/.env.production
55+
export LOCAL_DOMAIN
56+
fi
57+
erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
58+
erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
6059
- touch /app/log/production.log
6160
before_live:
6261
web.web:
@@ -65,11 +64,10 @@ deploy.config:
6564
after_live:
6665
worker.sidekiq:
6766
- |-
68-
if [[ "${ES_ENABLED}" != "false" ]]
69-
then
70-
bin/tootctl search deploy
71-
fi
72-
67+
if [[ "${ES_ENABLED}" != "false" ]]
68+
then
69+
bin/tootctl search deploy
70+
fi
7371
7472
web.web:
7573
start:
@@ -89,7 +87,6 @@ web.web:
8987
data.storage:
9088
- public/system
9189

92-
9390
web.stream:
9491
start:
9592
nginx: nginx -c /app/nanobox/nginx-stream.conf
@@ -103,7 +100,6 @@ web.stream:
103100
writable_dirs:
104101
- tmp
105102

106-
107103
worker.sidekiq:
108104
start:
109105
default: bundle exec sidekiq -c 5 -q default -L /app/log/sidekiq.log
@@ -123,7 +119,6 @@ worker.sidekiq:
123119
data.storage:
124120
- public/system
125121

126-
127122
data.db:
128123
image: nanobox/postgresql:9.6
129124

@@ -145,7 +140,6 @@ data.db:
145140
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
146141
done
147142
148-
149143
data.elastic:
150144
image: nanobox/elasticsearch:5
151145

@@ -171,7 +165,6 @@ data.elastic:
171165
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
172166
done
173167
174-
175168
data.redis:
176169
image: nanobox/redis:4.0
177170

@@ -191,7 +184,6 @@ data.redis:
191184
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
192185
done
193186
194-
195187
data.storage:
196188
image: nanobox/unfs:0.9
197189

config/database.yml

-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ production:
3232
host: <%= ENV['DB_HOST'] || 'localhost' %>
3333
port: <%= ENV['DB_PORT'] || 5432 %>
3434
prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %>
35-

config/i18n-tasks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ data:
1717

1818
search:
1919
paths:
20-
- app/
21-
- config/navigation.rb
20+
- app/
21+
- config/navigation.rb
2222

2323
relative_roots:
2424
- app/controllers

0 commit comments

Comments
 (0)