Skip to content

Commit 3567835

Browse files
authored
Merge pull request #835 from bmish/no-restricted-service-injections-rename-error-message-option
Rename `error` option to `message` on `no-restricted-service-injections` rule
2 parents b7a216e + 1c54011 commit 3567835

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/rules/no-restricted-service-injections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ With this example configuration:
1919
{
2020
"paths": ["folder1", "folder2", "folder3"],
2121
"services": ["deprecated-service"],
22-
"error": "Please stop using this service as it is in the process of being deprecated",
22+
"message": "Please stop using this service as it is in the process of being deprecated",
2323
},
2424
{
2525
"paths": ["isolated-folder"],
@@ -46,7 +46,7 @@ class MyComponent extends Component {
4646
* object[] -- containing the following properties:
4747
* string[] -- `services` -- list of (kebab-case) service names that should be disallowed from being injected under the specified paths
4848
* string[] -- `paths` -- optional list of regexp file paths that injecting the specified services should be disallowed under (omit this field to match any path)
49-
* string -- `error` -- optional custom error message to display for violations
49+
* string -- `message` -- optional custom error message to display for violations
5050

5151
## Related Rules
5252

lib/rules/no-restricted-service-injections.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
type: 'string',
3838
},
3939
},
40-
error: {
40+
message: {
4141
type: 'string',
4242
},
4343
},
@@ -77,7 +77,7 @@ module.exports = {
7777
if (blacklist.services.includes(serviceNameKebabCase)) {
7878
context.report({
7979
node,
80-
message: blacklist.error || DEFAULT_ERROR_MESSAGE,
80+
message: blacklist.message || DEFAULT_ERROR_MESSAGE,
8181
});
8282
}
8383
});

tests/lib/rules/no-restricted-service-injections.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ ruleTester.run('no-restricted-service-injections', rule, {
136136
{
137137
paths: ['app/components'],
138138
services: ['my-service'],
139-
error: 'my-service is deprecated, please do not use it.',
139+
message: 'my-service is deprecated, please do not use it.',
140140
},
141141
],
142142
output: null,
@@ -147,8 +147,8 @@ ruleTester.run('no-restricted-service-injections', rule, {
147147
// With multiple violations:
148148
code: 'Component.extend({ myService: service() })',
149149
options: [
150-
{ paths: ['app/components'], services: ['my-service'], error: 'Error 1' },
151-
{ paths: ['app/components'], services: ['my-service'], error: 'Error 2' },
150+
{ paths: ['app/components'], services: ['my-service'], message: 'Error 1' },
151+
{ paths: ['app/components'], services: ['my-service'], message: 'Error 2' },
152152
],
153153
output: null,
154154
filename: 'app/components/path.js',

0 commit comments

Comments
 (0)