@gitlab/eslint-plugin 10.0.1 → 12.0.0
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/CHANGELOG.md +33 -0
- package/README.md +1 -1
- package/docs/rules/require-i18n-strings.md +1 -1
- package/docs/rules.md +0 -1
- package/gitlab_schema_apollo.graphql +3621 -405
- package/lib/configs/default.js +4 -4
- package/lib/constants.js +1 -1
- package/lib/index.js +0 -1
- package/lib/rules/require-i18n-strings.js +5 -0
- package/package.json +9 -4
- package/docs/rules/vue-emit-events-with-two-args.md +0 -38
- package/lib/rules/vue-emit-events-with-two-args.js +0 -54
package/lib/configs/default.js
CHANGED
|
@@ -15,11 +15,11 @@ module.exports = {
|
|
|
15
15
|
'plugin:promise/recommended',
|
|
16
16
|
],
|
|
17
17
|
parserOptions: {
|
|
18
|
-
parser: 'babel-
|
|
18
|
+
parser: '@babel/eslint-parser',
|
|
19
19
|
},
|
|
20
|
-
plugins: ['babel', '
|
|
20
|
+
plugins: ['@babel', 'unicorn', 'promise', 'import', '@gitlab'],
|
|
21
21
|
rules: {
|
|
22
|
-
|
|
22
|
+
camelcase: [
|
|
23
23
|
'error',
|
|
24
24
|
{
|
|
25
25
|
properties: 'never',
|
|
@@ -27,7 +27,7 @@ module.exports = {
|
|
|
27
27
|
},
|
|
28
28
|
],
|
|
29
29
|
camelcase: 'off',
|
|
30
|
-
'
|
|
30
|
+
'unicorn/filename-case': ['error', { case: 'snakeCase' }],
|
|
31
31
|
'import/prefer-default-export': 'off',
|
|
32
32
|
'import/no-default-export': 'error',
|
|
33
33
|
'import/no-deprecated': 'error',
|
package/lib/constants.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -7,7 +7,6 @@ module.exports = {
|
|
|
7
7
|
'no-runtime-template-compiler': require('./rules/no-runtime-template-compiler.js'),
|
|
8
8
|
'require-i18n-strings': require('./rules/require-i18n-strings.js'),
|
|
9
9
|
'require-valid-i18n-helpers': require('./rules/require-valid-i18n-helpers.js'),
|
|
10
|
-
'vue-emit-events-with-two-args': require('./rules/vue-emit-events-with-two-args.js'),
|
|
11
10
|
'vue-no-data-toggle': require('./rules/vue-no-data-toggle.js'),
|
|
12
11
|
'vue-no-new-non-primitive-in-template': require('./rules/vue-no-new-non-primitive-in-template.js'),
|
|
13
12
|
'vue-require-i18n-attribute-strings': require('./rules/vue-require-i18n-attribute-strings.js'),
|
|
@@ -115,6 +115,10 @@ module.exports = {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
function isMailto(str) {
|
|
119
|
+
return (str || '').startsWith('mailto:');
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
function isPlaceholder(value) {
|
|
119
123
|
return /^{?{\w+}}?$/.test(value);
|
|
120
124
|
}
|
|
@@ -253,6 +257,7 @@ module.exports = {
|
|
|
253
257
|
!isNumber(value) &&
|
|
254
258
|
!isPath(value) &&
|
|
255
259
|
!isUrl(value) &&
|
|
260
|
+
!isMailto(value) &&
|
|
256
261
|
!isHtml(value) &&
|
|
257
262
|
!isCssSelector(value) &&
|
|
258
263
|
!isCssValue(value) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "GitLab package for our custom eslint rules",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,14 +27,16 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://gitlab.com/gitlab-org/frontend/eslint-plugin#readme",
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=14"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"babel
|
|
33
|
+
"@babel/core": "^7.17.0",
|
|
34
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
35
|
+
"@babel/eslint-plugin": "^7.17.7",
|
|
34
36
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
35
37
|
"eslint-config-prettier": "^6.10.0",
|
|
36
38
|
"eslint-plugin-babel": "^5.3.0",
|
|
37
|
-
"eslint-plugin-
|
|
39
|
+
"eslint-plugin-unicorn": "^40.1.0",
|
|
38
40
|
"eslint-plugin-import": "^2.22.1",
|
|
39
41
|
"eslint-plugin-jest": "^23.8.2",
|
|
40
42
|
"eslint-plugin-promise": "^4.2.1",
|
|
@@ -53,6 +55,9 @@
|
|
|
53
55
|
"pretty-quick": "^3.1.0"
|
|
54
56
|
},
|
|
55
57
|
"release": {
|
|
58
|
+
"branches": [
|
|
59
|
+
"main"
|
|
60
|
+
],
|
|
56
61
|
"verifyConditions": [
|
|
57
62
|
"@semantic-release/changelog",
|
|
58
63
|
"@semantic-release/npm",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# @gitlab/vue-emit-events-with-two-args
|
|
2
|
-
|
|
3
|
-
Throw an error when emit is called with more than two arguments.
|
|
4
|
-
|
|
5
|
-
## Rule Details
|
|
6
|
-
|
|
7
|
-
It has been decided to use `mitt` as an event bus implementation and this library does not support argument list as the event arguments, [it expects two arguments only](https://github.com/developit/mitt#emit).
|
|
8
|
-
|
|
9
|
-
To pass an argument list, an object should be used as the second argument.
|
|
10
|
-
|
|
11
|
-
### Examples of **incorrect** code for this rule
|
|
12
|
-
|
|
13
|
-
`emit` method called with more than two arguments.
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
vm.$emit('keyspressed', 'enter', '1');
|
|
17
|
-
vm.emit('keyspressed', 'enter', '1');
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Examples of **correct** code for this rule
|
|
21
|
-
|
|
22
|
-
Pass an object as the second argument to `emit`.
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
vm.$emit('keyspressed', { keys: ['enter', '1'] });
|
|
26
|
-
vm.emit('keyspressed', { keys: ['enter', '1'] });
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`emit` method called with one argument.
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
vm.$emit('focus');
|
|
33
|
-
vm.emit('focus');
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Options
|
|
37
|
-
|
|
38
|
-
Nothing
|
|
@@ -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
|
-
};
|