Skip to content

Commit 48a5d33

Browse files
authored
Merge pull request #1237 from bmish/deprecated-report-api
2 parents 6559ca5 + 473a816 commit 48a5d33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+88
-65
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ module.exports = {
9797

9898
// eslint-plugin rules:
9999
'eslint-plugin/consistent-output': ['error', 'always'],
100-
'eslint-plugin/no-deprecated-report-api': 'off',
101100
'eslint-plugin/require-meta-docs-url': [
102101
'error',
103102
{

lib/rules/alias-model-in-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
const message = 'Alias your model';
2525

2626
const report = function (node) {
27-
context.report(node, message);
27+
context.report({ node, message });
2828
};
2929

3030
const sourceCode = context.getSourceCode();

lib/rules/avoid-leaking-state-in-ember-objects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = {
7676
const report = function (node) {
7777
const message =
7878
'Only string, number, symbol, boolean, null, undefined, and function are allowed as default properties';
79-
context.report(node, message);
79+
context.report({ node, message });
8080
};
8181

8282
const sourceCode = context.getSourceCode();

lib/rules/avoid-using-needs-in-controllers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
const report = function (node) {
2424
const message =
2525
'`needs` API has been deprecated, `Ember.inject.controller` should be used instead';
26-
context.report(node, message);
26+
context.report({ node, message });
2727
};
2828

2929
const sourceCode = context.getSourceCode();

lib/rules/closure-actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525

2626
create(context) {
2727
const report = function (node) {
28-
context.report(node, ERROR_MESSAGE);
28+
context.report({ node, message: ERROR_MESSAGE });
2929
};
3030

3131
return {

lib/rules/computed-property-getters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = {
3838
const requireGetters = context.options[0] || 'always-with-setter';
3939

4040
const report = function (node, message) {
41-
context.report(node, message);
41+
context.report({ node, message });
4242
};
4343

4444
const requireGetterOnlyWithASetterInComputedProperty = function (node) {

lib/rules/jquery-ember-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = {
4646

4747
create(context) {
4848
const report = function (node) {
49-
context.report(node, ERROR_MESSAGE);
49+
context.report({ node, message: ERROR_MESSAGE });
5050
};
5151

5252
let importedEmberName;

lib/rules/named-functions-in-promises.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
const message = 'Use named functions defined on objects to handle promises';
3838

3939
const report = function (node) {
40-
context.report(node, message);
40+
context.report({ node, message });
4141
};
4242

4343
return {

lib/rules/new-module-imports.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
type: item.type,
4949
});
5050

51-
context.report(item, message);
51+
context.report({ node: item, message });
5252
}
5353
}
5454
}
@@ -83,7 +83,7 @@ module.exports = {
8383
type: item.type,
8484
});
8585

86-
context.report(item, message);
86+
context.report({ node: item, message });
8787
}
8888
}
8989
}
@@ -111,7 +111,7 @@ module.exports = {
111111
// JS module import for it, so do not report the error
112112
if (match) {
113113
const message = buildMessage({ node, fullName, key, match });
114-
context.report(node, message);
114+
context.report({ node, message });
115115
break;
116116
}
117117
}

lib/rules/no-actions-hash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
function reportActionsProp(properties) {
2525
const actionsProp = properties.find((property) => ember.isActionsProp(property));
2626
if (actionsProp) {
27-
context.report(actionsProp, ERROR_MESSAGE);
27+
context.report({ node: actionsProp, message: ERROR_MESSAGE });
2828
}
2929
}
3030

lib/rules/no-arrow-function-computed-properties.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ module.exports = {
7171

7272
if (onlyThisContexts) {
7373
if (isThisPresent) {
74-
context.report(node.arguments[node.arguments.length - 1], ERROR_MESSAGE);
74+
context.report({
75+
node: node.arguments[node.arguments.length - 1],
76+
message: ERROR_MESSAGE,
77+
});
7578
}
7679
} else {
77-
context.report(node.arguments[node.arguments.length - 1], ERROR_MESSAGE);
80+
context.report({
81+
node: node.arguments[node.arguments.length - 1],
82+
message: ERROR_MESSAGE,
83+
});
7884
}
7985
},
8086
};

lib/rules/no-attrs-in-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454

5555
MemberExpression(node) {
5656
if (currentEmberComponent && isThisAttrsExpression(node)) {
57-
context.report(node.property, ERROR_MESSAGE);
57+
context.report({ node: node.property, message: ERROR_MESSAGE });
5858
}
5959
},
6060
};

lib/rules/no-attrs-snapshot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535

3636
create(context) {
3737
const report = function (node) {
38-
context.report(node, ERROR_MESSAGE);
38+
context.report({ node, message: ERROR_MESSAGE });
3939
};
4040

4141
return {

lib/rules/no-classic-classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = {
7272
const additionalClassImports = options.additionalClassImports || [];
7373

7474
function reportNode(node) {
75-
context.report(node, ERROR_MESSAGE_NO_CLASSIC_CLASSES);
75+
context.report({ node, message: ERROR_MESSAGE_NO_CLASSIC_CLASSES });
7676
}
7777

7878
return {

lib/rules/no-classic-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323

2424
create(context) {
2525
const report = function (node) {
26-
context.report(node, ERROR_MESSAGE);
26+
context.report({ node, message: ERROR_MESSAGE });
2727
};
2828

2929
return {

lib/rules/no-computed-properties-in-native-classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module.exports = {
5555
let computedNodes = [];
5656

5757
const report = function (node) {
58-
context.report(node, ERROR_MESSAGE);
58+
context.report({ node, message: ERROR_MESSAGE });
5959
};
6060

6161
return {

lib/rules/no-controller-access-in-routes.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ module.exports = {
7777
node.property.name === 'controller'
7878
) {
7979
// Example: this.controller;
80-
context.report(node, ERROR_MESSAGE);
80+
context.report({ node, message: ERROR_MESSAGE });
8181
}
8282
},
8383

@@ -99,7 +99,7 @@ module.exports = {
9999
node.callee.property.name === 'controllerFor'
100100
) {
101101
// Example this.controllerFor(...);
102-
context.report(node, ERROR_MESSAGE);
102+
context.report({ node, message: ERROR_MESSAGE });
103103
}
104104

105105
if (
@@ -112,7 +112,7 @@ module.exports = {
112112
node.arguments[0].value === 'controller'
113113
) {
114114
// Example: this.get('controller');
115-
context.report(node, ERROR_MESSAGE);
115+
context.report({ node, message: ERROR_MESSAGE });
116116
}
117117

118118
if (
@@ -124,7 +124,7 @@ module.exports = {
124124
node.arguments[1].value === 'controller'
125125
) {
126126
// Example: get(this, 'controller');
127-
context.report(node, ERROR_MESSAGE);
127+
context.report({ node, message: ERROR_MESSAGE });
128128
}
129129

130130
if (
@@ -135,7 +135,7 @@ module.exports = {
135135
getPropertiesArgumentsIncludeController(node.arguments)
136136
) {
137137
// Example: this.getProperties('controller');
138-
context.report(node, ERROR_MESSAGE);
138+
context.report({ node, message: ERROR_MESSAGE });
139139
}
140140

141141
if (
@@ -145,7 +145,7 @@ module.exports = {
145145
getPropertiesArgumentsIncludeController(node.arguments.slice(1))
146146
) {
147147
// Example: getProperties(this, 'controller');
148-
context.report(node, ERROR_MESSAGE);
148+
context.report({ node, message: ERROR_MESSAGE });
149149
}
150150
},
151151

lib/rules/no-controllers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
ember.isEmberController(context, node) &&
3030
(node.body.body.length === 0 || !classDeclarationHasProperty(node, 'queryParams'))
3131
) {
32-
context.report(node, ERROR_MESSAGE);
32+
context.report({ node, message: ERROR_MESSAGE });
3333
}
3434
},
3535

@@ -39,7 +39,7 @@ module.exports = {
3939
(node.arguments.length === 0 ||
4040
!callExpressionClassHasProperty(node, 'queryParams', scopeManager))
4141
) {
42-
context.report(node, ERROR_MESSAGE);
42+
context.report({ node, message: ERROR_MESSAGE });
4343
}
4444
},
4545
};

lib/rules/no-current-route-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
CallExpression(node) {
3636
const { callee } = node;
3737
if (callee.type === 'Identifier' && importAliases.includes(callee.name)) {
38-
context.report(node, ERROR_MESSAGE);
38+
context.report({ node, message: ERROR_MESSAGE });
3939
}
4040
},
4141
};

lib/rules/no-ember-testing-in-module-scope.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ module.exports = {
4545
node.parent.object.name === emberImportAliasName
4646
) {
4747
if (context.getScope().variableScope.type === 'module') {
48-
context.report(node.parent, ERROR_MESSAGES[0]);
48+
context.report({ node: node.parent, message: ERROR_MESSAGES[0] });
4949
}
5050
const nodeGrandParent = utils.getPropertyValue(node, 'parent.parent.type');
5151
if (
5252
nodeGrandParent === 'AssignmentExpression' ||
5353
nodeGrandParent === 'VariableDeclarator'
5454
) {
55-
context.report(node.parent.parent, ERROR_MESSAGES[1]);
55+
context.report({ node: node.parent.parent, message: ERROR_MESSAGES[1] });
5656
}
5757
}
5858
},
@@ -66,7 +66,7 @@ module.exports = {
6666
ancestorNode.init.name === emberImportAliasName
6767
)
6868
) {
69-
context.report(node.parent.parent.parent, ERROR_MESSAGES[2]);
69+
context.report({ node: node.parent.parent.parent, message: ERROR_MESSAGES[2] });
7070
}
7171
},
7272
};

lib/rules/no-empty-attrs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
const filePath = context.getFilename();
2525

2626
const report = function (node) {
27-
context.report(node, message);
27+
context.report({ node, message });
2828
};
2929

3030
const sourceCode = context.getSourceCode();

lib/rules/no-empty-glimmer-component-classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
return {
2828
ClassDeclaration(node) {
2929
if (isGlimmerComponent(context, node) && node.body.body.length === 0) {
30-
context.report(node, ERROR_MESSAGE);
30+
context.report({ node, message: ERROR_MESSAGE });
3131
}
3232
},
3333
};

lib/rules/no-function-prototype-extensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
};
3535

3636
const report = function (node) {
37-
context.report(node, message);
37+
context.report({ node, message });
3838
};
3939

4040
return {

lib/rules/no-get.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ module.exports = {
264264
validateGetPropertiesArguments(node.arguments, ignoreNestedPaths)
265265
) {
266266
// Example: this.getProperties('foo', 'bar');
267-
context.report(node, ERROR_MESSAGE_GET_PROPERTIES);
267+
context.report({ node, message: ERROR_MESSAGE_GET_PROPERTIES });
268268
}
269269

270270
if (
@@ -274,7 +274,7 @@ module.exports = {
274274
validateGetPropertiesArguments(node.arguments.slice(1), ignoreNestedPaths)
275275
) {
276276
// Example: getProperties(this, 'foo', 'bar');
277-
context.report(node, ERROR_MESSAGE_GET_PROPERTIES);
277+
context.report({ node, message: ERROR_MESSAGE_GET_PROPERTIES });
278278
}
279279
},
280280
};

lib/rules/no-global-jquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
const tracker = new ReferenceTracker(context.getScope());
3131

3232
for (const { node } of tracker.iterateGlobalReferences(globalMap)) {
33-
context.report(node, ERROR_MESSAGE);
33+
context.report({ node, message: ERROR_MESSAGE });
3434
}
3535
},
3636
};

lib/rules/no-incorrect-calls-with-inline-anonymous-functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
function checkArgumentsForInlineFunction(node) {
3737
for (const [index, argument] of node.arguments.entries()) {
3838
if (types.isAnyFunctionExpression(argument)) {
39-
context.report(node.arguments[index], ERROR_MESSAGE);
39+
context.report({ node: node.arguments[index], message: ERROR_MESSAGE });
4040
}
4141
}
4242
}

lib/rules/no-incorrect-computed-macros.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = {
6666
},
6767
});
6868
} else if (node.arguments.length === 0) {
69-
context.report(node, ERROR_MESSAGE_AND_OR);
69+
context.report({ node, message: ERROR_MESSAGE_AND_OR });
7070
}
7171
}
7272
},

lib/rules/no-jquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727

2828
create(context) {
2929
const report = function (node) {
30-
context.report(node, ERROR_MESSAGE);
30+
context.report({ node, message: ERROR_MESSAGE });
3131
};
3232

3333
return {

lib/rules/no-legacy-test-waiters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
node.callee.type === 'Identifier' &&
4040
testWaitersIdentifiers.includes(node.callee.name)
4141
) {
42-
context.report(node, ERROR_MESSAGE);
42+
context.report({ node, message: ERROR_MESSAGE });
4343
}
4444
},
4545
};

lib/rules/no-mixins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
ImportDeclaration(node) {
2828
const importPath = node.source.value;
2929
if (mixinPathRegex.test(importPath)) {
30-
context.report(node, ERROR_MESSAGE);
30+
context.report({ node, message: ERROR_MESSAGE });
3131
}
3232
},
3333
};

lib/rules/no-new-mixins.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ module.exports = {
2727
return {
2828
CallExpression(node) {
2929
if (ember.isEmberMixin(context, node)) {
30-
context.report(node, ERROR_MESSAGE);
30+
context.report({ node, message: ERROR_MESSAGE });
3131
}
3232
},
3333

3434
ClassDeclaration(node) {
3535
if (ember.isEmberMixin(context, node)) {
36-
context.report(node, ERROR_MESSAGE);
36+
context.report({ node, message: ERROR_MESSAGE });
3737
}
3838
},
3939
};

0 commit comments

Comments
 (0)