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

GH-0 fix linter issues #12

Merged
merged 3 commits into from
Dec 4, 2023
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
108 changes: 55 additions & 53 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ globals:
SharedArrayBuffer: readonly

ignorePatterns:
- '!.*'
- '**/node_modules/.*'
- '**/dist/.*'
- '**/coverage/.*'
- '*.json'
- "!.*"
- "**/node_modules/.*"
- "**/dist/.*"
- "**/coverage/.*"
- "**/settings.json"
- "**/tsconfig.json"
- "**/package.json"
- "**/package-lock.json"

parser: '@typescript-eslint/parser'
parser: "@typescript-eslint/parser"

parserOptions:
ecmaVersion: 2023
sourceType: module
project:
- './.github/linters/tsconfig.json'
- './tsconfig.json'
- "./.github/linters/tsconfig.json"

plugins:
- jest
- "prettier"
- '@typescript-eslint'
- "@typescript-eslint"

extends:
- eslint:recommended
Expand All @@ -36,48 +38,48 @@ extends:

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',
'prettier/prettier': 'error',
'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':
['warn', { '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-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@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/semi': 'off',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
"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",
"prettier/prettier": "error",
"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":
["warn", { "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-require-imports": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@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/semi": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error",
}
2 changes: 1 addition & 1 deletion .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ rules:
present: false
line-length:
level: warning
max: 80
max: 100
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
9 changes: 9 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TYPESCRIPT_DEFAULT_STYLE: prettier
VALIDATE_JSCPD: false
# Why the ignorePattern in eslintrc.yml doesn't work?
FILTER_REGEX_EXCLUDE: "(.github/workflows/tests.yml)|(.*dist/.*.js)"
# https://github.com/super-linter/super-linter/issues/4023
# And becuase of this issue, we have to exclude tests.yml above!
# GITHUB_ACTIONS_COMMAND_ARGS: >-
# -ignore 'property "foo" is not defined in object type'
# -ignore 'property "bar" is not defined in object type'
# -ignore 'property "baz" is not defined in object type'
# -ignore 'property "qux" is not defined in object type'
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ jobs:
- name: BAR is nither exported nor expanded
run: |
[[ -z $BAR ]]
# shellcheck disable=SC2016
[[ '${{ steps.env.outputs.BAR }}' == '$FOO' ]]
- name: BAZ is nither exported nor expanded
run: |
[[ -z $BAZ ]]
# shellcheck disable=SC2016
[[ '${{ steps.env.outputs.BAZ }}' == '$USER' ]]
- name: QUX is nither exported nor expanded
run: |
[[ -z $QUX ]]
# shellcheck disable=SC2016
[[ '${{ steps.env.outputs.QUX }}' == '$EXTERNAL_QUX' ]]

test-export:
Expand All @@ -74,12 +77,15 @@ jobs:
[[ "$FOO" == "foo" ]]
- name: BAR is exported, but not expanded
run: |
# shellcheck disable=SC2016
[[ "$BAR" == '$FOO' ]]
- name: BAZ is exported, but not expanded
run: |
# shellcheck disable=SC2016
[[ "$BAZ" == '$USER' ]]
- name: QUX is exported, but not expanded
run: |
# shellcheck disable=SC2016
[[ "$QUX" == '$EXTERNAL_QUX' ]]

test-expand-without-host-env:
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC1091
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run format:check
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC1091
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run format && npm run package && npm run check:workspace
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# LoadEnv GitHub Action

## Examples

```yaml
jobs:
simple:
Expand All @@ -17,16 +18,18 @@ jobs:
name: Loads `./path/to/.env`, expands, checks, and export variables
with:
files: ./path/to/.env
strict: true # default true
expand-vars: true # default true
export-vars: true # default true
additional-vars: '${{ toJSON(vars) }}' # to make them avialbe while expanding!!!
strict: true # default true
expand-vars: true # default true
export-vars: true # default true
additional-vars: "${{ toJSON(vars) }}" # to make them available while expanding!!!
- name: Use output variables
run: echo ${{ steps.loadenv.FOO }} ${{ steps.loadenv.BAR }}
- name: Use exported variables
run: echo $FOO $BAR
```
See [tests.yml](.github/workflows/tests.yml) file for different ways of using the action.

See [tests.yml](.github/workflows/tests.yml) file for more examples.

## API

See [action.yml](action.yml) file for full API.
Loading