Skip to content

Commit

Permalink
fix(package): up deps, fix vulns
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Sep 23, 2020
1 parent ca22c05 commit 5a4d91e
Show file tree
Hide file tree
Showing 4 changed files with 955 additions and 749 deletions.
10 changes: 5 additions & 5 deletions lib/recognizeFormat.js
@@ -1,3 +1,6 @@
const detectNewline = require("detect-newline");
const detectIndent = require("detect-indent");

/**
* Information about the format of a file.
* @typedef FileFormat
Expand All @@ -12,12 +15,9 @@
* @returns {FileFormat} Formatting of the file
*/
function recognizeFormat(contents) {
const indentMatch = /\n([^"]+)/.exec(contents);
const trailingWhitespaceMatch = /}(\s*)$/.exec(contents);

return {
indent: indentMatch ? indentMatch[1] : 2,
trailingWhitespace: trailingWhitespaceMatch ? trailingWhitespaceMatch[1] : "",
indent: detectIndent(contents).indent,
trailingWhitespace: detectNewline(contents) || "",
};
}

Expand Down
33 changes: 18 additions & 15 deletions package.json
Expand Up @@ -28,7 +28,7 @@
"coveralls:push": "cat ./coverage/lcov.info | coveralls",
"_publish": "semantic-release",
"build": "echo 'There is no need for build && exit 0'",
"postupdate": "npx yarn-audit-fix && yarn build && yarn test",
"postupdate": "yarn && npx yarn-audit-fix && yarn build && yarn test",
"publish:beta": "npm publish --no-git-tag-version --tag beta"
},
"husky": {
Expand All @@ -46,40 +46,43 @@
"collectCoverage": true,
"collectCoverageFrom": [
"lib/**/*.js"
],
"modulePathIgnorePatterns": [
"<rootDir>/test/fixtures"
]
},
"dependencies": {
"bash-glob": "^2.0.0",
"blork": "^9.2.2",
"cosmiconfig": "^6.0.0",
"get-stream": "^5.1.0",
"cosmiconfig": "^7.0.0",
"get-stream": "^6.0.0",
"git-log-parser": "^1.2.0",
"lodash": "^4.17.19",
"meow": "^7.0.1",
"lodash": "^4.17.20",
"meow": "^7.1.1",
"promise-events": "^0.1.8",
"semantic-release": "^17.1.1",
"semantic-release": "^17.1.2",
"semver": "^7.3.2",
"signale": "^1.4.0",
"stream-buffers": "^3.0.2",
"tempy": "^0.6.0",
"tempy": "^0.7.0",
"execa": "^4.0.3"
},
"devDependencies": {
"@commitlint/config-conventional": "^9.1.1",
"@commitlint/config-conventional": "^11.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.0.7",
"@semantic-release/npm": "^7.0.5",
"@semantic-release/github": "^7.1.1",
"@semantic-release/npm": "^7.0.6",
"codeclimate-test-reporter": "^0.5.1",
"commitlint": "^9.1.0",
"commitlint": "^11.0.0",
"coveralls": "^3.1.0",
"eslint": "^7.5.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"file-url": "^3.0.0",
"husky": "^4.2.5",
"jest": "^26.1.0",
"prettier": "^2.0.5"
"husky": "^4.3.0",
"jest": "^26.4.2",
"prettier": "^2.1.2"
},
"release": {
"branch": "master",
Expand Down
4 changes: 2 additions & 2 deletions test/lib/recognizeFormat.test.js
Expand Up @@ -13,12 +13,12 @@ describe("recognizeFormat()", () => {
}
}`).indent
).toBe("\t"));
test("No indentation", () => expect(recognizeFormat('{"a": "b"}').indent).toBe(2));
test("No indentation", () => expect(recognizeFormat('{"a": "b"}').indent).toBe(""));
});

describe("Trailing whitespace", () => {
test("No trailing whitespace", () => expect(recognizeFormat('{"a": "b"}').trailingWhitespace).toBe(""));
test("Newline", () => expect(recognizeFormat('{"a": "b"}\n').trailingWhitespace).toBe("\n"));
test("Multiple newlines", () => expect(recognizeFormat('{"a": "b"}\n\n').trailingWhitespace).toBe("\n\n"));
test("Multiple newlines", () => expect(recognizeFormat('{"a": "b"}\n\n').trailingWhitespace).toBe("\n"));
});
});

0 comments on commit 5a4d91e

Please sign in to comment.