Skip to content

Commit 5a4d91e

Browse files
committed
fix(package): up deps, fix vulns
1 parent ca22c05 commit 5a4d91e

File tree

4 files changed

+955
-749
lines changed

4 files changed

+955
-749
lines changed

lib/recognizeFormat.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const detectNewline = require("detect-newline");
2+
const detectIndent = require("detect-indent");
3+
14
/**
25
* Information about the format of a file.
36
* @typedef FileFormat
@@ -12,12 +15,9 @@
1215
* @returns {FileFormat} Formatting of the file
1316
*/
1417
function recognizeFormat(contents) {
15-
const indentMatch = /\n([^"]+)/.exec(contents);
16-
const trailingWhitespaceMatch = /}(\s*)$/.exec(contents);
17-
1818
return {
19-
indent: indentMatch ? indentMatch[1] : 2,
20-
trailingWhitespace: trailingWhitespaceMatch ? trailingWhitespaceMatch[1] : "",
19+
indent: detectIndent(contents).indent,
20+
trailingWhitespace: detectNewline(contents) || "",
2121
};
2222
}
2323

package.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"coveralls:push": "cat ./coverage/lcov.info | coveralls",
2929
"_publish": "semantic-release",
3030
"build": "echo 'There is no need for build && exit 0'",
31-
"postupdate": "npx yarn-audit-fix && yarn build && yarn test",
31+
"postupdate": "yarn && npx yarn-audit-fix && yarn build && yarn test",
3232
"publish:beta": "npm publish --no-git-tag-version --tag beta"
3333
},
3434
"husky": {
@@ -46,40 +46,43 @@
4646
"collectCoverage": true,
4747
"collectCoverageFrom": [
4848
"lib/**/*.js"
49+
],
50+
"modulePathIgnorePatterns": [
51+
"<rootDir>/test/fixtures"
4952
]
5053
},
5154
"dependencies": {
5255
"bash-glob": "^2.0.0",
5356
"blork": "^9.2.2",
54-
"cosmiconfig": "^6.0.0",
55-
"get-stream": "^5.1.0",
57+
"cosmiconfig": "^7.0.0",
58+
"get-stream": "^6.0.0",
5659
"git-log-parser": "^1.2.0",
57-
"lodash": "^4.17.19",
58-
"meow": "^7.0.1",
60+
"lodash": "^4.17.20",
61+
"meow": "^7.1.1",
5962
"promise-events": "^0.1.8",
60-
"semantic-release": "^17.1.1",
63+
"semantic-release": "^17.1.2",
6164
"semver": "^7.3.2",
6265
"signale": "^1.4.0",
6366
"stream-buffers": "^3.0.2",
64-
"tempy": "^0.6.0",
67+
"tempy": "^0.7.0",
6568
"execa": "^4.0.3"
6669
},
6770
"devDependencies": {
68-
"@commitlint/config-conventional": "^9.1.1",
71+
"@commitlint/config-conventional": "^11.0.0",
6972
"@semantic-release/changelog": "^5.0.1",
7073
"@semantic-release/git": "^9.0.0",
71-
"@semantic-release/github": "^7.0.7",
72-
"@semantic-release/npm": "^7.0.5",
74+
"@semantic-release/github": "^7.1.1",
75+
"@semantic-release/npm": "^7.0.6",
7376
"codeclimate-test-reporter": "^0.5.1",
74-
"commitlint": "^9.1.0",
77+
"commitlint": "^11.0.0",
7578
"coveralls": "^3.1.0",
76-
"eslint": "^7.5.0",
79+
"eslint": "^7.9.0",
7780
"eslint-config-prettier": "^6.11.0",
7881
"eslint-plugin-prettier": "^3.1.4",
7982
"file-url": "^3.0.0",
80-
"husky": "^4.2.5",
81-
"jest": "^26.1.0",
82-
"prettier": "^2.0.5"
83+
"husky": "^4.3.0",
84+
"jest": "^26.4.2",
85+
"prettier": "^2.1.2"
8386
},
8487
"release": {
8588
"branch": "master",

test/lib/recognizeFormat.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ describe("recognizeFormat()", () => {
1313
}
1414
}`).indent
1515
).toBe("\t"));
16-
test("No indentation", () => expect(recognizeFormat('{"a": "b"}').indent).toBe(2));
16+
test("No indentation", () => expect(recognizeFormat('{"a": "b"}').indent).toBe(""));
1717
});
1818

1919
describe("Trailing whitespace", () => {
2020
test("No trailing whitespace", () => expect(recognizeFormat('{"a": "b"}').trailingWhitespace).toBe(""));
2121
test("Newline", () => expect(recognizeFormat('{"a": "b"}\n').trailingWhitespace).toBe("\n"));
22-
test("Multiple newlines", () => expect(recognizeFormat('{"a": "b"}\n\n').trailingWhitespace).toBe("\n\n"));
22+
test("Multiple newlines", () => expect(recognizeFormat('{"a": "b"}\n\n').trailingWhitespace).toBe("\n"));
2323
});
2424
});

0 commit comments

Comments
 (0)