-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from powerhouse-inc/feat-add-commit-lint-and-l…
…int-staged feat: add commit lint and lint staged
- Loading branch information
Showing
15 changed files
with
1,548 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"env": { | ||
"es2017": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/strict-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"tsconfigRootDir": ".", | ||
"project": true | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/consistent-type-imports": "off", | ||
"@typescript-eslint/array-type": "off", | ||
"@typescript-eslint/prefer-function-type": "off", | ||
"@typescript-eslint/strict-boolean-expressions": "off", | ||
"@typescript-eslint/prefer-nullish-coalescing": "off", | ||
"@typescript-eslint/no-confusing-void-expression": "off", | ||
"@typescript-eslint/consistent-type-definitions": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-misused-promises": "off", | ||
"@typescript-eslint/no-non-null-assertion": "warn", | ||
"@typescript-eslint/require-await": "warn", | ||
"@typescript-eslint/no-unnecessary-condition": "warn", | ||
"@typescript-eslint/no-base-to-string": "warn", | ||
"@typescript-eslint/no-floating-promises": "warn", | ||
"@typescript-eslint/restrict-template-expressions": "warn", | ||
"@typescript-eslint/unbound-method": "warn", | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-extraneous-class": "warn", | ||
"@typescript-eslint/await-thenable": "warn", | ||
"@typescript-eslint/no-dynamic-delete": "warn", | ||
"@typescript-eslint/consistent-indexed-object-style": "warn", | ||
"@typescript-eslint/prefer-for-of": "warn", | ||
"@typescript-eslint/no-duplicate-type-constituents": "warn", | ||
"@typescript-eslint/prefer-reduce-type-parameter": "warn", | ||
"@typescript-eslint/no-unnecessary-type-assertion": "warn", | ||
"@typescript-eslint/prefer-promise-reject-errors": "warn", | ||
"@typescript-eslint/no-unused-vars": [ | ||
1, | ||
{ "ignoreRestSiblings": true } | ||
], | ||
"@typescript-eslint/ban-ts-comment": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Check PR | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
branches: ['main'] | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Check types | ||
run: yarn check-types | ||
|
||
build: | ||
name: Build | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
needs: [lint] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx tsc | ||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"./**/*.{js,jsx,ts,tsx,json}": ["eslint --fix"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@total-typescript/ts-reset'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,15 @@ export async function loadDocumentModel( | |
documentModel = file.state.global; | ||
} else if (path.endsWith('.json')) { | ||
const data = fs.readFileSync(path, 'utf-8'); | ||
const document = JSON.parse(data); | ||
const document = JSON.parse(data) as DocumentModelState; | ||
// z.DocumentModelStateSchema().parse(document); | ||
documentModel = document; | ||
} else { | ||
throw new Error('File type not supported. Must be zip or json.'); | ||
} | ||
return documentModel; | ||
} catch (error) { | ||
// @ts-ignore | ||
// @ts-expect-error | ||
Check warning on line 24 in src/codegen/utils.ts GitHub Actions / Lint
|
||
throw error.code === 'MODULE_NOT_FOUND' | ||
? new Error(`Document model not found.`) | ||
: error; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.