Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSR-1743] chore: fixing gh linter #10

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

115 changes: 115 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
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',
'coverage/**/*'
]
},
...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'
}
}
]
64 changes: 0 additions & 64 deletions .github/workflows/ci.yml

This file was deleted.

35 changes: 24 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ name: Test Action

on:
workflow_dispatch:
ynahmany marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [main]
push:
branches: [main]

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 @@ -19,24 +26,31 @@ jobs:
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Print inputs for debugging (Sharding)
run: |
echo "Key: ${{ env.CURRENTS_RECORD_KEY }}"
echo "Matrix Index: ${{ matrix.shard }}"
echo "Matrix Total: ${{ matrix.job-total }}"

- name: Create the output file
run: |
mkdir playwright-last-failed
cd playwright-last-failed
mkdir test-result
cd test-result
touch .last-run.json
cd ../..
ls -la
- name: Run My Action (Sharding)
id: sharding_action
uses: ./
with:
debug: true
pw-output-dir: basic/test-results
pw-output-dir: test-results
matrix-index: ${{ matrix.shard }}
matrix-total: ${{ matrix.job-total }}
matrix-total: 2

- name: Verify Action Output (Sharding)
run: |
Expand All @@ -47,19 +61,18 @@ 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

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@ following steps:
1. **Pushing changes to remote:** Finally, the script pushes the necessary
commits, tags and branches to the remote repository. From here, you will need
to create a new release in GitHub so users can easily reference the new tags
in their workflows.
in their workflows .
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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