Skip to content

Commit

Permalink
Update Configs: Build/Lint/Format
Browse files Browse the repository at this point in the history
* Comment out firebase preview deploys from builds
* Add unused/organize imports linting
* Auto lint/format on save
* Editor Show inferred types
* Explorer icon tweak
* Run lint/format
  • Loading branch information
deniszholob committed Dec 6, 2024
1 parent 913c997 commit bb5dc75
Show file tree
Hide file tree
Showing 77 changed files with 333 additions and 276 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ecmaVersion": 2020
},
"ignorePatterns": ["projects/**/*"],
"plugins": ["unused-imports", "simple-import-sort"],
"overrides": [
{
"files": ["*.html"],
Expand Down Expand Up @@ -39,14 +40,18 @@
"style": "kebab-case"
}
],
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-inferrable-types": "off",
"@angular-eslint/no-host-metadata-property": "off"
}
},
{
"files": ["*.ts"],
"excludedFiles": ["*.spec.ts"],
"rules": {
"no-unused-vars": "off"
"no-unused-vars": "off",
"unused-imports/no-unused-vars": "warn",
"unused-imports/no-unused-imports": "error",
"simple-import-sort/imports": "error"
}
}
]
Expand Down
43 changes: 22 additions & 21 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,29 @@ jobs:
name: public
path: public # Directory to push to GitHub Pages


# Ref: https://github.com/firebase/firebase-tools
deploy-firebase:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
# deploy-firebase:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Checkout
# uses: actions/checkout@v3

- name: Download build
uses: actions/download-artifact@v3
with:
name: public
path: public
# - name: Download build
# uses: actions/download-artifact@v3
# with:
# name: public
# path: public

- name: Display structure of downloaded files
run: ls -R
working-directory: public
# - name: Display structure of downloaded files
# run: ls -R
# working-directory: public

- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FACTORIO_CHEAT_SHEET }}'
projectId: factorio-cheat-sheet
channelId: preview
# - name: Deploy to Firebase
# uses: FirebaseExtended/action-hosting-deploy@v0
# with:
# repoToken: '${{ secrets.GITHUB_TOKEN }}'
# firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FACTORIO_CHEAT_SHEET }}'
# projectId: factorio-cheat-sheet
# channelId: preview
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ jobs:
- name: Install dependencies with npm
run: npm ci

- name: Run the format check script
- name: Run linter
run: npm run lint:check

- name: Run Formatter
run: npm run format:check
48 changes: 24 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,27 @@ jobs:
folder: public

# Ref: https://github.com/firebase/firebase-tools
deploy-firebase:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download build
uses: actions/download-artifact@v3
with:
name: public
path: public

- name: Display structure of downloaded files
run: ls -R
working-directory: public

- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FACTORIO_CHEAT_SHEET }}'
channelId: live
projectId: factorio-cheat-sheet
# deploy-firebase:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Download build
# uses: actions/download-artifact@v3
# with:
# name: public
# path: public

# - name: Display structure of downloaded files
# run: ls -R
# working-directory: public

# - name: Deploy to Firebase
# uses: FirebaseExtended/action-hosting-deploy@v0
# with:
# repoToken: '${{ secrets.GITHUB_TOKEN }}'
# firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FACTORIO_CHEAT_SHEET }}'
# channelId: live
# projectId: factorio-cheat-sheet
134 changes: 90 additions & 44 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
{
"explorer.autoRevealExclude": {
"**/node_modules": true
},
"editor.renderWhitespace": "all",
"editor.rulers": [80, 140],
"editor.bracketPairColorization.enabled": true,
"editor.codeActionsOnSave": { "source.fixAll.eslint": "always" },
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.linkedEditing": true,
"editor.renderWhitespace": "all",
"editor.rulers": [80, 100],
"explorer.sortOrderLexicographicOptions": "lower", // Case sensitive file ordering in tree
"explorer.autoRevealExclude": { "**/node_modules": true },
// Enable the inline display if inferred types for ts
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,
"typescript.inlayHints.parameterTypes.enabled": true,
"typescript.inlayHints.propertyDeclarationTypes.enabled": true,
"typescript.inlayHints.variableTypes.enabled": true,
// Enable the inline display if inferred types for ts
"javascript.inlayHints.functionLikeReturnTypes.enabled": true,
"javascript.inlayHints.parameterTypes.enabled": true,
"javascript.inlayHints.propertyDeclarationTypes.enabled": true,
"javascript.inlayHints.variableTypes.enabled": true,
// Editor Icon Theme
"workbench.iconTheme": "material-icon-theme",
"material-icon-theme.activeIconPack": "angular_ngrx",
"material-icon-theme.folders.associations": {
Expand All @@ -14,48 +27,44 @@
"models": "mjml"
},
"material-icon-theme.files.associations": {
"*.interceptor.ts": "angular-guard",
"*.events.ts": "tcl",
"*.data.ts": "database",
"*.model.ts": "mjml",
"model.ts": "mjml",
"index.ts": "url"
"*.const.ts": "database",
"index.ts": "url",
"public-api.ts": "url",
"models.ts": "url",
"services.ts": "url"
},
"cSpell.words": [
"Zuri's",
"browserconfig",
"codelyzer",
"combinators",
"deniszholob",
"devkit",
"factorio",
"factoriocheatsheet",
"mstile",
"ngsw",
"readonly",
"rowspan",
"stylelint",
"tslib"
"material-icon-theme.files.customClones": [
{
"name": "typescript-model",
"fileExtensions": ["model.ts"],
"base": "typescript",
"color": "red-400"
},
{
"name": "typescript-enum",
"fileExtensions": ["enum.ts"],
"base": "typescript",
"color": "teal-400"
},
{
"name": "typescript-util",
"fileExtensions": ["util.ts"],
"base": "typescript",
"color": "light-green-600"
},
{
"name": "typescript-mock",
"fileExtensions": ["mock.ts"],
"base": "typescript",
"color": "brown-400"
}
],
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"workbench.editor.pinnedTabsOnSeparateRow": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.exclude": {
".angular": true,
".firebase": true,
Expand Down Expand Up @@ -94,5 +103,42 @@
"coverage": true,
"src/*.{png,xml,ico,webmanifest,json,svg,txt}": true,
"src/CNAME": true
},
"cSpell.words": [
"Zuri's",
"browserconfig",
"codelyzer",
"combinators",
"deniszholob",
"devkit",
"factorio",
"factoriocheatsheet",
"mstile",
"ngsw",
"readonly",
"rowspan",
"stylelint",
"tslib"
],
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"build:prod": "ng build --configuration production",
"watch": "ng build --watch --configuration development",
"test": "echo 'No tests'",
"lint": "ng lint",
"lint": "ng lint --fix",
"lint:check": "ng lint",
"format": "prettier --cache --write --ignore-unknown .",
"format:check": "prettier --cache --check --ignore-unknown .",
"prepare": "husky install",
Expand Down Expand Up @@ -83,7 +84,9 @@
"@typescript-eslint/parser": "5.44.0",
"eslint": "8.28.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-storybook": "0.6.8",
"eslint-plugin-unused-imports": "4.1.4",
"http-server": "14.1.1",
"husky": "8.0.2",
"lint-staged": "13.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Angular
import { Component, OnDestroy } from '@angular/core';

// PWA
import {
SwUpdate,
Expand Down
Loading

0 comments on commit bb5dc75

Please sign in to comment.