diff --git a/.github/linters/.eslintrc.yml b/.github/linters/.eslintrc.yml index 1d1be9f..66b96ae 100644 --- a/.github/linters/.eslintrc.yml +++ b/.github/linters/.eslintrc.yml @@ -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 @@ -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", } diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index c975a33..561b6de 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -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 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index fee6547..05f02a8 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -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' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 78aa3e1..42dde22 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: @@ -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: diff --git a/.husky/commit-msg b/.husky/commit-msg index 7ac4889..e558931 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 . "$(dirname "$0")/_/husky.sh" npm run lint && npm run format:check diff --git a/.husky/pre-push b/.husky/pre-push index 023f989..63233b6 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -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 diff --git a/README.md b/README.md index 6680446..59ebd4d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # LoadEnv GitHub Action ## Examples + ```yaml jobs: simple: @@ -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.