Skip to content

Commit

Permalink
Setup linting for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ccremer committed Sep 13, 2022
1 parent 4c892b3 commit da37a95
Show file tree
Hide file tree
Showing 10 changed files with 2,134 additions and 40 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request: {}

jobs:
lint:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -24,4 +24,18 @@ jobs:
${{ runner.os }}-go-
- name: Run linters
run: make lint
run: make lint-go git-diff

ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
cache-dependency-path: ui/package-lock.json

- name: Run linters
run: make lint-ui git-diff
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ include Makefile.vars.mk
# Optional Helm chart module
-include charts/charts.mk
# Local Env & testing
-include test/integration.mk test/e2e.mk test/media.mk
include test/integration.mk test/e2e.mk test/media.mk
# UI
include ui/Makefile

.PHONY: help
help: ## Show this help
Expand Down Expand Up @@ -62,7 +64,13 @@ vet: ## Run 'go vet' against code
go vet ./...

.PHONY: lint
lint: fmt vet generate ## All-in-one linting
lint: lint-go lint-ui git-diff ## All-in-one linting

.PHONY: lint-go
lint-go: fmt vet generate ## Run linting for Go code

.PHONY: git-diff
git-diff:
@echo 'Check for uncommitted changes ...'
git diff --exit-code

Expand Down
30 changes: 30 additions & 0 deletions ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.svelte']
},
env: {
es6: true,
browser: true
},
overrides: [
{
files: ['*.svelte'],
processor: 'svelte3/svelte3'
}
],
settings: {
'svelte3/typescript': require('typescript')
},
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['node_modules']
}
11 changes: 11 additions & 0 deletions ui/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
arrowParens: 'avoid',
singleQuote: true,
printWidth: 90,
plugins: ['prettier-plugin-svelte'],
semi: false,
svelteSortOrder: 'options-styles-scripts-markup',
svelteStrictMode: false,
svelteIndentScriptAndStyle: true,
trailingComma: 'none'
}
9 changes: 9 additions & 0 deletions ui/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
npm = npm --prefix ./ui
npm_run = $(npm) run

.PHONY: lint-ui
lint-ui: .npm-install ## Runs linters for the UI code
$(npm_run) lint

.npm-install:
$(npm) install
Loading

0 comments on commit da37a95

Please sign in to comment.