Skip to content

Commit

Permalink
Add and configure ESLint and update configuration for Prettier (#617)
Browse files Browse the repository at this point in the history
* Add ESLint, update Prettier

* Update docs

* Update tests

* Update licenses

* Fix review points
  • Loading branch information
IvanZosimov committed Mar 9, 2023
1 parent 7b9ef6f commit ec365b4
Show file tree
Hide file tree
Showing 36 changed files with 3,781 additions and 553 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
@@ -0,0 +1,6 @@
# Ignore list
/*

# Do not ignore these folders:
!__tests__/
!src/
49 changes: 49 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,49 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin-jest/recommended',
'eslint-config-prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-jest'],
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}]
},
overrides: [
{
files: ['**/*{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off',

}
}
],
env: {
node: true,
es6: true,
'jest/globals': true
}
};
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
@@ -1 +1 @@
blank_issues_enabled: false
blank_issues_enabled: false
2 changes: 1 addition & 1 deletion .github/workflows/basic-validation.yml
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/check-dist.yml
Expand Up @@ -14,4 +14,4 @@ on:
jobs:
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -2,12 +2,12 @@ name: CodeQL analysis

on:
push:
branches: [ 'main' ]
branches: ['main']
pull_request:
schedule:
- cron: '0 3 * * 0'

jobs:
call-codeQL-analysis:
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/e2e-cache.yml
Expand Up @@ -128,4 +128,4 @@ jobs:
pipenv install --keep-outdated --python pypy
} else {
pipenv install --keep-outdated --python ${{ matrix.python-version }}
}
}
120 changes: 60 additions & 60 deletions .github/workflows/e2e-tests.yml
Expand Up @@ -9,7 +9,7 @@ on:
pull_request:
paths-ignore:
- '**.md'

jobs:
test-setup-python:
name: Test setup-python
Expand All @@ -18,71 +18,71 @@ jobs:
matrix:
operating-system: [ubuntu-20.04, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Run with setup-python 2.7
uses: ./
with:
python-version: 2.7
- name: Verify 2.7
run: python __tests__/verify-python.py 2.7
- name: Run with setup-python 2.7
uses: ./
with:
python-version: 2.7
- name: Verify 2.7
run: python __tests__/verify-python.py 2.7

- name: Run with setup-python 3.5
uses: ./
with:
python-version: 3.5
- name: Verify 3.5
run: python __tests__/verify-python.py 3.5
- name: Run with setup-python 3.5
uses: ./
with:
python-version: 3.5
- name: Verify 3.5
run: python __tests__/verify-python.py 3.5

- name: Run with setup-python 3.6
uses: ./
with:
python-version: 3.6
- name: Verify 3.6
run: python __tests__/verify-python.py 3.6
- name: Run with setup-python 3.6
uses: ./
with:
python-version: 3.6
- name: Verify 3.6
run: python __tests__/verify-python.py 3.6

- name: Run with setup-python 3.7
uses: ./
with:
python-version: 3.7
- name: Verify 3.7
run: python __tests__/verify-python.py 3.7
- name: Run with setup-python 3.7
uses: ./
with:
python-version: 3.7
- name: Verify 3.7
run: python __tests__/verify-python.py 3.7

- name: Run with setup-python 3.8
uses: ./
with:
python-version: 3.8
- name: Verify 3.8
run: python __tests__/verify-python.py 3.8
- name: Run with setup-python 3.8
uses: ./
with:
python-version: 3.8
- name: Verify 3.8
run: python __tests__/verify-python.py 3.8

- name: Run with setup-python 3.7.5
uses: ./
with:
python-version: 3.7.5
- name: Verify 3.7.5
run: python __tests__/verify-python.py 3.7.5
- name: Run with setup-python 3.7.5
uses: ./
with:
python-version: 3.7.5
- name: Verify 3.7.5
run: python __tests__/verify-python.py 3.7.5

- name: Run with setup-python 3.6.7
uses: ./
with:
python-version: 3.6.7
- name: Verify 3.6.7
run: python __tests__/verify-python.py 3.6.7
- name: Run with setup-python 3.6.7
uses: ./
with:
python-version: 3.6.7
- name: Verify 3.6.7
run: python __tests__/verify-python.py 3.6.7

- name: Run with setup-python 3.8.1
uses: ./
with:
python-version: 3.8.1
- name: Verify 3.8.1
run: python __tests__/verify-python.py 3.8.1
- name: Run with setup-python 3.8.1
uses: ./
with:
python-version: 3.8.1
- name: Verify 3.8.1
run: python __tests__/verify-python.py 3.8.1

- name: Run with setup-python 3.10
id: cp310
uses: ./
with:
python-version: "3.10"
- name: Verify 3.10
run: python __tests__/verify-python.py 3.10
- name: Run python-path sample 3.10
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
- name: Run with setup-python 3.10
id: cp310
uses: ./
with:
python-version: '3.10'
- name: Verify 3.10
run: python __tests__/verify-python.py 3.10
- name: Run python-path sample 3.10
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
2 changes: 1 addition & 1 deletion .github/workflows/licensed.yml
Expand Up @@ -11,4 +11,4 @@ on:
jobs:
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
10 changes: 5 additions & 5 deletions .github/workflows/release-new-action-version.yml
Expand Up @@ -21,8 +21,8 @@ jobs:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
34 changes: 17 additions & 17 deletions .github/workflows/test-pypy.yml
@@ -1,6 +1,6 @@
name: Validate PyPy e2e

on:
on:
push:
branches:
- main
Expand All @@ -21,22 +21,22 @@ jobs:
matrix:
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest]
pypy:
- 'pypy-2.7'
- 'pypy-3.7'
- 'pypy3.9'
- 'pypy-2.7-v7.3.4'
- 'pypy-3.7-v7.3.5'
- 'pypy-3.7-v7.3.4'
- 'pypy-3.7-v7.3.x'
- 'pypy-3.7-v7.x'
- 'pypy-2.7-v7.3.4rc1'
- 'pypy-3.7-nightly'
- 'pypy3.8-v7.3.7'
- 'pypy-2.7'
- 'pypy-3.7'
- 'pypy3.9'
- 'pypy-2.7-v7.3.4'
- 'pypy-3.7-v7.3.5'
- 'pypy-3.7-v7.3.4'
- 'pypy-3.7-v7.3.x'
- 'pypy-3.7-v7.x'
- 'pypy-2.7-v7.3.4rc1'
- 'pypy-3.7-nightly'
- 'pypy3.8-v7.3.7'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: setup-python ${{ matrix.pypy }}
id: setup-python
uses: ./
Expand All @@ -49,7 +49,7 @@ jobs:

- name: PyPy and Python version
run: python --version

- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'

Expand Down Expand Up @@ -138,8 +138,8 @@ jobs:
uses: ./
with:
python-version: |
pypy-3.7-v7.3.x
pypy3.8
pypy-3.7-v7.3.x
pypy3.8
check-latest: true
- name: PyPy and Python version
run: python --version
Expand All @@ -166,4 +166,4 @@ jobs:
EXECUTABLE=${EXECUTABLE/pypy-/pypy} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
${EXECUTABLE} --version
shell: bash
shell: bash

0 comments on commit ec365b4

Please sign in to comment.