eslint-plugin-ember
Advanced tools
Comparing version 6.9.1 to 6.10.0
@@ -0,1 +1,13 @@ | ||
## v6.10.0 (2019-08-19) | ||
#### :rocket: Enhancement | ||
* [#473](https://github.com/ember-cli/eslint-plugin-ember/pull/473) Add new `no-incorrect-calls-with-inline-anonymous-functions` rule ([@raycohen](https://github.com/raycohen)) | ||
#### :bug: Bug Fix | ||
* [#476](https://github.com/ember-cli/eslint-plugin-ember/pull/476) Add `allowDynamicKeys` option (default true) to `require-computed-property-dependencies` rule ([@bmish](https://github.com/bmish)) | ||
#### Committers: 2 | ||
- Bryan Mishkin ([@bmish](https://github.com/bmish)) | ||
- Ray Cohen ([@raycohen](https://github.com/raycohen)) | ||
## v6.9.1 (2019-08-14) | ||
@@ -2,0 +14,0 @@ |
@@ -31,2 +31,3 @@ 'use strict'; | ||
'no-global-jquery': require('./rules/no-global-jquery'), | ||
'no-incorrect-calls-with-inline-anonymous-functions': require('./rules/no-incorrect-calls-with-inline-anonymous-functions'), | ||
'no-invalid-debug-function-arguments': require('./rules/no-invalid-debug-function-arguments'), | ||
@@ -33,0 +34,0 @@ 'no-jquery': require('./rules/no-jquery'), |
@@ -33,2 +33,3 @@ /* | ||
"ember/no-global-jquery": "error", | ||
"ember/no-incorrect-calls-with-inline-anonymous-functions": "off", | ||
"ember/no-invalid-debug-function-arguments": "off", | ||
@@ -35,0 +36,0 @@ "ember/no-jquery": "off", |
@@ -293,2 +293,13 @@ 'use strict'; | ||
fixable: 'code', | ||
schema: [ | ||
{ | ||
type: 'object', | ||
properties: { | ||
allowDynamicKeys: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
@@ -304,8 +315,10 @@ | ||
declaredDependencies.dynamicKeys.forEach(key => { | ||
context.report({ | ||
node: key, | ||
message: ERROR_MESSAGE_NON_STRING_VALUE, | ||
if (context.options[0] && !context.options[0].allowDynamicKeys) { | ||
declaredDependencies.dynamicKeys.forEach(key => { | ||
context.report({ | ||
node: key, | ||
message: ERROR_MESSAGE_NON_STRING_VALUE, | ||
}); | ||
}); | ||
}); | ||
} | ||
@@ -352,6 +365,16 @@ const computedPropertyFunction = node.arguments[node.arguments.length - 1]; | ||
fix(fixer) { | ||
const missingDependenciesAsArguments = collapseKeys( | ||
const sourceCode = context.getSourceCode(); | ||
const missingDependenciesAsArgumentsForDynamicKeys = declaredDependencies.dynamicKeys.map( | ||
dynamicKey => sourceCode.getText(dynamicKey) | ||
); | ||
const missingDependenciesAsArgumentsForStringKeys = collapseKeys( | ||
removeRedundantKeys([...undeclaredKeys, ...expandedDeclaredKeys]) | ||
); | ||
const missingDependenciesAsArguments = [ | ||
...missingDependenciesAsArgumentsForDynamicKeys, | ||
...missingDependenciesAsArgumentsForStringKeys, | ||
].join(', '); | ||
if (node.arguments.length > 1) { | ||
@@ -385,3 +408,3 @@ const firstDependency = node.arguments[0]; | ||
* Input: ["foo.bar", "foo.baz", "quux.[]"] | ||
* Output: "'foo.{bar,baz}', 'quux.[]'" | ||
* Output: ["foo.{bar,baz}", "quux.[]"] | ||
* | ||
@@ -419,6 +442,3 @@ * @param {Array<string>} keys | ||
return [...bareKeys, ...joined] | ||
.sort() | ||
.map(key => `'${key}'`) | ||
.join(', '); | ||
return [...bareKeys, ...joined].sort().map(key => `'${key}'`); | ||
} | ||
@@ -425,0 +445,0 @@ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
isExpressionStatement, | ||
isAnyFunctionExpression, | ||
isArrowFunctionExpression, | ||
@@ -178,2 +179,12 @@ isConciseArrowFunctionWithCallExpression, | ||
/** | ||
* Check whether or not a node is an ArrowFunctionExpression or FunctionExpression. | ||
* | ||
* @param {Object} node The node to check. | ||
* @returns {boolean} Whether or not the node is an ArrowFunctionExpression or FunctionExpression. | ||
*/ | ||
function isAnyFunctionExpression(node) { | ||
return isArrowFunctionExpression(node) || isFunctionExpression(node); | ||
} | ||
/** | ||
* Check whether or not a node is an ArrowFunctionExpression. | ||
@@ -180,0 +191,0 @@ * |
{ | ||
"name": "eslint-plugin-ember", | ||
"version": "6.9.1", | ||
"version": "6.10.0", | ||
"description": "Eslint plugin for Ember.js apps", | ||
@@ -64,3 +64,3 @@ "main": "lib/index.js", | ||
"@ember-data/rfc395-data": "^0.0.4", | ||
"ember-rfc176-data": "^0.3.10", | ||
"ember-rfc176-data": "^0.3.11", | ||
"snake-case": "^2.1.0" | ||
@@ -67,0 +67,0 @@ }, |
@@ -121,2 +121,3 @@ # eslint-plugin-ember | ||
| :white_check_mark: | [no-ember-testing-in-module-scope](./docs/rules/no-ember-testing-in-module-scope.md) | Prevents use of Ember.testing in module scope | | ||
| | [no-incorrect-calls-with-inline-anonymous-functions](./docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md) | Disallows inline anonymous functions as arguments to `debounce`, `once`, and `scheduleOnce` | | ||
| | [no-invalid-debug-function-arguments](./docs/rules/no-invalid-debug-function-arguments.md) | Catch usages of Ember's `assert()` / `warn()` / `deprecate()` functions that have the arguments passed in the wrong order. | | ||
@@ -123,0 +124,0 @@ | :white_check_mark: | [no-side-effects](./docs/rules/no-side-effects.md) | Warns about unexpected side effects in computed properties | |
241225
67
5160
217
Updatedember-rfc176-data@^0.3.11