Skip to content

Commit c822405

Browse files
authored
Add and configure ESLint and update configuration for Prettier (actions#391)
* Apply ESLint config and update Prettier * Update dependencies and rebuild * Update docs
1 parent 926f442 commit c822405

27 files changed

+3282
-1104
lines changed

Diff for: .eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore list
2+
/*
3+
4+
# Do not ignore these folders:
5+
!__tests__/
6+
!src/

Diff for: .eslintrc.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/recommended',
5+
'plugin:eslint-plugin-jest/recommended',
6+
'eslint-config-prettier'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
plugins: ['@typescript-eslint', 'eslint-plugin-jest'],
10+
rules: {
11+
'@typescript-eslint/no-require-imports': 'error',
12+
'@typescript-eslint/no-non-null-assertion': 'off',
13+
'@typescript-eslint/no-explicit-any': 'off',
14+
'@typescript-eslint/no-empty-function': 'off',
15+
'@typescript-eslint/ban-ts-comment': [
16+
'error',
17+
{
18+
'ts-ignore': 'allow-with-description'
19+
}
20+
],
21+
'no-console': 'error',
22+
'yoda': 'error',
23+
'prefer-const': [
24+
'error',
25+
{
26+
destructuring: 'all'
27+
}
28+
],
29+
'no-control-regex': 'off',
30+
'no-constant-condition': ['error', {checkLoops: false}]
31+
},
32+
overrides: [
33+
{
34+
files: ['**/*{test,spec}.ts'],
35+
rules: {
36+
'@typescript-eslint/no-unused-vars': 'off',
37+
'jest/no-standalone-expect': 'off',
38+
'jest/no-conditional-expect': 'off',
39+
'no-console': 'off',
40+
41+
}
42+
}
43+
],
44+
env: {
45+
node: true,
46+
es6: true,
47+
'jest/globals': true
48+
}
49+
};

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
* text=auto eol=lf
12
.licenses/** -diff linguist-generated=true

Diff for: .github/workflows/basic-validation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ on:
1414
jobs:
1515
call-basic-validation:
1616
name: Basic validation
17-
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
17+
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main

Diff for: .github/workflows/check-dist.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ on:
1414
jobs:
1515
call-check-dist:
1616
name: Check dist/
17-
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
17+
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main

Diff for: .github/workflows/codeql-analysis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: CodeQL analysis
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88
schedule:
99
- cron: '0 3 * * 0'
1010

1111
jobs:
1212
call-codeQL-analysis:
13-
name: CodeQL analysis
14-
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
13+
name: CodeQL analysis
14+
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main

Diff for: .github/workflows/e2e-tests.yml

+74-74
Original file line numberDiff line numberDiff line change
@@ -192,83 +192,83 @@ jobs:
192192
run: __tests__/verify-dotnet.ps1 2.2 3.1
193193

194194
test-setup-with-dotnet-quality:
195-
runs-on: ${{ matrix.operating-system }}
196-
strategy:
197-
fail-fast: false
198-
matrix:
199-
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
200-
steps:
201-
- name: Checkout
202-
uses: actions/checkout@v3
203-
- name: Clear toolcache
204-
shell: pwsh
205-
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
206-
207-
- name: Setup dotnet 7.0 with preview quality
208-
uses: ./
209-
with:
210-
dotnet-version: "7.0"
211-
dotnet-quality: "preview"
212-
- name: Verify preview version
213-
shell: pwsh
214-
run: |
215-
$version = & dotnet --version
216-
Write-Host "Installed version: $version"
217-
if (-not ($version.Contains("preview") -or $version.Contains("rc"))) { throw "Unexpected version" }
218-
195+
runs-on: ${{ matrix.operating-system }}
196+
strategy:
197+
fail-fast: false
198+
matrix:
199+
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
200+
steps:
201+
- name: Checkout
202+
uses: actions/checkout@v3
203+
- name: Clear toolcache
204+
shell: pwsh
205+
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
206+
207+
- name: Setup dotnet 7.0 with preview quality
208+
uses: ./
209+
with:
210+
dotnet-version: '7.0'
211+
dotnet-quality: 'preview'
212+
- name: Verify preview version
213+
shell: pwsh
214+
run: |
215+
$version = & dotnet --version
216+
Write-Host "Installed version: $version"
217+
if (-not ($version.Contains("preview") -or $version.Contains("rc"))) { throw "Unexpected version" }
218+
219219
test-dotnet-version-output-during-single-version-installation:
220-
runs-on: ${{ matrix.operating-system }}
221-
strategy:
222-
fail-fast: false
223-
matrix:
224-
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
225-
steps:
226-
- name: Checkout
227-
uses: actions/checkout@v3
228-
- name: Clear toolcache
229-
shell: pwsh
230-
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
231-
232-
- name: Setup dotnet 6.0.401
233-
uses: ./
234-
id: step1
235-
with:
236-
dotnet-version: "6.0.401"
220+
runs-on: ${{ matrix.operating-system }}
221+
strategy:
222+
fail-fast: false
223+
matrix:
224+
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
225+
steps:
226+
- name: Checkout
227+
uses: actions/checkout@v3
228+
- name: Clear toolcache
229+
shell: pwsh
230+
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
231+
232+
- name: Setup dotnet 6.0.401
233+
uses: ./
234+
id: step1
235+
with:
236+
dotnet-version: '6.0.401'
237+
238+
- name: Verify value of the dotnet-version output
239+
shell: pwsh
240+
run: |
241+
$version = & dotnet --version
242+
Write-Host "Installed version: $version"
243+
if (-not ($version -eq '${{steps.step1.outputs.dotnet-version}}')) { throw "Unexpected output value" }
237244
238-
- name: Verify value of the dotnet-version output
239-
shell: pwsh
240-
run: |
241-
$version = & dotnet --version
242-
Write-Host "Installed version: $version"
243-
if (-not ($version -eq '${{steps.step1.outputs.dotnet-version}}')) { throw "Unexpected output value" }
244-
245245
test-dotnet-version-output-during-multiple-version-installation:
246-
runs-on: ${{ matrix.operating-system }}
247-
strategy:
248-
fail-fast: false
249-
matrix:
250-
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
251-
steps:
252-
- name: Checkout
253-
uses: actions/checkout@v3
254-
- name: Clear toolcache
255-
shell: pwsh
256-
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
257-
258-
- name: Setup dotnet 6.0.401, 5.0.408, 7.0.100-rc.1.22431.12
259-
uses: ./
260-
id: step2
261-
with:
262-
dotnet-version: |
263-
7.0.100-rc.1.22431.12
264-
6.0.401
265-
5.0.408
246+
runs-on: ${{ matrix.operating-system }}
247+
strategy:
248+
fail-fast: false
249+
matrix:
250+
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
251+
steps:
252+
- name: Checkout
253+
uses: actions/checkout@v3
254+
- name: Clear toolcache
255+
shell: pwsh
256+
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
266257

267-
- name: Verify value of the dotnet-version output
268-
shell: pwsh
269-
run: |
270-
$version = "7.0.100-rc.1.22431.12"
271-
if (-not ($version -eq '${{steps.step2.outputs.dotnet-version}}')) { throw "Unexpected output value" }
258+
- name: Setup dotnet 6.0.401, 5.0.408, 7.0.100-rc.1.22431.12
259+
uses: ./
260+
id: step2
261+
with:
262+
dotnet-version: |
263+
7.0.100-rc.1.22431.12
264+
6.0.401
265+
5.0.408
266+
267+
- name: Verify value of the dotnet-version output
268+
shell: pwsh
269+
run: |
270+
$version = "7.0.100-rc.1.22431.12"
271+
if (-not ($version -eq '${{steps.step2.outputs.dotnet-version}}')) { throw "Unexpected output value" }
272272
273273
test-proxy:
274274
runs-on: ubuntu-latest
@@ -320,4 +320,4 @@ jobs:
320320
env:
321321
NUGET_AUTH_TOKEN: NOTATOKEN
322322
- name: Verify dotnet
323-
run: __tests__/verify-dotnet.sh 3.1.201
323+
run: __tests__/verify-dotnet.sh 3.1.201

Diff for: .github/workflows/licensed.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ on:
1212
jobs:
1313
call-licensed:
1414
name: Licensed
15-
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
15+
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main

Diff for: .github/workflows/release-new-action-version.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
name: releaseNewActionVersion
2222
runs-on: ubuntu-latest
2323
steps:
24-
- name: Update the ${{ env.TAG_NAME }} tag
25-
id: update-major-tag
26-
uses: actions/publish-action@v0.2.2
27-
with:
28-
source-tag: ${{ env.TAG_NAME }}
29-
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
24+
- name: Update the ${{ env.TAG_NAME }} tag
25+
id: update-major-tag
26+
uses: actions/publish-action@v0.2.2
27+
with:
28+
source-tag: ${{ env.TAG_NAME }}
29+
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

Diff for: .github/workflows/test-dotnet.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
run: |
3535
$version = & dotnet --version
3636
Write-Host "Installed version: $version"
37-
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }
37+
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }

Diff for: .husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
npm run format
5+
npm run lint:fix

Diff for: .husky/pre-push

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
# Tests are not run at push time since they can take 2-4 minutes to complete
55
npm run format-check
6+
npm run lint

Diff for: .prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore list
2+
/*
3+
4+
# Do not ignore these folders:
5+
!__tests__/
6+
!.github/
7+
!src/

Diff for: .prettierrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
printWidth: 80,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: true,
6+
singleQuote: true,
7+
trailingComma: 'none',
8+
bracketSpacing: false,
9+
arrowParens: 'avoid'
10+
};

Diff for: .prettierrc.json

-12
This file was deleted.

0 commit comments

Comments
 (0)