Skip to content

Commit

Permalink
Make ESLint its own separate job on CI. (#21)
Browse files Browse the repository at this point in the history
* Use the ESlint repo instead.

* Testing stuff.

* Remove the FIXME.

* Try using the new base.

* Remove bad comment.

* Exclude itself.

* Test.

* Remove itself?

* Harder test.

* [ci:run]

Signed-off-by: Dipack <dipack@transcend.io>

* Run eslint all the time.

* Modify log.

* Use a newer version.

* Log.

* Do lots of things.

* Use the exec.

* Log.

* Entry?

* Run over all files.

* Go back.

* Skip yarn folder.

* Exclude more files

* Bring back entry.

* Use new deps.

* Bump.

* Make a separate pre-commit action.

* Format based off of what prettier wants.

* DO not use a cache strat.

* Bump.

* Remove the bad stuff.

* Use only local stuff.

* Immutable.

* Exclude PNP file.

* Test.

* Remove and add comment.

* Bump version.

---------

Signed-off-by: Dipack <dipack@transcend.io>
  • Loading branch information
dipack95 authored Mar 14, 2024
1 parent a3d5d4c commit 1279440
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,34 @@ jobs:
with:
node-version: 20.x
- run: yarn
- uses: pre-commit/action@v3.0.0
- name: pre-commit
env:
SKIP: eslint
run: |
python -m pip install pre-commit && \
python -m pip freeze --local && \
pre-commit run \
--show-diff-on-failure \
--color=always \
--source ${{ github.event.pull_request.base.sha || 'HEAD~1' }} \
--origin ${{ github.event.pull_request.head.sha || 'HEAD' }} ;
run-eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
extra_args: --source ${{ github.event.pull_request.base.sha || 'HEAD~1' }} --origin ${{ github.event.pull_request.head.sha || 'HEAD' }}
fetch-depth: 100 # need the history to do a changed files check below (source, origin)
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 20.x
- run: yarn install --immutable

# The exclusion from the `git diff` is necessary because `yarn install`
# on CI modifies the `.pnp.cjs` file to change their actual locations
# but we don't care about that on CI.
- run: yarn lint --quiet --fix && git diff --exit-code -- . ':(exclude)*.pnp.cjs'

build-to-npm:
if: github.ref == 'refs/heads/main'
Expand All @@ -68,6 +93,7 @@ jobs:
- run-depcheck
- build-and-upload-artifacts
- run-pre-commits
- run-eslint
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -90,6 +116,7 @@ jobs:
- run-depcheck
- build-and-upload-artifacts
- run-pre-commits
- run-eslint
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
- repo: https://github.com/pre-commit/mirrors-prettier
# Use the sha / tag you want to point at, this needs
# to stay in sync with the package.json version
rev: 'v2.7.1'
rev: 'v3.0.3'
hooks:
- id: prettier
args: [--write, --list-different]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/type-utils",
"description": "Small package containing useful typescript utilities.",
"version": "1.4.0",
"version": "1.4.1",
"homepage": "https://github.com/transcend-io/type-utils",
"repository": {
"type": "git",
Expand All @@ -19,7 +19,7 @@
"update:deps": "yarn upgrade-interactive && yarn update:sdks",
"build": "yarn tsc --build",
"clean": "yarn tsc --build --clean",
"lint": "yarn eslint src --ext .ts",
"lint": "yarn eslint ./src --ext .js --ext .ts --ext .tsx --ext .jsx",
"prepublish": "yarn build",
"test": "yarn mocha './src/**/*.test.ts'"
},
Expand Down
6 changes: 2 additions & 4 deletions src/codecTools/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { unsafeCoerce } from 'fp-ts/lib/function';
import * as t from 'io-ts';

/** A record with optional keys */
export interface DictionaryC<
D extends t.Mixed,
C extends t.Mixed,
> extends t.DictionaryType<
export interface DictionaryC<D extends t.Mixed, C extends t.Mixed>
extends t.DictionaryType<
D,
C,
{
Expand Down
6 changes: 2 additions & 4 deletions src/codecTools/partialRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import * as t from 'io-ts';

// TODO: https://github.com/gcanti/io-ts/issues/429 - remove if/when io-ts supports this natively
export interface PartialRecordC<
D extends t.Mixed,
C extends t.Mixed,
> extends t.DictionaryType<
export interface PartialRecordC<D extends t.Mixed, C extends t.Mixed>
extends t.DictionaryType<
D,
C,
{
Expand Down
2 changes: 1 addition & 1 deletion src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export const HttpMethod = makeEnum({
/**
* Override to cast as string
*/
export type HttpMethod = typeof HttpMethod[keyof typeof HttpMethod];
export type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];

0 comments on commit 1279440

Please sign in to comment.