Skip to content

Commit

Permalink
ci(lint): add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
codingluke committed Dec 8, 2024
1 parent a0d976a commit 21eaab6
Show file tree
Hide file tree
Showing 7 changed files with 1,657 additions and 137 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ permissions:
contents: read

jobs:
prettier:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
# This is important to fetch the changes to the previous commit
fetch-depth: 0
- name: Prettify code
uses: creyD/[email protected]
with:
# This part is also where you can pass other options, for example:
same_commit: true
prettier_options: --write **/*.{js,md}
only_changed: true # Prüft nur Dateien die geändert wurden
test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -39,7 +59,7 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
environment: aws
needs: test
needs: [test, prettier]

steps:
- name: Checkout
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint

on:
pull_request:

# permissions:
# contents: write
# pull-requests: write
permissions: write-all

jobs:
eslint_check:
name: Prepare action
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Lint
uses: Krizzu/[email protected]
with:
ghToken: ${{ secrets.GITHUB_TOKEN }}
eslintFiles: "neues-projekt"
eslintConfig: "neues-projekt/eslint.config.js"
# eslintExt: "js, ts, jsx, tsx"
2 changes: 1 addition & 1 deletion neues-projekt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY . .

RUN npm ci && npm run test:ci && npm run build

# Ab hier beginnt das Produktive Image!
# Ab hier beginnt das produktive Image!
FROM node:lts-slim

# Das LABEL muss hier gesetzt sein!
Expand Down
14 changes: 13 additions & 1 deletion neues-projekt/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,23 @@
"scripts": [],
"karmaConfig": "karma.conf.js"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"cli": {
"analytics": false
"analytics": false,
"schematicCollections": [
"angular-eslint"
]
}
}
43 changes: 43 additions & 0 deletions neues-projekt/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");

module.exports = tseslint.config(
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "app",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "app",
style: "kebab-case",
},
],
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {},
}
);
Loading

0 comments on commit 21eaab6

Please sign in to comment.