...
 
Commits (21)
# html-validate changelog
# [1.16.0](https://gitlab.com/html-validate/html-validate/compare/v1.15.0...v1.16.0) (2019-11-09)
### Bug Fixes
- **cli:** fix `--init` not creating configuration unless overwriting ([9098529](https://gitlab.com/html-validate/html-validate/commit/90985293bf941c54055c93b35a6c6f865a2f65e6))
- **config:** use `readFile` to prevent unintended caching ([4864bfa](https://gitlab.com/html-validate/html-validate/commit/4864bfa26edaf77b7bf7b0f551ffe7469a803c42))
### Features
- **shim:** expose version number in shim ([890d122](https://gitlab.com/html-validate/html-validate/commit/890d12269cfbfff7ce6b4e49e1876bb51ca7ccdd))
# [1.15.0](https://gitlab.com/html-validate/html-validate/compare/v1.14.1...v1.15.0) (2019-11-03)
### Bug Fixes
......
This diff is collapsed.
{
"name": "html-validate",
"version": "1.15.0",
"version": "1.16.0",
"description": "html linter",
"keywords": [
"html",
......@@ -113,26 +113,26 @@
"minimist": "^1.2.0"
},
"devDependencies": {
"@babel/core": "7.6.4",
"@babel/preset-env": "7.6.3",
"@babel/core": "7.7.2",
"@babel/preset-env": "7.7.1",
"@commitlint/cli": "8.2.0",
"@commitlint/config-conventional": "8.2.0",
"@semantic-release/changelog": "3.0.5",
"@semantic-release/exec": "3.3.8",
"@semantic-release/git": "7.0.17",
"@semantic-release/gitlab": "4.0.3",
"@semantic-release/npm": "5.3.2",
"@semantic-release/git": "7.0.18",
"@semantic-release/gitlab": "4.0.4",
"@semantic-release/npm": "5.3.4",
"@semantic-release/release-notes-generator": "7.3.2",
"@types/babel__code-frame": "7.0.1",
"@types/estree": "0.0.39",
"@types/glob": "7.1.1",
"@types/inquirer": "6.5.0",
"@types/jest": "24.0.21",
"@types/jest": "24.0.22",
"@types/json-merge-patch": "0.0.4",
"@types/minimist": "1.2.0",
"@types/node": "11.15.2",
"@typescript-eslint/eslint-plugin": "2.6.0",
"@typescript-eslint/parser": "2.6.0",
"@typescript-eslint/eslint-plugin": "2.6.1",
"@typescript-eslint/parser": "2.6.1",
"autoprefixer": "9.7.1",
"babelify": "10.0.0",
"bootstrap-sass": "3.4.1",
......@@ -144,11 +144,11 @@
"eslint-config-sidvind": "1.3.2",
"eslint-plugin-array-func": "3.1.3",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jest": "23.0.2",
"eslint-plugin-jest": "23.0.3",
"eslint-plugin-node": "10.0.0",
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-sonarjs": "0.4.0",
"eslint-plugin-sonarjs": "0.5.0",
"font-awesome": "4.7.0",
"grunt": "1.0.4",
"grunt-browserify": "5.3.0",
......@@ -168,13 +168,13 @@
"minimatch": "3.0.4",
"prettier": "1.18.2",
"sass": "1.23.3",
"semantic-release": "15.13.28",
"semantic-release": "15.13.30",
"serve-static": "1.14.1",
"strip-ansi": "5.2.0",
"ts-jest": "24.1.0",
"tslint": "5.20.0",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"typescript": "3.6.4"
"typescript": "3.7.2"
},
"jest": {
"collectCoverage": true,
......
......@@ -54,6 +54,21 @@ it("should not overwrite configuration unless requested", async () => {
expect(fs.writeFile).not.toHaveBeenCalled();
});
it("should always create configuration when config is missing", async () => {
expect.assertions(1);
fs.existsSync.mockReturnValue(false);
inquirer.prompt.mockResolvedValue({
write: undefined,
frameworks: [],
});
await cli.init(".");
expect(fs.writeFile).toHaveBeenCalledWith(
"./.htmlvalidate.json",
expect.anything(),
expect.anything()
);
});
it("should propagate errors from fs.writeFile", async () => {
expect.assertions(1);
fs.existsSync.mockReturnValue(false);
......
......@@ -80,7 +80,9 @@ export async function init(cwd: string): Promise<InitResult> {
/* prompt user for questions */
const answers = await inquirer.prompt(questions);
if (!answers.write) {
/* dont overwrite configuration unless explicitly requested */
if (exists && !answers.write) {
return Promise.reject();
}
......
......@@ -46,8 +46,8 @@ function mergeInternal(base: ConfigData, rhs: ConfigData): ConfigData {
function loadFromFile(filename: string): ConfigData {
let json;
try {
// eslint-disable-next-line security/detect-non-literal-require
json = require(filename);
const data = fs.readFileSync(filename, "utf-8");
json = JSON.parse(data);
} catch (err) {
throw new ConfigError(
`Failed to read configuration from "${filename}"`,
......
......@@ -271,7 +271,6 @@ export class Engine<T extends Parser = Parser> {
for (const rule of rules) {
rule.setEnabled(true);
}
return;
}
}
);
......
......@@ -16,7 +16,6 @@ class DeprecatedRule extends Rule {
for (const rule of this.getDeprecatedRules(event)) {
if (rule.getSeverity() > Severity.DISABLED) {
this.report(null, `Usage of deprecated rule "${rule.name}"`);
continue;
}
}
});
......
......@@ -9,3 +9,6 @@ export { Rule } from "./rule";
export { Source, Location } from "./context";
export { Reporter, Message, Result } from "./reporter";
export { TemplateExtractor } from "./transform/template";
const pkg = require("../package.json");
export const version = pkg.version;