Skip to content

Commit

Permalink
Improved error formatting
Browse files Browse the repository at this point in the history
Technical Change Notes
======================

This now uses GitHub `core.summary`. See the [job summaries][] blog
post.

There are some changes caused by annoying upgrades:

- Added a `.envrc` to ensure local builds and tests use Node 16.
- Prettier 3 changes formatting defaults.
- PNPM 8 also changes some defaults. Added a project `.npmrc` to
  work around pnpm/pnpm#6312.
- Removed tests and jest.
- Upgraded all dev dependencies.

[job summaries]: https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/

Signed-off-by: Austin Ziegler <aziegler@kineticcommerce.com>
  • Loading branch information
halostatue committed Jul 21, 2023
1 parent 90a96f9 commit c9c1570
Show file tree
Hide file tree
Showing 13 changed files with 525 additions and 2,317 deletions.
8 changes: 8 additions & 0 deletions .envrc
@@ -0,0 +1,8 @@
# shellcheck disable=SC2148
source_up

has use_nvm && use nvm --auto

# use dotenv for compatibility with Docker and Docker Compose
dotenv_if_exists

113 changes: 59 additions & 54 deletions .eslintrc.json
@@ -1,55 +1,60 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@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-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "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",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
"plugins": ["@typescript-eslint"],
"extends": ["plugin:github/recommended", "plugin:github/typescript"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@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-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "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",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true
}
}
4 changes: 3 additions & 1 deletion .github/workflows/check-dist.yml
Expand Up @@ -14,6 +14,8 @@ jobs:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3.7.0
with:
Expand All @@ -29,7 +31,7 @@ jobs:
- run: |
if [[ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt 0 ]]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
git diff --text --ignore-space-at-eol dist/
exit 1
fi
id: diff
Expand Down
1 change: 1 addition & 0 deletions .node-version
@@ -0,0 +1 @@
lts/gallium
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
auto-install-peers=true
29 changes: 0 additions & 29 deletions __tests__/main.test.ts

This file was deleted.

4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

13 changes: 4 additions & 9 deletions package.json
Expand Up @@ -10,8 +10,7 @@
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt --minify",
"test": "jest",
"all": "yarn run build && yarn run format && yarn run lint && yarn run package && yarn test"
"all": "pnpm run build && pnpm run format && pnpm run lint && pnpm run package"
},
"repository": {
"type": "git",
Expand All @@ -33,18 +32,14 @@
"email-validator": "^2.0.4"
},
"devDependencies": {
"@jest/globals": "^29.6.1",
"@octokit/types": "^11.1.0",
"@types/node": "^20.4.1",
"@typescript-eslint/parser": "^6.0.0",
"@types/node": "^20.4.2",
"@typescript-eslint/parser": "^6.1.0",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.45.0",
"eslint-plugin-github": "^4.9.0",
"eslint-plugin-jest": "^27.2.3",
"jest": "^29.6.1",
"eslint-plugin-github": "^4.9.2",
"js-yaml": "^4.1.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
"packageManager": "pnpm@8.6.1"
Expand Down

0 comments on commit c9c1570

Please sign in to comment.