Skip to content

Commit 4bb1571

Browse files
authored
Eslint improvements (JamesIves#686)
* Initial Pass at new configs * Improved Linting/Formatting * Update execute.ts * Update main.test.ts * Change typing * Update git.ts * Update worktree.ts * Update worktree.ts * Update worktree.ts * Maybe * Update execute.ts
1 parent 408dc2b commit 4bb1571

26 files changed

+314
-600
lines changed

.devcontainer/devcontainer.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/typescript-node
22
{
3-
"name": "Node.js & TypeScript",
4-
"build": {
5-
"dockerfile": "Dockerfile",
6-
"args": {
7-
"VARIANT": "12"
8-
}
9-
},
10-
"settings": {
11-
"terminal.integrated.shell.linux": "/bin/bash"
12-
},
13-
"extensions": [
14-
"dbaeumer.vscode-eslint"
15-
],
16-
"remoteUser": "node"
3+
"name": "Node.js & TypeScript",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"args": {
7+
"VARIANT": "12"
8+
}
9+
},
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/bash"
12+
},
13+
"extensions": ["dbaeumer.vscode-eslint"],
14+
"remoteUser": "node"
1715
}

.eslintrc.json

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
2-
"plugins": ["jest", "@typescript-eslint", "github"],
3-
"extends": ["plugin:github/recommended"],
2+
"plugins": ["jest", "@typescript-eslint"],
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:prettier/recommended"
7+
],
48
"parser": "@typescript-eslint/parser",
59
"parserOptions": {
610
"ecmaVersion": 9,
@@ -10,57 +14,61 @@
1014
"globals": {
1115
"fetch": true
1216
},
17+
"env": {
18+
"node": true,
19+
"es6": true,
20+
"jest/globals": true
21+
},
1322
"rules": {
14-
"eslint-comments/no-use": "off",
15-
"import/no-namespace": "off",
16-
"no-unused-vars": "off",
17-
"@typescript-eslint/no-unused-vars": "error",
18-
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
19-
"@typescript-eslint/no-require-imports": "error",
20-
"@typescript-eslint/array-type": "error",
21-
"@typescript-eslint/await-thenable": "error",
22-
"@typescript-eslint/ban-ts-comment": "error",
23-
"camelcase": "off",
24-
"@typescript-eslint/naming-convention": [
23+
"@typescript-eslint/ban-types": [
2524
"error",
2625
{
27-
"selector": "default",
28-
"format": ["camelCase", "UPPER_CASE", "StrictPascalCase"]
26+
"types": {
27+
"Number": {
28+
"message": "Use number instead",
29+
"fixWith": "number"
30+
},
31+
"String": {
32+
"message": "Use string instead",
33+
"fixWith": "string"
34+
},
35+
"Boolean": {
36+
"message": "Use boolean instead",
37+
"fixWith": "boolean"
38+
},
39+
"Object": {
40+
"message": "Use object instead",
41+
"fixWith": "object"
42+
},
43+
"{}": {
44+
"message": "Use object instead",
45+
"fixWith": "object"
46+
},
47+
"Symbol": {
48+
"message": "Use symbol instead",
49+
"fixWith": "symbol"
50+
}
51+
}
2952
}
3053
],
31-
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
32-
"@typescript-eslint/func-call-spacing": ["error", "never"],
33-
"@typescript-eslint/no-array-constructor": "error",
34-
"@typescript-eslint/no-empty-interface": "error",
35-
"@typescript-eslint/no-explicit-any": "off",
36-
"@typescript-eslint/no-extraneous-class": "error",
37-
"@typescript-eslint/no-for-in-array": "error",
38-
"@typescript-eslint/no-inferrable-types": "error",
39-
"@typescript-eslint/no-misused-new": "error",
40-
"@typescript-eslint/no-namespace": "error",
41-
"@typescript-eslint/no-non-null-assertion": "warn",
42-
"@typescript-eslint/no-unnecessary-qualifier": "error",
43-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
44-
"@typescript-eslint/no-useless-constructor": "error",
45-
"@typescript-eslint/no-var-requires": "error",
46-
"@typescript-eslint/prefer-for-of": "warn",
47-
"@typescript-eslint/prefer-function-type": "warn",
48-
"@typescript-eslint/prefer-includes": "error",
49-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
50-
"@typescript-eslint/promise-function-async": "error",
51-
"@typescript-eslint/require-array-sort-compare": "error",
52-
"@typescript-eslint/restrict-plus-operands": "error",
53-
"semi": "off",
54-
"@typescript-eslint/semi": ["error", "never"],
55-
"@typescript-eslint/type-annotation-spacing": "error",
56-
"@typescript-eslint/unbound-method": "error",
57-
"no-console": "off",
58-
"no-shadow": "off", // replaced by ts-eslint rule below
59-
"@typescript-eslint/no-shadow": "error"
54+
"@typescript-eslint/array-type": ["error", {"default": "array"}],
55+
"@typescript-eslint/explicit-module-boundary-types": "error",
56+
"@typescript-eslint/no-explicit-any": "error",
57+
"@typescript-eslint/no-unused-vars": "error",
58+
"@typescript-eslint/explicit-function-return-type": "error",
59+
"object-shorthand": ["error", "always"],
60+
"prefer-destructuring": [
61+
"error",
62+
{
63+
"array": false,
64+
"object": true
6065
},
61-
"env": {
62-
"node": true,
63-
"es6": true,
64-
"jest/globals": true
66+
{
67+
"enforceForRenamedProperties": false
68+
}
69+
],
70+
"no-console": ["error", {"allow": ["warn", "error"]}],
71+
"no-alert": "error",
72+
"no-debugger": "error"
6573
}
6674
}

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ name: Bug Report
33
about: Create a bug report to help us improve the action.
44
labels:
55
- bug
6-
76
---
87

98
<!-- Please check the Q&A before posting an issue: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AQ%26A -->
109

1110
## Describe the bug
11+
1212
<!-- Please provide a clear and concise description of what the bug is. -->
1313

1414
## Reproduction Steps
15+
1516
<!-- Steps to reproduce the behavior. -->
1617

1718
## Logs
19+
1820
<!-- Please provide your deployment logs and a link or sample to/of your workflow. If the error message isn't revealing the problem please set ACTIONS_STEP_DEBUG to true in your repository's secrets menu and run the workflow again. -->
1921

2022
## Additional Comments
23+
2124
<!--Add any other context about the problem here. -->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ contact_links:
33
- name: Feature Request and Ideas
44
url: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AIdeas
55
about: If you have an idea or would like to make a feature request please open a discussion thread.
6-
6+
77
- name: Support and Questions
88
url: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AQ%26A
99
about: Need help or just have a general question? Please open a discussion thread.
10-

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
## Description
2+
23
<!-- Provide a description of what your changes do. -->
34

45
## Testing Instructions
6+
57
<!-- Give us step by step instructions on how to test your changes. -->
68

79
## Additional Notes
10+
811
<!-- Anything else that will help us test the pull request. -->

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "10:00"
8-
open-pull-requests-limit: 10
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: daily
7+
time: '10:00'
8+
open-pull-requests-limit: 10

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ jobs:
7272
needs: build
7373
strategy:
7474
matrix:
75-
branch: ["gh-pages", "no-pages"]
76-
commit: ["singleCommit", "add commits"]
75+
branch: ['gh-pages', 'no-pages']
76+
commit: ['singleCommit', 'add commits']
7777
max-parallel: 1
7878
steps:
7979
- name: Checkout
@@ -120,7 +120,7 @@ jobs:
120120
if: ${{ matrix.branch == 'gh-pages' }}
121121
with:
122122
folder: integration
123-
branch: ${{ matrix.branch }}
123+
branch: ${{ matrix.branch }}
124124
single-commit: ${{ matrix.commit == 'singleCommit' }}
125125
dry-run: true
126126

.github/workflows/codeql-analysis.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL"
1+
name: 'CodeQL'
22
on:
33
push:
44
branches:
@@ -18,14 +18,14 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v2
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
2323

24-
- name: Initialize CodeQL
25-
uses: github/codeql-action/init@v1
24+
- name: Initialize CodeQL
25+
uses: github/codeql-action/init@v1
2626

27-
- name: Autobuild
28-
uses: github/codeql-action/autobuild@v1
27+
- name: Autobuild
28+
uses: github/codeql-action/autobuild@v1
2929

30-
- name: Perform CodeQL Analysis
31-
uses: github/codeql-action/analyze@v1
30+
- name: Perform CodeQL Analysis
31+
uses: github/codeql-action/analyze@v1

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
branch: releases/v4
1919
folder: .
2020
clean: false
21-
single-commit: true
21+
single-commit: true

.github/workflows/integration.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
single-commit: true
3535
clean: true
3636
silent: true
37-
37+
3838
# Deploys using checkout@v1 with an ACCESS_TOKEN.
3939
integration-checkout-v1:
4040
needs: integration-cross-repo-push
@@ -84,7 +84,6 @@ jobs:
8484
github_token: ${{ secrets.GITHUB_TOKEN }}
8585
branches: gh-pages
8686

87-
8887
# Deploys using a container that requires you to install rsync.
8988
integration-container:
9089
needs: integration-checkout-v2
@@ -203,7 +202,15 @@ jobs:
203202

204203
# Deploys using the CLEAN option.
205204
integration-clean:
206-
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-ssh-third-party-client, integration-env]
205+
needs:
206+
[
207+
integration-checkout-v1,
208+
integration-checkout-v2,
209+
integration-container,
210+
integration-ssh,
211+
integration-ssh-third-party-client,
212+
integration-env
213+
]
207214
runs-on: ubuntu-latest
208215
steps:
209216
- name: Checkout

0 commit comments

Comments
 (0)