@gitlab/eslint-plugin 10.0.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tool-versions +2 -0
- package/CHANGELOG.md +33 -0
- package/README.md +1 -1
- package/docs/development.md +1 -1
- package/docs/rules/require-i18n-strings.md +1 -1
- package/docs/rules.md +0 -1
- package/lib/configs/default.js +4 -5
- package/lib/constants.js +1 -1
- package/lib/index.js +0 -1
- package/package.json +13 -8
- package/docs/rules/vue-emit-events-with-two-args.md +0 -38
- package/gitlab_schema_apollo.graphql +0 -29450
- package/lib/rules/vue-emit-events-with-two-args.js +0 -54
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// ------------------------------------------------------------------------------
|
|
2
|
-
// Requirements
|
|
3
|
-
// ------------------------------------------------------------------------------
|
|
4
|
-
const { DOCS_BASE_URL } = require('../constants');
|
|
5
|
-
const { getFunctionName } = require('../utils/rule-utils');
|
|
6
|
-
|
|
7
|
-
// ------------------------------------------------------------------------------
|
|
8
|
-
// Helpers
|
|
9
|
-
// ------------------------------------------------------------------------------
|
|
10
|
-
|
|
11
|
-
const EMIT_LIST = new Set(['$emit', 'emit']);
|
|
12
|
-
const ERROR_MESSAGE = `Expected emit to be called with no more than two arguments.`;
|
|
13
|
-
|
|
14
|
-
// ------------------------------------------------------------------------------
|
|
15
|
-
// Rule Definition
|
|
16
|
-
// ------------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
19
|
-
meta: {
|
|
20
|
-
type: 'problem',
|
|
21
|
-
docs: {
|
|
22
|
-
description: `Throw an error when emit is called with more than two arguments.`,
|
|
23
|
-
url: DOCS_BASE_URL + '/vue-emit-events-with-two-args.md',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
create(context) {
|
|
27
|
-
function report(node) {
|
|
28
|
-
context.report({
|
|
29
|
-
node,
|
|
30
|
-
message: ERROR_MESSAGE,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function isEmitCall(node) {
|
|
35
|
-
const functionName = getFunctionName(node);
|
|
36
|
-
|
|
37
|
-
return functionName && EMIT_LIST.has(functionName);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function checkFunctionArguments(callExpression) {
|
|
41
|
-
if (callExpression.arguments.length > 2) {
|
|
42
|
-
report(callExpression);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
CallExpression(node) {
|
|
48
|
-
if (isEmitCall(node)) {
|
|
49
|
-
checkFunctionArguments(node);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
};
|