Add lint to workflow (#88)

* Add lint in workflow

This will check for code formatting, as well as for any ES lint issues.

* Format code

run `npm run check:write`

* Run lint and fix errors

Run `npm run lint` and then fix the errors shown.
This commit is contained in:
Eduard Filip
2024-12-17 11:05:12 +01:00
committed by GitHub
parent 734cd437f8
commit 3e2909a6b2
4 changed files with 2385 additions and 1504 deletions

View File

@@ -14,3 +14,16 @@ jobs:
with:
ignore_paths: >-
.husky
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install Dependencies
id: install
run: npm ci
- name: Check formatting
run: npm run format:check
- name: Check lint
run: npm run lint

View File

@@ -3,6 +3,7 @@
Thank you for your interest in contributing to the 1Password load-secrets-action project 👋! Before you start, please take a moment to read through this guide to understand our contribution process.
## Testing
Unit tests can be run with `npm run test`.
After following the steps below for signing commits, you can test against your PR with these steps:
@@ -13,7 +14,9 @@ After following the steps below for signing commits, you can test against your P
```yaml
uses: 1Password/load-secrets-action@<branch-name>
```
OR
```yaml
uses: 1Password/load-secrets-action@<commit-hash>
```

3847
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,24 +39,24 @@ describe("validateAuth", () => {
});
it("should throw an error when no config is provided", () => {
expect(validateAuth).toThrowError(authErr);
expect(validateAuth).toThrow(authErr);
});
it("should throw an error when partial Connect config is provided", () => {
process.env[envConnectHost] = testConnectHost;
expect(validateAuth).toThrowError(authErr);
expect(validateAuth).toThrow(authErr);
});
it("should be authenticated as a Connect client", () => {
process.env[envConnectHost] = testConnectHost;
process.env[envConnectToken] = testConnectToken;
expect(validateAuth).not.toThrowError(authErr);
expect(validateAuth).not.toThrow(authErr);
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
});
it("should be authenticated as a service account", () => {
process.env[envServiceAccountToken] = testServiceAccountToken;
expect(validateAuth).not.toThrowError(authErr);
expect(validateAuth).not.toThrow(authErr);
expect(core.info).toHaveBeenCalledWith(
"Authenticated with Service account.",
);
@@ -66,7 +66,7 @@ describe("validateAuth", () => {
process.env[envServiceAccountToken] = testServiceAccountToken;
process.env[envConnectHost] = testConnectHost;
process.env[envConnectToken] = testConnectToken;
expect(validateAuth).not.toThrowError(authErr);
expect(validateAuth).not.toThrow(authErr);
expect(core.warning).toHaveBeenCalled();
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
});