Skip to content

Commit

Permalink
Format JSON and YAML using Prettier (mastodon#17823)
Browse files Browse the repository at this point in the history
* Format JSON and YAML using Prettier

* Add prettier to devDep
  • Loading branch information
ykzts authored Mar 21, 2022
1 parent cf5435b commit 584d8b9
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 129 deletions.
10 changes: 5 additions & 5 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2"
version: '2'
checks:
argument-count:
enabled: false
Expand Down Expand Up @@ -34,8 +34,8 @@ plugins:
sass-lint:
enabled: true
exclude_patterns:
- spec/
- vendor/asset/
- spec/
- vendor/asset/

- app/javascript/mastodon/locales/**/*.json
- config/locales/**/*.yml
- app/javascript/mastodon/locales/**/*.json
- config/locales/**/*.yml
20 changes: 10 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
"workspaceFolder": "/workspaces/mastodon",

// Set *default* container specific settings.json values on container create.
"settings": {},
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"extensions": [
"EditorConfig.EditorConfig",
"dbaeumer.vscode-eslint",
"rebornix.Ruby"
],
"rebornix.Ruby"
],

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

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

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
5 changes: 2 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
# Update 'VARIANT' to pick a version of Ruby: 3, 3.1, 3.0, 2, 2.7, 2.6
# Append -bullseye or -buster to pin to an OS version.
# Use -bullseye variants on local arm64/Apple Silicon.
VARIANT: "3.0-bullseye"
VARIANT: '3.0-bullseye'
# Optional Node.js version to install
NODE_VERSION: "14"
NODE_VERSION: '14'
volumes:
- ..:/workspaces/mastodon:cached
environment:
Expand All @@ -34,7 +34,6 @@ services:
- internal_network
user: vscode


db:
image: postgres:14-alpine
restart: unless-stopped
Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 99
allow:
- dependency-type: direct

- package-ecosystem: bundler
directory: "/"
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 99
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
workflow_dispatch:
push:
branches:
- "main"
- 'main'
tags:
- "*"
- '*'
pull_request:
paths:
- .github/workflows/build-image.yml
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/check-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Check i18n

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

env:
RAILS_ENV: test
Expand All @@ -14,21 +14,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libicu-dev libidn11-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Check locale file normalization
run: bundle exec i18n-tasks check-normalized
- name: Check for unused strings
run: bundle exec i18n-tasks unused -l en
- name: Check for wrong string interpolations
run: bundle exec i18n-tasks check-consistent-interpolations
- name: Check that all required locale files exist
run: bundle exec rake repo:check_locales_files
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libicu-dev libidn11-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Check locale file normalization
run: bundle exec i18n-tasks check-normalized
- name: Check for unused strings
run: bundle exec i18n-tasks unused -l en
- name: Check for wrong string interpolations
run: bundle exec i18n-tasks check-consistent-interpolations
- name: Check that all required locale files exist
run: bundle exec rake repo:check_locales_files
78 changes: 78 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config and downloaded libraries.
/.bundle
/vendor/bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
.eslintcache
/log/*
!/log/.keep
/tmp
/coverage
/public/system
/public/assets
/public/packs
/public/packs-test
.env
.env.production
.env.development
/node_modules/
/build/

# Ignore Vagrant files
.vagrant/

# Ignore Capistrano customizations
/config/deploy/*

# Ignore IDE files
.vscode/
.idea/

# Ignore postgres + redis + elasticsearch volume optionally created by docker-compose
/postgres
/postgres14
/redis
/elasticsearch

# ignore Helm dependency charts
/chart/charts/*.tgz

# Ignore Apple files
.DS_Store

# Ignore vim files
*~
*.swp

# Ignore npm debug log
npm-debug.log

# Ignore yarn log files
yarn-error.log
yarn-debug.log

# Ignore vagrant log files
*-cloudimg-console.log

# Ignore Docker option files
docker-compose.override.yml

# Ignore Helm files
/chart

# Ignore emoji map file
/app/javascript/mastodon/features/emoji/emoji_map.json

# Ignore locale files
/app/javascript/mastodon/locales
/config/locales
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
singleQuote: true
}
22 changes: 11 additions & 11 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ AllCops:
TargetRubyVersion: 2.5
NewCops: disable
Exclude:
- 'spec/**/*'
- 'db/**/*'
- 'app/views/**/*'
- 'config/**/*'
- 'bin/*'
- 'Rakefile'
- 'node_modules/**/*'
- 'Vagrantfile'
- 'vendor/**/*'
- 'lib/json_ld/*'
- 'lib/templates/**/*'
- 'spec/**/*'
- 'db/**/*'
- 'app/views/**/*'
- 'config/**/*'
- 'bin/*'
- 'Rakefile'
- 'node_modules/**/*'
- 'Vagrantfile'
- 'vendor/**/*'
- 'lib/json_ld/*'
- 'lib/templates/**/*'

Bundler/OrderedGems:
Enabled: false
Expand Down
5 changes: 1 addition & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,5 @@
"scripts": {
"postdeploy": "bundle exec rails db:migrate && bundle exec rails db:seed"
},
"addons": [
"heroku-postgresql",
"heroku-redis"
]
"addons": ["heroku-postgresql", "heroku-redis"]
}
32 changes: 12 additions & 20 deletions boxfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,19 @@ run.config:

fs_watch: true


deploy.config:
extra_steps:
- NODE_ENV=production bundle exec rake assets:precompile
transform:
- "envsubst < /app/.env.nanobox > /app/.env.production"
- 'envsubst < /app/.env.nanobox > /app/.env.production'
- |-
if [ -z "$LOCAL_DOMAIN" ]
then
. /app/.env.production
export LOCAL_DOMAIN
fi
erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
if [ -z "$LOCAL_DOMAIN" ]
then
. /app/.env.production
export LOCAL_DOMAIN
fi
erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
- touch /app/log/production.log
before_live:
web.web:
Expand All @@ -65,11 +64,10 @@ deploy.config:
after_live:
worker.sidekiq:
- |-
if [[ "${ES_ENABLED}" != "false" ]]
then
bin/tootctl search deploy
fi
if [[ "${ES_ENABLED}" != "false" ]]
then
bin/tootctl search deploy
fi
web.web:
start:
Expand All @@ -89,7 +87,6 @@ web.web:
data.storage:
- public/system


web.stream:
start:
nginx: nginx -c /app/nanobox/nginx-stream.conf
Expand All @@ -103,7 +100,6 @@ web.stream:
writable_dirs:
- tmp


worker.sidekiq:
start:
default: bundle exec sidekiq -c 5 -q default -L /app/log/sidekiq.log
Expand All @@ -123,7 +119,6 @@ worker.sidekiq:
data.storage:
- public/system


data.db:
image: nanobox/postgresql:9.6

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

Expand All @@ -171,7 +165,6 @@ data.elastic:
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
done
data.redis:
image: nanobox/redis:4.0

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

Expand Down
1 change: 0 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ production:
host: <%= ENV['DB_HOST'] || 'localhost' %>
port: <%= ENV['DB_PORT'] || 5432 %>
prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %>

4 changes: 2 additions & 2 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ data:

search:
paths:
- app/
- config/navigation.rb
- app/
- config/navigation.rb

relative_roots:
- app/controllers
Expand Down
Loading

0 comments on commit 584d8b9

Please sign in to comment.