ember-template-lint
Advanced tools
Comparing version 0.5.5 to 0.5.6
Changelog | ||
========= | ||
## v0.5.6 | ||
- Remove `bare-strings` from `recommended` configuration. See [#27](https://github.com/rwjblue/ember-template-lint/pull/27) for more details. | ||
## v0.5.5 | ||
@@ -5,0 +9,0 @@ |
@@ -5,3 +5,2 @@ 'use strict'; | ||
rules: { | ||
'bare-strings': true, | ||
'block-indentation': 2, | ||
@@ -16,2 +15,2 @@ 'html-comments': true, | ||
pending: [] | ||
}; | ||
}; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var chalk = require('chalk'); | ||
var rules = require('./rules'); | ||
@@ -65,2 +66,17 @@ var KNOWN_ROOT_PROPERTIES = ['extends', 'rules', 'pending']; | ||
function validateRules(config, options) { | ||
var logger = options.console || console; | ||
var invalidKeysFound = []; | ||
for (var key in config.rules) { | ||
if (!rules[key]) { | ||
invalidKeysFound.push(key); | ||
} | ||
} | ||
if (invalidKeysFound.length > 0) { | ||
logger.log(chalk.yellow('Invalid rule configuration found: ' + invalidKeysFound)); | ||
} | ||
} | ||
module.exports = function(options) { | ||
@@ -71,5 +87,8 @@ var config = options.config || readConfigFromDisk(options); | ||
migrateRulesFromRoot(config, options); | ||
config = processExtends(config); | ||
validateRules(config, options); | ||
return config; | ||
}; |
{ | ||
"name": "ember-template-lint", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "Lint your templates.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -37,7 +37,13 @@ # ember-template-lint | ||
module.exports = { | ||
extends: 'recommended' | ||
extends: 'recommended', | ||
rules: { | ||
'bare-strings': true | ||
} | ||
} | ||
``` | ||
This extends from the builtin recommended configuration ([lib/config/recommended.js](https://github.com/rwjblue/ember-template-lint/blob/master/lib/config/recommended.js)). | ||
This extends from the builtin recommended configuration ([lib/config/recommended.js](https://github.com/rwjblue/ember-template-lint/blob/master/lib/config/recommended.js)), | ||
and also enables the `bare-strings` rule (see [here](https://github.com/rwjblue/ember-template-lint#bare-strings)). | ||
Using this mechanism allows you to extend from the builtin, and modify specific rules as needed. | ||
@@ -271,2 +277,2 @@ | ||
* `npm test` | ||
* `npm test` |
@@ -100,2 +100,19 @@ var path = require('path'); | ||
}); | ||
}); | ||
it('warns for unknown rules', function() { | ||
var message; | ||
getConfig({ | ||
console: { log: function(_message) { | ||
message = _message; | ||
}}, | ||
config: { | ||
rules: { | ||
'blammo': true | ||
} | ||
} | ||
}); | ||
assert(/Invalid rule configuration found/.test(message)); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93451
46
2622
277
10