Skip to content

Commit

Permalink
Add and configure ESLint and update configuration for Prettier (actio…
Browse files Browse the repository at this point in the history
…ns#458)

* Add ESLint config and update Prettier

* Update test files

* Rebuild action

* Update docs

* Update licenses

* Update tsconfig

* Rebuild action

* Update tsconfig.json

* Fix console.time calls

* Rebuild action

* Rebuild action on Linux
  • Loading branch information
IvanZosimov authored and fniephaus committed Jun 20, 2023
1 parent 68e383d commit eabd006
Show file tree
Hide file tree
Showing 55 changed files with 4,415 additions and 1,330 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore list
/*

# Do not ignore these folders:
!__tests__/
!src/
49 changes: 49 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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
}
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* text=auto eol=lf
dist/index.js -diff -merge
dist/index.js linguist-generated=true
.licenses/** -diff linguist-generated=true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
blank_issues_enabled: false
blank_issues_enabled: false
2 changes: 1 addition & 1 deletion .github/workflows/basic-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,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
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: CodeQL analysis

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
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
1 change: 0 additions & 1 deletion .github/workflows/e2e-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ jobs:
exit 1
fi
- name: Check files to cache on ubuntu-latest
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
if ($content -notlike '*maven*') {
throw "settings.xml file is not overwritten"
}
test-publishing-skip-overwrite:
name: settings.xml is not overwritten if flag is false
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -150,4 +150,4 @@ jobs:
$path = Join-Path $env:RUNNER_TEMP "settings.xml"
if (-not (Test-Path $path)) {
throw "settings.xml file is not found in expected location"
}
}
54 changes: 31 additions & 23 deletions .github/workflows/e2e-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
paths-ignore:
- '**.md'
schedule:
- cron: '0 */12 * * *'
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
setup-java-major-versions:
Expand All @@ -21,21 +21,29 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft', 'corretto' ] # internally 'adopt-hotspot' is the same as 'adopt'
distribution: [
'temurin',
'adopt',
'adopt-openj9',
'zulu',
'liberica',
'microsoft',
'corretto'
] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['8', '11', '16']
exclude:
- distribution: microsoft
version: 8
- distribution: microsoft
version: 8
include:
- distribution: oracle
os: macos-latest
version: 17
- distribution: oracle
os: windows-latest
version: 19
- distribution: oracle
os: ubuntu-latest
version: 19
- distribution: oracle
os: macos-latest
version: 17
- distribution: oracle
os: windows-latest
version: 19
- distribution: oracle
os: ubuntu-latest
version: 19
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -59,13 +67,13 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica']
version:
- '11.0'
- '8.0.302'
- '16.0.2+7'
- '11.0'
- '8.0.302'
- '16.0.2+7'
include:
- distribution: oracle
os: ubuntu-latest
version: '19.0.1'
- distribution: oracle
os: ubuntu-latest
version: '19.0.1'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -262,7 +270,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'microsoft', 'corretto' ]
distribution: ['temurin', 'microsoft', 'corretto']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -287,7 +295,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'microsoft', 'corretto' ]
distribution: ['temurin', 'zulu', 'liberica', 'microsoft', 'corretto']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -311,7 +319,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: [ 'adopt', 'adopt-openj9', 'zulu' ]
distribution: ['adopt', 'adopt-openj9', 'zulu']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -335,7 +343,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['adopt', 'zulu', 'liberica' ]
distribution: ['adopt', 'zulu', 'liberica']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-new-action-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-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
id: update-major-tag
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
26 changes: 26 additions & 0 deletions .licenses/npm/semver-7.3.8.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ignore list
/*

# Do not ignore these folders:
!__tests__/
!.github/
!src/
10 changes: 10 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'none',
bracketSpacing: false,
arrowParens: 'avoid'
};
11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

0 comments on commit eabd006

Please sign in to comment.