Skip to content

Commit

Permalink
Tweaked trunk lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
aldwin7894 committed Jan 19, 2023
1 parent 7501846 commit 6a9ad3c
Show file tree
Hide file tree
Showing 28 changed files with 268 additions and 195 deletions.
6 changes: 3 additions & 3 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
glob: "**/*.{html,text,js}{+*,}.erb"
exclude:
- '**/vendor/**/*'
- '**/node_modules/**/*'
- 'app/views/layouts/exception.html.erb'
- "**/vendor/**/*"
- "**/node_modules/**/*"
- "app/views/layouts/exception.html.erb"
EnableDefaultLinters: true
linters:
SpaceInHtmlTag:
Expand Down
18 changes: 6 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@ module.exports = {
browser: true,
es2021: true,
},
extends: [
"airbnb-base",
"plugin:tailwindcss/recommended",
],
extends: ["airbnb-base", "plugin:tailwindcss/recommended", "prettier"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [
"import",
"html-erb",
"tailwindcss",
],
plugins: ["import", "html-erb", "tailwindcss", "prettier"],
settings: {
"import/resolver": {
alias: {
map: [
["~", "./app/frontend"],
],
map: [["~", "./app/frontend"]],
},
},
},
Expand All @@ -36,5 +27,8 @@ module.exports = {
],
"no-underscore-dangle": "off",
"no-param-reassign": "off",
"comma-dangle": ["error", "only-multiline"],
"no-undef": "warn",
"prettier/prettier": "error",
},
};
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '33 7 * * 3'
- cron: "33 7 * * 3"

jobs:
analyze:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'ruby' ]
language: ["javascript", "ruby"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/combine-dependabot-prs.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: 'Combine Dependabot PRs'
name: "Combine Dependabot PRs"

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: 'Branch prefix to find combinable PRs based on'
description: "Branch prefix to find combinable PRs based on"
required: true
default: 'dependabot'
default: "dependabot"
mustBeGreen:
description: 'Only combine PRs that are green (status is success)'
description: "Only combine PRs that are green (status is success)"
required: true
default: true
combineBranchName:
description: 'Name of the branch to combine PRs into'
description: "Name of the branch to combine PRs into"
required: true
default: 'combine-prs-branch'
default: "combine-prs-branch"
ignoreLabel:
description: 'Exclude PRs with this label'
description: "Exclude PRs with this label"
required: true
default: 'nocombine'
default: "nocombine"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
return;
}
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
Expand All @@ -133,7 +133,7 @@ jobs:
mergeFailedPRs.push(prString);
}
}
console.log('Creating combined PR');
const combinedPRsString = combinedPRs.join('\n');
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker Image CI

on:
push:
branches: [ "master" ]
branches: ["master"]

jobs:
build:
Expand All @@ -17,7 +17,7 @@ jobs:
with:
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
checkout: 'false'
checkout: "false"
image_tag: prod
org_name: aldwin7894
repo_name: aldwin7894
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trailingComma: "all"
semi: true
singleQuote: false
arrowParens: "avoid"
endOfLine: "auto"
8 changes: 0 additions & 8 deletions .trunk/config/cspell.config.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
removeDoctype: false,
},
},
},
Expand Down
58 changes: 35 additions & 23 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
version: 0.1
actions:
enabled:
- trunk-cache-prune
- trunk-upgrade-available
cli:
version: 1.3.2
plugins:
sources:
- id: trunk
ref: v0.0.8
uri: https://github.com/trunk-io/plugins
runtimes:
enabled:
- go@1.18.3
- node@14.20.0
- ruby@3.1.2
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
lint:
disabled:
- prettier
ignore:
- linters: [ALL]
paths:
- bin
- log
- public
- test
- config/*
- app/frontend/fonts
- app/frontend/favicon
- db/*
enabled:
- cspell@6.18.1
- hadolint@2.12.0
- shellcheck@0.9.0
- shfmt@3.5.0
- svgo@3.0.2
- actionlint@1.6.22
- eslint@8.31.0:
- eslint@8.32.0:
packages:
- eslint-config-airbnb-base
- eslint-import-resolver-alias
- eslint-plugin-html-erb
- eslint-plugin-import
- eslint-plugin-tailwindcss
- git-diff-check
- gitleaks@8.15.2
- markdownlint@0.33.0
- rubocop@1.39.0:
packages:
- rubocop-packaging
- rubocop-performance
- rubocop-rails
cli:
version: 1.3.1
plugins:
sources:
- id: trunk
ref: v0.0.8
uri: https://github.com/trunk-io/plugins
- shfmt@3.5.0
- svgo@3.0.2
- oxipng@8.0.0
- prettier@2.8.3
- markdownlint@0.33.0
- actionlint@1.6.23
- git-diff-check
- shellcheck@0.9.0
- hadolint@2.12.0
- gitleaks@8.15.2
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
"tailwindCSS.emmetCompletions": true,
"tailwindCSS.codeActions": true,
"tailwindCSS.colorDecorators": true,
"tailwindCSS.hovers": true
"tailwindCSS.hovers": true,
"trunk.inlineDecoratorsForAllExtensions": true,
"trunk.trunkGrayOutNonBlockingIssues": true,
"trunk.trace.server": "messages"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# My Personal Web App

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=aldwin7894_aldwin7894&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=aldwin7894_aldwin7894)
[![CodeQL](https://github.com/aldwin7894/aldwin7894/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/aldwin7894/aldwin7894/actions/workflows/codeql-analysis.yml)
###### *Nothing to see here, lol*

###### _Nothing to see here, lol_

<br>
<br>

Expand Down
2 changes: 1 addition & 1 deletion app/frontend/channels/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// Channel files must be named *_channel.js.

const channels = import.meta.globEager("./*_channel.js");
Object.keys(channels).forEach((path) => channels[path]());
Object.keys(channels).forEach(path => channels[path]());
31 changes: 22 additions & 9 deletions app/frontend/entrypoints/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Turbo */

import "iconify-icon";
import "@hotwired/turbo-rails";
import * as ActiveStorage from "@rails/activestorage";
Expand All @@ -18,17 +20,20 @@ const initElems = () => {
const popoverTriggerList = [].slice.call(
document.querySelectorAll('[data-bs-toggle="popover"]'),
);
popoverTriggerList.map((popoverTriggerEl) => new window.Popover(popoverTriggerEl));
popoverTriggerList.map(
popoverTriggerEl => new window.Popover(popoverTriggerEl),
);

// tooltip
const tooltipTriggerList = [].slice.call(
document.querySelectorAll('[data-bs-toggle="tooltip"]')
document.querySelectorAll('[data-bs-toggle="tooltip"]'),
);
tooltipTriggerList.map(
tooltipTriggerEl => new window.Tooltip(tooltipTriggerEl),
);
tooltipTriggerList.map((tooltipTriggerEl) => new window.Tooltip(tooltipTriggerEl));
};
initElems();


// fade animations
document.addEventListener("DOMContentLoaded", () => {
const loader = document.getElementById("loader");
Expand All @@ -43,14 +48,22 @@ document.addEventListener("DOMContentLoaded", () => {
main.classList.add("animate__fadeIn", "animate__animated");
});
});
document.addEventListener("turbo:before-fetch-response", (event) => {
document.addEventListener("turbo:before-fetch-response", event => {
const id = event.target.getAttribute("data-turbo-frame")
? event.target.getAttribute("data-turbo-frame")
: event.target.id;
const element = document.getElementById(id);
element.classList.add("animate__fadeIn", "animate__animated", "animate__delay");
element.classList.add(
"animate__fadeIn",
"animate__animated",
"animate__delay",
);
element.addEventListener("animationend", () => {
element.classList.remove("animate__fadeIn", "animate__animated", "animate__delay");
element.classList.remove(
"animate__fadeIn",
"animate__animated",
"animate__delay",
);
});
});

Expand All @@ -59,10 +72,10 @@ document.addEventListener("turbo:before-fetch-request", () => {
Turbo.navigator.delegate.adapter.showProgressBar();
});
document.addEventListener("turbo:frame-render", () => {
Turbo.navigator.delegate.adapter.progressBar.hide()
Turbo.navigator.delegate.adapter.progressBar.hide();
});
document.addEventListener("turbo:before-stream-render", () => {
Turbo.navigator.delegate.adapter.progressBar.hide()
Turbo.navigator.delegate.adapter.progressBar.hide();
});

document.addEventListener("turbo:frame-load", () => {
Expand Down
Loading

0 comments on commit 6a9ad3c

Please sign in to comment.