Skip to content

Commit ec365b4

Browse files
authored
Add and configure ESLint and update configuration for Prettier (#617)
* Add ESLint, update Prettier * Update docs * Update tests * Update licenses * Fix review points
1 parent 7b9ef6f commit ec365b4

36 files changed

+3781
-553
lines changed

.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/

.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+
};

.github/ISSUE_TEMPLATE/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: false

.github/workflows/basic-validation.yml

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

.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

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: CodeQL analysis
22

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

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

.github/workflows/e2e-cache.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,4 @@ jobs:
128128
pipenv install --keep-outdated --python pypy
129129
} else {
130130
pipenv install --keep-outdated --python ${{ matrix.python-version }}
131-
}
131+
}

.github/workflows/e2e-tests.yml

+60-60
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010
paths-ignore:
1111
- '**.md'
12-
12+
1313
jobs:
1414
test-setup-python:
1515
name: Test setup-python
@@ -18,71 +18,71 @@ jobs:
1818
matrix:
1919
operating-system: [ubuntu-20.04, windows-latest]
2020
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v3
21+
- name: Checkout
22+
uses: actions/checkout@v3
2323

24-
- name: Run with setup-python 2.7
25-
uses: ./
26-
with:
27-
python-version: 2.7
28-
- name: Verify 2.7
29-
run: python __tests__/verify-python.py 2.7
24+
- name: Run with setup-python 2.7
25+
uses: ./
26+
with:
27+
python-version: 2.7
28+
- name: Verify 2.7
29+
run: python __tests__/verify-python.py 2.7
3030

31-
- name: Run with setup-python 3.5
32-
uses: ./
33-
with:
34-
python-version: 3.5
35-
- name: Verify 3.5
36-
run: python __tests__/verify-python.py 3.5
31+
- name: Run with setup-python 3.5
32+
uses: ./
33+
with:
34+
python-version: 3.5
35+
- name: Verify 3.5
36+
run: python __tests__/verify-python.py 3.5
3737

38-
- name: Run with setup-python 3.6
39-
uses: ./
40-
with:
41-
python-version: 3.6
42-
- name: Verify 3.6
43-
run: python __tests__/verify-python.py 3.6
38+
- name: Run with setup-python 3.6
39+
uses: ./
40+
with:
41+
python-version: 3.6
42+
- name: Verify 3.6
43+
run: python __tests__/verify-python.py 3.6
4444

45-
- name: Run with setup-python 3.7
46-
uses: ./
47-
with:
48-
python-version: 3.7
49-
- name: Verify 3.7
50-
run: python __tests__/verify-python.py 3.7
45+
- name: Run with setup-python 3.7
46+
uses: ./
47+
with:
48+
python-version: 3.7
49+
- name: Verify 3.7
50+
run: python __tests__/verify-python.py 3.7
5151

52-
- name: Run with setup-python 3.8
53-
uses: ./
54-
with:
55-
python-version: 3.8
56-
- name: Verify 3.8
57-
run: python __tests__/verify-python.py 3.8
52+
- name: Run with setup-python 3.8
53+
uses: ./
54+
with:
55+
python-version: 3.8
56+
- name: Verify 3.8
57+
run: python __tests__/verify-python.py 3.8
5858

59-
- name: Run with setup-python 3.7.5
60-
uses: ./
61-
with:
62-
python-version: 3.7.5
63-
- name: Verify 3.7.5
64-
run: python __tests__/verify-python.py 3.7.5
59+
- name: Run with setup-python 3.7.5
60+
uses: ./
61+
with:
62+
python-version: 3.7.5
63+
- name: Verify 3.7.5
64+
run: python __tests__/verify-python.py 3.7.5
6565

66-
- name: Run with setup-python 3.6.7
67-
uses: ./
68-
with:
69-
python-version: 3.6.7
70-
- name: Verify 3.6.7
71-
run: python __tests__/verify-python.py 3.6.7
66+
- name: Run with setup-python 3.6.7
67+
uses: ./
68+
with:
69+
python-version: 3.6.7
70+
- name: Verify 3.6.7
71+
run: python __tests__/verify-python.py 3.6.7
7272

73-
- name: Run with setup-python 3.8.1
74-
uses: ./
75-
with:
76-
python-version: 3.8.1
77-
- name: Verify 3.8.1
78-
run: python __tests__/verify-python.py 3.8.1
73+
- name: Run with setup-python 3.8.1
74+
uses: ./
75+
with:
76+
python-version: 3.8.1
77+
- name: Verify 3.8.1
78+
run: python __tests__/verify-python.py 3.8.1
7979

80-
- name: Run with setup-python 3.10
81-
id: cp310
82-
uses: ./
83-
with:
84-
python-version: "3.10"
85-
- name: Verify 3.10
86-
run: python __tests__/verify-python.py 3.10
87-
- name: Run python-path sample 3.10
88-
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
80+
- name: Run with setup-python 3.10
81+
id: cp310
82+
uses: ./
83+
with:
84+
python-version: '3.10'
85+
- name: Verify 3.10
86+
run: python __tests__/verify-python.py 3.10
87+
- name: Run python-path sample 3.10
88+
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version

.github/workflows/licensed.yml

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

.github/workflows/release-new-action-version.yml

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

.github/workflows/test-pypy.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Validate PyPy e2e
22

3-
on:
3+
on:
44
push:
55
branches:
66
- main
@@ -21,22 +21,22 @@ jobs:
2121
matrix:
2222
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest]
2323
pypy:
24-
- 'pypy-2.7'
25-
- 'pypy-3.7'
26-
- 'pypy3.9'
27-
- 'pypy-2.7-v7.3.4'
28-
- 'pypy-3.7-v7.3.5'
29-
- 'pypy-3.7-v7.3.4'
30-
- 'pypy-3.7-v7.3.x'
31-
- 'pypy-3.7-v7.x'
32-
- 'pypy-2.7-v7.3.4rc1'
33-
- 'pypy-3.7-nightly'
34-
- 'pypy3.8-v7.3.7'
24+
- 'pypy-2.7'
25+
- 'pypy-3.7'
26+
- 'pypy3.9'
27+
- 'pypy-2.7-v7.3.4'
28+
- 'pypy-3.7-v7.3.5'
29+
- 'pypy-3.7-v7.3.4'
30+
- 'pypy-3.7-v7.3.x'
31+
- 'pypy-3.7-v7.x'
32+
- 'pypy-2.7-v7.3.4rc1'
33+
- 'pypy-3.7-nightly'
34+
- 'pypy3.8-v7.3.7'
3535

3636
steps:
3737
- name: Checkout
3838
uses: actions/checkout@v3
39-
39+
4040
- name: setup-python ${{ matrix.pypy }}
4141
id: setup-python
4242
uses: ./
@@ -49,7 +49,7 @@ jobs:
4949

5050
- name: PyPy and Python version
5151
run: python --version
52-
52+
5353
- name: Run simple code
5454
run: python -c 'import math; print(math.factorial(5))'
5555

@@ -138,8 +138,8 @@ jobs:
138138
uses: ./
139139
with:
140140
python-version: |
141-
pypy-3.7-v7.3.x
142-
pypy3.8
141+
pypy-3.7-v7.3.x
142+
pypy3.8
143143
check-latest: true
144144
- name: PyPy and Python version
145145
run: python --version
@@ -166,4 +166,4 @@ jobs:
166166
EXECUTABLE=${EXECUTABLE/pypy-/pypy} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
167167
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
168168
${EXECUTABLE} --version
169-
shell: bash
169+
shell: bash

0 commit comments

Comments
 (0)