diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e716834..934d222 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,5 +40,8 @@ jobs: - name: npm test run: npm test + # - name: Format + # run: npm run format-check + - name: audit security - run: npm audit + run: npm audit --audit-level=moderate diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5633abf --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +node_modules/ +_out \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..386485a --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,11 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": false, + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": false, + "arrowParens": "avoid", + "parser": "typescript" +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0369352..25a3f03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3413,6 +3413,12 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "prettier": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz", + "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==", + "dev": true + }, "pretty-format": { "version": "25.1.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.1.0.tgz", diff --git a/package.json b/package.json index 3fce213..e873fd2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,10 @@ "main": "index.js", "scripts": { "build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out", - "test": "jest" + "test": "jest", + "format": "prettier --write packages/**/*.ts", + "format-check": "prettier --check packages/**/*.ts", + "audit-check": "npm audit --audit-level=moderate" }, "repository": { "type": "git", @@ -25,6 +28,7 @@ "@types/jest": "^25.1.4", "@types/node": "^12.12.31", "jest": "^25.1.0", + "prettier": "^2.0.4", "proxy": "^1.0.1", "ts-jest": "^25.2.1", "typescript": "^3.8.3"