Skip to content

Commit

Permalink
Merge pull request #43 from DavidTanner/updateBuild
Browse files Browse the repository at this point in the history
Update build deps and actions
  • Loading branch information
DavidTanner authored Oct 16, 2023
2 parents 1093f10 + c828601 commit e83a32f
Show file tree
Hide file tree
Showing 22 changed files with 159 additions and 173 deletions.
130 changes: 0 additions & 130 deletions .eslintrc.js

This file was deleted.

100 changes: 100 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"extends": "airbnb-base",
"rules": {
"func-names": "off",

"prefer-object-spread": "off",
"import/prefer-default-export": "off",
"import/extensions": "off",
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": "off",
"class-methods-use-this": "off",
"no-await-in-loop": "off",
"eqeqeq": "off",
"no-restricted-syntax": "off",
"max-len": ["error", { "code": 120 }]
},
"env": {
"node": true
},
"overrides": [
{
"files": [
"*.{ts,tsx}"
],
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020,
"tsconfigRootDir": "."
},
"rules": {
"import/prefer-default-export": "off",

// BEGIN ERRORS
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/restrict-template-expressions": [
"error",
{ "allowNumber": true, "allowBoolean": true, "allowNullish": true }
],
"@typescript-eslint/restrict-plus-operands": [
"error",
{ "skipCompoundAssignments": true }
],

// This prevents declarations like `interface ISomething { ... }`
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
}
],

// BEGIN DISABLED. Some of these are disabled just to prevent warnings.
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-redundant-type-constituents": "off"
}
},
{
"files": [
"test/**/*.{ts,tsx}",
"*.test.{ts,tsx}"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
// Allow ! in tests.
"@typescript-eslint/no-non-null-assertion": "off",

// Allow tests to create odd string templates if they want.
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}
]
}
8 changes: 2 additions & 6 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ on: pull_request
jobs:
main:
runs-on: ubuntu-latest
name: Node.JS ${{ matrix.node-version }}
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x
- run: npm i
- run: npm test
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm i
- run: npm test
- name: Release
Expand Down
34 changes: 16 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"npm": ">=2.14.7"
},
"scripts": {
"test": "npm run lint && jest",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "npx vitest run --coverage",
"prepublishOnly": "tsc -p tsconfig.build.json",
"clean": "tsc --build --clean; rm -rf tsconfig.build.tsbuildinfo tsconfig.tsbuildinfo"
},
Expand All @@ -30,26 +31,23 @@
"url": "https://github.com/DavidTanner/nodecredstash.git"
},
"devDependencies": {
"@swc/core": "^1.2.222",
"@swc/jest": "^0.2.22",
"@types/jest": "^28.1.6",
"@types/node": "^16.11.47",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"aws-sdk-client-mock": "^1.0.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.20.0",
"@types/debug": "^4.1.9",
"@types/node": "^18.18.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@vitest/coverage-v8": "^0.34.6",
"aws-sdk-client-mock": "^3.0.0",
"conventional-changelog-conventionalcommits": "^7.0.2",
"eslint": "^8.51.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-chai-expect": "^3.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.7.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"jest": "^28.1.3",
"semantic-release": "^19.0.3",
"typescript": "^4.7.4",
"ulid": "^2.3.0"
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.137.0",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class CredStash {
) {
this.#kmsClient = new KMSClient(kmsOpts);
this.#ddb = new DynamoDB(new DynamoDBClient(dynamoOpts));
// eslint-disable-next-line @typescript-eslint/no-this-alias
const credStash = this;
Object.getOwnPropertyNames(CredStash.prototype).forEach((key) => {
const method = credStash[key];
Expand All @@ -57,7 +58,7 @@ export class CredStash {
}
return res;
})
.catch((err) => {
.catch((err: any) => {
if (cb) {
return cb(err);
}
Expand Down
1 change: 1 addition & 0 deletions test/unit/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { DescribeTableCommand } from '@aws-sdk/client-dynamodb';
import { DEFAULT_TABLE } from '../../src/defaults';

Expand Down
1 change: 1 addition & 0 deletions test/unit/createDdbTable.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { DescribeTableCommand } from '@aws-sdk/client-dynamodb';

import { mockDdb } from './utils/awsSdk';
Expand Down
1 change: 1 addition & 0 deletions test/unit/deleteSecret.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, test, expect } from 'vitest';
import { DeleteCommand } from '@aws-sdk/lib-dynamodb';
import { mockDocClient } from './utils/awsSdk';
import { CredStash } from '../../src';
Expand Down
1 change: 1 addition & 0 deletions test/unit/deleteSecrets.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { DeleteCommand, QueryCommand } from '@aws-sdk/lib-dynamodb';
import { mockDocClient } from './utils/awsSdk';
import { CredStash } from '../../src';
Expand Down
1 change: 1 addition & 0 deletions test/unit/getAllSecrets.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, test, expect } from 'vitest';
import { ScanCommand, GetCommand } from '@aws-sdk/lib-dynamodb';
import {
DecryptCommand,
Expand Down
1 change: 1 addition & 0 deletions test/unit/getAllVersions.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { QueryCommand } from '@aws-sdk/lib-dynamodb';
import { DecryptCommand } from '@aws-sdk/client-kms';

Expand Down
1 change: 1 addition & 0 deletions test/unit/getHighestVersion.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { QueryCommand } from '@aws-sdk/lib-dynamodb';
import { mockDocClient } from './utils/awsSdk';
import { CredStash } from '../../src';
Expand Down
1 change: 1 addition & 0 deletions test/unit/getSecret.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { GetCommand, QueryCommand } from '@aws-sdk/lib-dynamodb';
import { DecryptCommand, InvalidCiphertextException } from '@aws-sdk/client-kms';

Expand Down
1 change: 1 addition & 0 deletions test/unit/incrementVersion.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from 'vitest';
import { QueryCommand } from '@aws-sdk/lib-dynamodb';

import { mockDocClient } from './utils/awsSdk';
Expand Down
1 change: 1 addition & 0 deletions test/unit/lib/aesCredstash.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, test, expect } from 'vitest';
import { GenerateDataKeyCommand, DecryptCommand, KMSClient } from '@aws-sdk/client-kms';
import { mockKms } from '../utils/awsSdk';
import { item } from '../utils/encryption';
Expand Down
Loading

0 comments on commit e83a32f

Please sign in to comment.