Skip to content

Commit

Permalink
ci: update workflow and add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
hungtcs committed Sep 24, 2021
1 parent 7fe0aaf commit acd44f0
Show file tree
Hide file tree
Showing 51 changed files with 1,231 additions and 236 deletions.
146 changes: 128 additions & 18 deletions .eslintrc
@@ -1,27 +1,137 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
"root": true,
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/keyword-spacing": [
"error",
{
"after": true
}
],
"@typescript-eslint/no-empty-function": [
"warn",
{
"allow": [
"constructors",
"decoratedFunctions"
]
}
],
"@typescript-eslint/explicit-member-accessibility": [
"warn",
{
"accessibility": "explicit",
"overrides": {
"constructors": "no-public"
}
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint/eslint-plugin"
],
"extends": [
"plugin:@typescript-eslint/recommended"
],
"root": true,
"env": {
"node": true,
"jest": true
},
"ignorePatterns": [
".eslintrc.js"
],
"rules": {
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off"
}
"overrides": [
{
"env": {
"node": true,
"jest": true
},
"files": [
"server/**/*.ts"
],
"rules": {
"@typescript-eslint/indent": [
"error",
2,
{
"ignoredNodes": ["Decorator"],
"FunctionDeclaration": {
"parameters": 2
},
"FunctionExpression": {
"parameters": 2
}
}
]
},
"parserOptions": {
"project": "tsconfig.server.json",
"sourceType": "module"
}
},
{
"files": [
"webapp/**/*.ts"
],
"parserOptions": {
"project": [
"tsconfig.webapp.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@typescript-eslint/indent": [
"error",
2,
{
"FunctionDeclaration": {
"parameters": 2
},
"FunctionExpression": {
"parameters": 2
}
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/no-input-rename": "off",
"@angular-eslint/no-output-rename": "off",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/no-empty-lifecycle-method": "off"
}
},
{
"files": [
"webapp/**/*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}
43 changes: 43 additions & 0 deletions .github/workflows/lint-build.yml
@@ -0,0 +1,43 @@
name: Lint And Build Server And Webapp

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 14.x
- 16.x

steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm ci

- name: Lint Server
run: npm run lint:server

- name: Lint Webapp
run: npm run lint:webapp

- name: Build Server
run: npm run build:server

- name: Build Webapp
run: npm run build:webapp
28 changes: 0 additions & 28 deletions .github/workflows/webpack.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
@@ -1,2 +1,4 @@
Dashboard
====

![lint-build workflow](https://github.com/hungtcs/dashboard/actions/workflows/lint-build.yml/badge.svg)
13 changes: 12 additions & 1 deletion angular.json
Expand Up @@ -2,7 +2,8 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "npm"
"packageManager": "npm",
"defaultCollection": "@angular-eslint/schematics"
},
"newProjectRoot": "projects",
"schematics": {
Expand Down Expand Up @@ -108,6 +109,16 @@
"options": {
"browserTarget": "webapp:build"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": ".eslintrc",
"lintFilePatterns": [
"webapp/**/*.ts",
"webapp/**/*.html"
]
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions apps/current-time/index.ts
Expand Up @@ -8,6 +8,4 @@ class CurrentTime {

}

export const a = 1;

export default CurrentTime;

0 comments on commit acd44f0

Please sign in to comment.