Skip to content

Commit

Permalink
fix: rename error option to message on no-restricted-service-injectio…
Browse files Browse the repository at this point in the history
…ns rule

Better consistency with other "no-restricted-*" lint rules.
  • Loading branch information
bmish committed Jun 2, 2020
1 parent b7a216e commit 1c54011
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/rules/no-restricted-service-injections.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ With this example configuration:
{
"paths": ["folder1", "folder2", "folder3"],
"services": ["deprecated-service"],
"error": "Please stop using this service as it is in the process of being deprecated",
"message": "Please stop using this service as it is in the process of being deprecated",
},
{
"paths": ["isolated-folder"],
Expand All @@ -46,7 +46,7 @@ class MyComponent extends Component {
* object[] -- containing the following properties:
* string[] -- `services` -- list of (kebab-case) service names that should be disallowed from being injected under the specified paths
* string[] -- `paths` -- optional list of regexp file paths that injecting the specified services should be disallowed under (omit this field to match any path)
* string -- `error` -- optional custom error message to display for violations
* string -- `message` -- optional custom error message to display for violations

## Related Rules

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-restricted-service-injections.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
type: 'string',
},
},
error: {
message: {
type: 'string',
},
},
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = {
if (blacklist.services.includes(serviceNameKebabCase)) {
context.report({
node,
message: blacklist.error || DEFAULT_ERROR_MESSAGE,
message: blacklist.message || DEFAULT_ERROR_MESSAGE,
});
}
});
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/rules/no-restricted-service-injections.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ruleTester.run('no-restricted-service-injections', rule, {
{
paths: ['app/components'],
services: ['my-service'],
error: 'my-service is deprecated, please do not use it.',
message: 'my-service is deprecated, please do not use it.',
},
],
output: null,
Expand All @@ -147,8 +147,8 @@ ruleTester.run('no-restricted-service-injections', rule, {
// With multiple violations:
code: 'Component.extend({ myService: service() })',
options: [
{ paths: ['app/components'], services: ['my-service'], error: 'Error 1' },
{ paths: ['app/components'], services: ['my-service'], error: 'Error 2' },
{ paths: ['app/components'], services: ['my-service'], message: 'Error 1' },
{ paths: ['app/components'], services: ['my-service'], message: 'Error 2' },
],
output: null,
filename: 'app/components/path.js',
Expand Down

0 comments on commit 1c54011

Please sign in to comment.