Skip to content

Commit

Permalink
chore: fixing gh linter
Browse files Browse the repository at this point in the history
wip

wip

wip

wip

wip

wip

wip

wip
  • Loading branch information
ynahmany committed Nov 6, 2024
1 parent 6df1406 commit 1e6779f
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 97 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

78 changes: 0 additions & 78 deletions .github/linters/.eslintrc.yml

This file was deleted.

114 changes: 114 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import jest from 'eslint-plugin-jest'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})

export default [
{
ignores: [
'!**/.*',
'**/node_modules/.*',
'**/dist/.*',
'dist/**/*',
'**/lib/.*',
'**/coverage/.*',
'**/*.json',
'**/eslint.config.mjs'
]
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended'
),
{
plugins: {
jest,
'@typescript-eslint': typescriptEslint
},

languageOptions: {
globals: {
...globals.node,
...globals.jest,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},

parser: tsParser,
ecmaVersion: 2023,
sourceType: 'module',

parserOptions: {
project: ['./.github/linters/tsconfig.json', './tsconfig.json']
}
},

rules: {
camelcase: 'off',
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
'no-console': 'off',
'no-unused-vars': 'off',
semi: 'off',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',

'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public'
}
],

'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true
}
],

'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-function-type': 'warn',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/unbound-method': 'error'
}
}
]
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ jobs:
- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 2000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
# - name: Print Output
# id: output
# run: echo "${{ steps.test-action.outputs }}"
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name: Test Action
on:
workflow_dispatch:

permissions:
contents: read

jobs:
test-action-sharding:
strategy:
fail-fast: false
matrix:
shard: [1, 2]
fail-fast: false
matrix:
shard: [1, 2]
runs-on: ubuntu-latest
env:
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
Expand All @@ -27,7 +30,6 @@ jobs:
run: |
echo "Key: ${{ env.CURRENTS_RECORD_KEY }}"
echo "Matrix Index: ${{ matrix.shard }}"
echo "Matrix Total: ${{ matrix.job-total }}"
- name: Run My Action (Sharding)
id: sharding_action
Expand All @@ -36,7 +38,7 @@ jobs:
debug: true
pw-output-dir: basic/test-results
matrix-index: ${{ matrix.shard }}
matrix-total: ${{ matrix.job-total }}
# matrix-total: ${{ matrix.shard.length }}

- name: Verify Action Output (Sharding)
run: |
Expand All @@ -47,13 +49,12 @@ jobs:
fail-fast: false
matrix:
shard: [1, 2]
runs-on: ubuntu-latest
runs-on: ubuntu-latest
env:
CURRENTS_PROJECT_ID: ${{ secrets.CURRENTS_PROJECT_ID }}
CURRENTS_API_KEY: ${{ secrets.CURRENTS_API_KEY }}
CURRENTS_REST_API_URL: ${{ secrets.CURRENTS_REST_API_URL }}

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
},
"scripts": {
"bundle": "npm run format:write && npm run package",
"ci-test": "npx jest",
"ci-test": "npx jest --passWithNoTests",
"coverage": "npx make-coverage-badge --output-path ./badges/coverage.svg",
"format:write": "npx prettier --write .",
"format:check": "npx prettier --check .",
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
"lint": "npx eslint . -c ./.github/linters/eslint.config.mjs",
"package:index": "ncc build src/index.ts -o dist/index && mv dist/index/index.js dist/ && rm -rf dist/index",
"package:post": "ncc build src/post.ts -o dist/post && mv dist/post/index.js dist/post/post.js && mv dist/post/post.js dist/post.js && rm -rf dist/post",
"package": "npm run package:index && npm run package:post",
"package:watch": "npm run package -- --watch",
"test": "npx jest",
"test": "npx jest --passWithNoTests",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
},
"license": "MIT",
Expand Down

0 comments on commit 1e6779f

Please sign in to comment.