Skip to content

Commit

Permalink
Merge pull request #15 from Alirezaja1384/lint-workflow
Browse files Browse the repository at this point in the history
feat(Test workflow): Linting
  • Loading branch information
Alirezaja1384 authored Aug 19, 2024
2 parents 6937558 + 98eee83 commit b970c08
Show file tree
Hide file tree
Showing 5 changed files with 1,444 additions and 153 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: Lint and run tests
on:
pull_request:
types: [opened, synchronize, reopened]
Expand Down Expand Up @@ -27,6 +27,11 @@ jobs:
- name: Install dependencies
run: npm install

- name: Lint code
id: lint
continue-on-error: true
run: npm run lint

- name: Run tests
env:
CHROME_BIN: ${{ steps.chromedriver.outputs.chrome-path }}
Expand All @@ -36,3 +41,9 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Fail if linting failed
if: ${{ steps.lint.outcome == 'failure' }}
run: |
echo "Linting failed. Failing the workflow."
exit 1
14 changes: 13 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,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/schematics"
]
}
}
43 changes: 43 additions & 0 deletions 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 b970c08

Please sign in to comment.