Skip to content

Commit

Permalink
chore: Align tooling with team standards (#278)
Browse files Browse the repository at this point in the history
* Align pre-commit with team norms defined in devx-ts-starter repo

* Remove babel

Using tsc for compilation

* Cleanup unnecessary @typescript-eslint/* deps

Included in typescript-eslint package

* Update to eslint@9

* Align jest config with team norms in devx-ts-starter

* Actually run pre-commit hook

* Update deprecated ts-eslint rule to newer name

* Configure coverage src for jest properly

Coverage stats are currently useless, however.

* Don't init husky in ci

* Downgrade python for compat with gsutil

* Revert overzealous prettifying

* apply pretty-quick to the same set of files we do for fmt

* Revert overzelous prettifying
  • Loading branch information
mhan83 authored Oct 18, 2024
1 parent fb6f713 commit 2224395
Show file tree
Hide file tree
Showing 9 changed files with 731 additions and 1,917 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
npm ci
npx playwright install
npx playwright install-deps
env:
HUSKY: 0

- name: Generate (Pre-)Release Draft
if: ${{ steps.prep.outputs.tag_name == '' }}
Expand Down Expand Up @@ -365,6 +367,7 @@ jobs:
working-directory: ./tests/fixtures/post-release/cucumber
env:
BUILD_ID: Github RUN ID ${{ env.GITHUB_RUN_ID }}
HUSKY: 0
run: |
npm ci --production
saucectl run --runner-version "url: https://github.com/saucelabs/sauce-playwright-runner/releases/download/${{ steps.parse_version.outputs.version }}/playwright-windows-amd64.zip" --config ./.sauce/config_win.yml
Expand Down Expand Up @@ -399,6 +402,7 @@ jobs:
working-directory: ./tests/fixtures/post-release/cucumber
env:
BUILD_ID: Github RUN ID ${{ env.GITHUB_RUN_ID }}
HUSKY: 0
run: |
npm ci --production
saucectl run --runner-version "url: https://github.com/saucelabs/sauce-playwright-runner/releases/download/${{ steps.parse_version.outputs.version }}/playwright-macos-amd64.zip" --config ./.sauce/config_mac.yml
14 changes: 11 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:

- name: Install Dependencies
run: npm ci
env:
HUSKY: 0

- name: Lint
run: npm run lint
Expand All @@ -53,6 +55,8 @@ jobs:
npm ci
npx playwright install
npx playwright install-deps
env:
HUSKY: 0

- name: Build
run: npm run build
Expand All @@ -77,6 +81,8 @@ jobs:
npm ci
npx playwright install
npx playwright install-deps
env:
HUSKY: 0

- name: Build
run: npm run build
Expand Down Expand Up @@ -104,7 +110,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.11"

- name: Google Cloud Login
uses: 'google-github-actions/auth@v2'
Expand Down Expand Up @@ -152,7 +158,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.11"

- name: Google Cloud Login
id: "auth"
Expand Down Expand Up @@ -241,7 +247,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.11"

- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
Expand Down Expand Up @@ -314,3 +320,5 @@ jobs:
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config .sauce/config_${{ matrix.os }}.yml
env:
HUSKY: 0
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged --pattern "**/*.{js,ts,mjs,cjs}"
npm run lint
4 changes: 0 additions & 4 deletions .husky/pre-push

This file was deleted.

3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

13 changes: 7 additions & 6 deletions eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const ts = require('typescript-eslint');
const js = require('@eslint/js');
const prettier = require('eslint-config-prettier');
const jest = require('eslint-plugin-jest');
// @ts-check
import ts from 'typescript-eslint';
import js from '@eslint/js';
import prettier from 'eslint-config-prettier';
import jest from 'eslint-plugin-jest';

module.exports = ts.config(
export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
prettier,
Expand All @@ -13,7 +14,7 @@ module.exports = ts.config(
{
files: ['**/*.*js', '**/*.*ts'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'no-control-regex': 'off',
'no-undef': 'warn',
Expand Down
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/** @type {import('jest').Config} */
const config = {
testMatch: ['**/tests/unit/**/*.[jt]s?(x)'],
collectCoverageFrom: ['src/**/*.js'],
collectCoverageFrom: ['src/**/*.ts'],
collectCoverage: true,
transformIgnorePatterns: [
'/node_modules/(?!(axios)/)', // Uses module import statements, which aren't supported by jest, so it has to be transformed by babel.
],
clearMocks: true,
coverageProvider: 'v8',
transform: { '^.+\\.ts?$': 'ts-jest' },
};

module.exports = config;
Loading

0 comments on commit 2224395

Please sign in to comment.