@gitlab/eslint-plugin 21.4.1 → 22.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 +223 -0
- package/README.md +16 -11
- package/docs/development.md +2 -1
- package/docs/rules/vue-no-popover-target-dollar-el.md +69 -0
- package/docs/rules.md +1 -0
- package/docs/usage.md +158 -47
- package/eslint9/index.js +6 -7
- package/lib/configs/base/best-practices.js +0 -4
- package/lib/configs/base/es6.js +0 -12
- package/lib/configs/base/imports.js +0 -9
- package/lib/configs/base/node.js +0 -4
- package/lib/confusing-browser-globals.js +68 -0
- package/lib/flat-configs/base.js +122 -0
- package/lib/flat-configs/default.js +13 -0
- package/lib/flat-configs/i18n.js +14 -0
- package/lib/flat-configs/jest.js +20 -0
- package/lib/flat-configs/tailwind.js +19 -0
- package/{eslint9/configs → lib/flat-configs}/typescript.js +47 -62
- package/lib/flat-configs/vue.js +16 -0
- package/lib/index.js +30 -38
- package/lib/plugin.js +32 -0
- package/lib/prettier-rules.js +10 -0
- package/lib/rules/no-runtime-template-compiler.js +5 -2
- package/lib/rules/vue-no-new-non-primitive-in-template.js +1 -1
- package/lib/rules/vue-no-popover-target-dollar-el.js +156 -0
- package/lib/rules/vue-no-undef-apollo-properties.js +1 -1
- package/lib/rules/vue-prefer-dollar-scopedslots.js +1 -1
- package/lib/rules/vue-require-required-key.js +1 -1
- package/lib/rules/vue-slot-name-casing.js +2 -2
- package/lib/vue-fragments.js +111 -0
- package/package.json +29 -11
- package/scripts/generateRuleMapFixtures.js +75 -0
- package/scripts/helpers/getConfigs.js +13 -6
- package/scripts/integration_test/bootstrap.sh +1 -1
- package/scripts/updateFiles.js +30 -6
- package/eslint9/configs/base.js +0 -140
- package/lib/configs/base.js +0 -115
- package/lib/configs/default.js +0 -17
- package/lib/configs/i18n.js +0 -10
- package/lib/configs/jest.js +0 -21
- package/lib/configs/tailwind.js +0 -10
- package/lib/configs/typescript.js +0 -95
- package/lib/configs/vue.js +0 -90
package/lib/configs/base/node.js
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inlined from the `confusing-browser-globals` package.
|
|
3
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
* See: https://www.npmjs.com/package/confusing-browser-globals
|
|
6
|
+
*/
|
|
7
|
+
const confusingBrowserGlobals = [
|
|
8
|
+
'addEventListener',
|
|
9
|
+
'blur',
|
|
10
|
+
'close',
|
|
11
|
+
'closed',
|
|
12
|
+
'confirm',
|
|
13
|
+
'defaultStatus',
|
|
14
|
+
'defaultstatus',
|
|
15
|
+
'event',
|
|
16
|
+
'external',
|
|
17
|
+
'find',
|
|
18
|
+
'focus',
|
|
19
|
+
'frameElement',
|
|
20
|
+
'frames',
|
|
21
|
+
'history',
|
|
22
|
+
'innerHeight',
|
|
23
|
+
'innerWidth',
|
|
24
|
+
'length',
|
|
25
|
+
'location',
|
|
26
|
+
'locationbar',
|
|
27
|
+
'menubar',
|
|
28
|
+
'moveBy',
|
|
29
|
+
'moveTo',
|
|
30
|
+
'name',
|
|
31
|
+
'onblur',
|
|
32
|
+
'onerror',
|
|
33
|
+
'onfocus',
|
|
34
|
+
'onload',
|
|
35
|
+
'onresize',
|
|
36
|
+
'onunload',
|
|
37
|
+
'open',
|
|
38
|
+
'opener',
|
|
39
|
+
'opera',
|
|
40
|
+
'outerHeight',
|
|
41
|
+
'outerWidth',
|
|
42
|
+
'pageXOffset',
|
|
43
|
+
'pageYOffset',
|
|
44
|
+
'parent',
|
|
45
|
+
'print',
|
|
46
|
+
'removeEventListener',
|
|
47
|
+
'resizeBy',
|
|
48
|
+
'resizeTo',
|
|
49
|
+
'screen',
|
|
50
|
+
'screenLeft',
|
|
51
|
+
'screenTop',
|
|
52
|
+
'screenX',
|
|
53
|
+
'screenY',
|
|
54
|
+
'scroll',
|
|
55
|
+
'scrollbars',
|
|
56
|
+
'scrollBy',
|
|
57
|
+
'scrollTo',
|
|
58
|
+
'scrollX',
|
|
59
|
+
'scrollY',
|
|
60
|
+
'self',
|
|
61
|
+
'status',
|
|
62
|
+
'statusbar',
|
|
63
|
+
'stop',
|
|
64
|
+
'toolbar',
|
|
65
|
+
'top',
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
module.exports = confusingBrowserGlobals;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const globals = require('globals');
|
|
2
|
+
const unicornPlugin = require('eslint-plugin-unicorn');
|
|
3
|
+
const promisePlugin = require('eslint-plugin-promise');
|
|
4
|
+
const importPlugin = require('eslint-plugin-import');
|
|
5
|
+
|
|
6
|
+
const confusingBrowserGlobals = require('../confusing-browser-globals');
|
|
7
|
+
const gitlabPlugin = require('../plugin.js');
|
|
8
|
+
const prettierRules = require('../prettier-rules');
|
|
9
|
+
|
|
10
|
+
const bestPractices = require('../configs/base/best-practices');
|
|
11
|
+
const errors = require('../configs/base/errors');
|
|
12
|
+
const node = require('../configs/base/node');
|
|
13
|
+
const style = require('../configs/base/style');
|
|
14
|
+
const variables = require('../configs/base/variables');
|
|
15
|
+
const es6 = require('../configs/base/es6');
|
|
16
|
+
const imports = require('../configs/base/imports');
|
|
17
|
+
const strict = require('../configs/base/strict');
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
Rules related to the GitLab JavaScript style guide.
|
|
21
|
+
Vue-specific rules live in lib/flat-configs/vue.js
|
|
22
|
+
*/
|
|
23
|
+
module.exports = [
|
|
24
|
+
{
|
|
25
|
+
languageOptions: {
|
|
26
|
+
globals: {
|
|
27
|
+
...globals.browser,
|
|
28
|
+
...globals.es2020,
|
|
29
|
+
...globals.es2015,
|
|
30
|
+
...globals.node,
|
|
31
|
+
},
|
|
32
|
+
ecmaVersion: 'latest',
|
|
33
|
+
sourceType: 'module',
|
|
34
|
+
},
|
|
35
|
+
plugins: {
|
|
36
|
+
unicorn: unicornPlugin,
|
|
37
|
+
promise: promisePlugin,
|
|
38
|
+
import: importPlugin,
|
|
39
|
+
'@gitlab': gitlabPlugin,
|
|
40
|
+
},
|
|
41
|
+
settings: imports.settings,
|
|
42
|
+
},
|
|
43
|
+
/*
|
|
44
|
+
One config object per rule set, not one merged `rules` block: a
|
|
45
|
+
severity-only override later in the array (`'no-restricted-syntax': 'off'`)
|
|
46
|
+
keeps the options it inherits from an earlier object. Merging these would
|
|
47
|
+
strip the inherited options from 56 rules at unchanged severity.
|
|
48
|
+
*/
|
|
49
|
+
{ rules: bestPractices.rules },
|
|
50
|
+
{ rules: errors.rules },
|
|
51
|
+
{ rules: node.rules },
|
|
52
|
+
{ rules: style.rules },
|
|
53
|
+
{ rules: variables.rules },
|
|
54
|
+
{ rules: es6.rules },
|
|
55
|
+
{ rules: imports.rules },
|
|
56
|
+
{ rules: strict.rules },
|
|
57
|
+
{ rules: promisePlugin.configs['flat/recommended'].rules },
|
|
58
|
+
{ rules: prettierRules },
|
|
59
|
+
{
|
|
60
|
+
rules: {
|
|
61
|
+
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
|
|
62
|
+
'default-param-last': 'off',
|
|
63
|
+
'arrow-body-style': 'off',
|
|
64
|
+
'unicorn/filename-case': ['error', { case: 'snakeCase' }],
|
|
65
|
+
'unicorn/no-array-callback-reference': 'error',
|
|
66
|
+
'import/prefer-default-export': 'off',
|
|
67
|
+
'import/no-default-export': 'error',
|
|
68
|
+
'import/no-deprecated': 'error',
|
|
69
|
+
'import/no-dynamic-require': ['error', { esmodule: true }],
|
|
70
|
+
'no-implicit-coercion': ['error', { boolean: true, number: true, string: true }],
|
|
71
|
+
'no-param-reassign': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
props: true,
|
|
75
|
+
ignorePropertyModificationsFor: ['acc', 'accumulator', 'el', 'element', 'state'],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
'no-restricted-exports': [
|
|
79
|
+
'error',
|
|
80
|
+
{
|
|
81
|
+
restrictedNamedExports: [
|
|
82
|
+
'then', // avoid confusion when used with dynamic `import()` promise
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
'no-restricted-syntax': 'off',
|
|
87
|
+
'no-sequences': ['error', { allowInParentheses: false }],
|
|
88
|
+
'promise/catch-or-return': ['error', { allowFinally: true }],
|
|
89
|
+
'no-restricted-globals': [
|
|
90
|
+
'error',
|
|
91
|
+
{
|
|
92
|
+
name: 'isFinite',
|
|
93
|
+
message:
|
|
94
|
+
'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'isNaN',
|
|
98
|
+
message:
|
|
99
|
+
'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'escape',
|
|
103
|
+
message:
|
|
104
|
+
"The global `escape` function is unsafe. Did you mean to use `encodeURI`, `encodeURIComponent` or lodash's `escape` instead?",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'unescape',
|
|
108
|
+
message:
|
|
109
|
+
"The global `unescape` function is unsafe. Did you mean to use `decodeURI`, `decodeURIComponent` or lodash's `unescape` instead?",
|
|
110
|
+
},
|
|
111
|
+
].concat(confusingBrowserGlobals),
|
|
112
|
+
'import/order': [
|
|
113
|
+
'error',
|
|
114
|
+
{
|
|
115
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
// https://docs.gitlab.com/ee/development/fe_guide/style/javascript.html#limit-number-of-parameters
|
|
119
|
+
'max-params': ['error', { max: 3 }],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const base = require('./base');
|
|
2
|
+
const { presetAndSetup, gitlabRules } = require('../vue-fragments');
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
The GitLab JavaScript and Vue rules combined. This is the config most
|
|
6
|
+
consumers want.
|
|
7
|
+
|
|
8
|
+
Not `[...base, ...vue]`. base already contributes eslint-config-prettier, and
|
|
9
|
+
it lands *before* the vue preset here, where lib/flat-configs/vue.js puts it
|
|
10
|
+
after -- so six vue formatting rules stay at the preset's `warn` in this
|
|
11
|
+
config and are `off` in vue. That asymmetry is inherited, not a bug.
|
|
12
|
+
*/
|
|
13
|
+
module.exports = [...base, ...presetAndSetup, ...gitlabRules];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const gitlabPlugin = require('../plugin.js');
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
plugins: { '@gitlab': gitlabPlugin },
|
|
6
|
+
rules: {
|
|
7
|
+
'@gitlab/require-i18n-strings': 'error',
|
|
8
|
+
'@gitlab/vue-require-i18n-attribute-strings': 'error',
|
|
9
|
+
'@gitlab/vue-require-i18n-strings': 'error',
|
|
10
|
+
'@gitlab/require-valid-i18n-helpers': 'error',
|
|
11
|
+
'@gitlab/vue-require-valid-i18n-helpers': 'error',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const jestPlugin = require('eslint-plugin-jest');
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
jestPlugin.configs['flat/recommended'],
|
|
5
|
+
{
|
|
6
|
+
rules: {
|
|
7
|
+
'jest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
|
|
8
|
+
'jest/no-conditional-expect': 'off',
|
|
9
|
+
'jest/valid-title': ['error', { ignoreTypeOfDescribeName: true }],
|
|
10
|
+
'jest/no-restricted-matchers': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
toBeFalsy: 'Prefer a stronger matcher like `toBe(false)`',
|
|
14
|
+
toBeTruthy: 'Prefer a stronger matcher like `toBe(true)`',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
'jest/prefer-to-have-length': 'error',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const tailwindPlugin = require('eslint-plugin-tailwindcss');
|
|
2
|
+
|
|
3
|
+
const gitlabPlugin = require('../plugin.js');
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
plugins: {
|
|
8
|
+
'@gitlab': gitlabPlugin,
|
|
9
|
+
tailwindcss: tailwindPlugin,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
'@gitlab/tailwind-no-interpolation': 'error',
|
|
13
|
+
'@gitlab/vue-tailwind-no-interpolation': 'error',
|
|
14
|
+
'@gitlab/tailwind-no-max-width-media-queries': 'error',
|
|
15
|
+
'@gitlab/vue-tailwind-no-max-width-media-queries': 'error',
|
|
16
|
+
'tailwindcss/no-arbitrary-value': 'error',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -1,98 +1,83 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const js = require('@eslint/js');
|
|
2
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
3
3
|
const tsParser = require('@typescript-eslint/parser');
|
|
4
|
+
const importPlugin = require('eslint-plugin-import');
|
|
4
5
|
const globals = require('globals');
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const base = require('./base');
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Rules related to the GitLab TypeScript style guide.
|
|
11
|
+
Base JavaScript rules live in lib/flat-configs/base.js
|
|
12
|
+
|
|
13
|
+
Two things here are load-bearing:
|
|
14
|
+
|
|
15
|
+
1. base is spread first and the `.ts` layer second, so eslint:recommended and
|
|
16
|
+
the TypeScript preset win over eslint-config-prettier inside .ts files,
|
|
17
|
+
as eslintrc's `overrides` did. Putting prettier last would not.
|
|
18
|
+
|
|
19
|
+
2. `flat/eslint-recommended` is spread alongside `strict`, because eslintrc's
|
|
20
|
+
`plugin:@typescript-eslint/strict` extended it. Without it, 19 core rules
|
|
21
|
+
that a TypeScript-aware replacement or the compiler already covers stay
|
|
22
|
+
enabled.
|
|
23
|
+
*/
|
|
24
|
+
const tsEslintRecommended = tsPlugin.configs['flat/eslint-recommended'];
|
|
25
|
+
const tsStrict = tsPlugin.configs.strict;
|
|
26
|
+
const importTypescript = importPlugin.flatConfigs.typescript;
|
|
27
|
+
|
|
28
|
+
module.exports = [
|
|
29
|
+
...base,
|
|
7
30
|
{
|
|
31
|
+
name: '@gitlab/typescript/setup',
|
|
8
32
|
languageOptions: {
|
|
9
33
|
globals: {
|
|
10
|
-
...baseConfig.languageOptions.globals,
|
|
11
34
|
...globals.mocha,
|
|
12
35
|
...globals.jest,
|
|
13
36
|
},
|
|
14
|
-
ecmaVersion: baseConfig.languageOptions.ecmaVersion,
|
|
15
|
-
sourceType: baseConfig.languageOptions.sourceType,
|
|
16
|
-
parserOptions: baseConfig.languageOptions.parserOptions || {},
|
|
17
|
-
},
|
|
18
|
-
plugins: {
|
|
19
|
-
...baseConfig.plugins,
|
|
20
|
-
},
|
|
21
|
-
settings: {
|
|
22
|
-
...baseConfig.settings,
|
|
23
37
|
},
|
|
24
38
|
rules: {
|
|
25
|
-
|
|
39
|
+
'import/extensions': [
|
|
40
|
+
'error',
|
|
41
|
+
'ignorePackages',
|
|
42
|
+
{ js: 'never', jsx: 'never', ts: 'never', tsx: 'never' },
|
|
43
|
+
],
|
|
26
44
|
},
|
|
27
45
|
},
|
|
28
|
-
// TypeScript-specific config
|
|
29
46
|
{
|
|
30
|
-
|
|
47
|
+
name: '@gitlab/typescript/ts',
|
|
48
|
+
files: ['**/*.ts'],
|
|
31
49
|
languageOptions: {
|
|
32
50
|
parser: tsParser,
|
|
33
51
|
parserOptions: {
|
|
34
52
|
project: ['./tsconfig.json'],
|
|
35
|
-
tsconfigRootDir: process.cwd(),
|
|
36
53
|
},
|
|
37
54
|
},
|
|
38
55
|
plugins: {
|
|
39
|
-
'@typescript-eslint':
|
|
56
|
+
'@typescript-eslint': tsPlugin,
|
|
57
|
+
import: importPlugin,
|
|
40
58
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
node: {
|
|
44
|
-
extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx'],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
59
|
+
linterOptions: {
|
|
60
|
+
reportUnusedDisableDirectives: true,
|
|
47
61
|
},
|
|
62
|
+
settings: importTypescript.settings,
|
|
48
63
|
rules: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
js: 'never',
|
|
54
|
-
jsx: 'never',
|
|
55
|
-
ts: 'never',
|
|
56
|
-
tsx: 'never',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
64
|
+
...js.configs.recommended.rules,
|
|
65
|
+
...tsEslintRecommended.rules,
|
|
66
|
+
...tsStrict.rules,
|
|
67
|
+
...importTypescript.rules,
|
|
59
68
|
semi: [2, 'always'],
|
|
60
69
|
'max-params': 'off',
|
|
61
70
|
'no-throw-literal': 'off',
|
|
62
71
|
'no-shadow': 'off',
|
|
63
72
|
'no-empty-function': 'off',
|
|
64
73
|
'no-plusplus': 'off',
|
|
65
|
-
'no-unused-vars': 'off',
|
|
66
|
-
'no-await-in-loop': 'error',
|
|
67
74
|
'unicorn/no-array-callback-reference': 'off',
|
|
68
|
-
'generator-star-spacing': 'off',
|
|
69
|
-
'max-len': 'off',
|
|
70
|
-
'no-console': 'warn',
|
|
71
|
-
'indent': 'off',
|
|
72
|
-
'quotes': 'off',
|
|
73
|
-
'implicit-arrow-linebreak': 'off',
|
|
74
|
-
'function-paren-newline': 'off',
|
|
75
|
-
'no-redeclare': 'off',
|
|
76
|
-
'brace-style': 'off',
|
|
77
|
-
'no-undef': 'off',
|
|
78
|
-
'no-tabs': 'off',
|
|
79
|
-
'operator-linebreak': 'off',
|
|
80
|
-
'no-confusing-arrow': 'off',
|
|
81
|
-
'object-curly-newline': 'off',
|
|
82
75
|
'@typescript-eslint/only-throw-error': 'error',
|
|
83
76
|
'@typescript-eslint/no-unused-vars': 'error',
|
|
84
77
|
'@typescript-eslint/no-shadow': 'error',
|
|
85
78
|
'@typescript-eslint/return-await': 'error',
|
|
86
79
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
87
|
-
'@typescript-eslint/
|
|
88
|
-
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
89
|
-
'@typescript-eslint/no-var-requires': 'error',
|
|
90
|
-
'@typescript-eslint/explicit-member-accessibility': [
|
|
91
|
-
'error',
|
|
92
|
-
{
|
|
93
|
-
accessibility: 'no-public',
|
|
94
|
-
},
|
|
95
|
-
],
|
|
80
|
+
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
|
|
96
81
|
'class-methods-use-this': 'off',
|
|
97
82
|
'import/no-cycle': 'error',
|
|
98
83
|
'promise/param-names': 'off',
|
|
@@ -121,8 +106,10 @@ const tsConfig = [
|
|
|
121
106
|
],
|
|
122
107
|
},
|
|
123
108
|
},
|
|
124
|
-
// Test files config
|
|
125
109
|
{
|
|
110
|
+
// Recursive: eslintrc matched a bare `*.test.ts` at any depth, flat globs
|
|
111
|
+
// are path-relative.
|
|
112
|
+
name: '@gitlab/typescript/tests',
|
|
126
113
|
files: ['**/*.test.ts', '**/*.test.js'],
|
|
127
114
|
rules: {
|
|
128
115
|
'max-classes-per-file': 'off',
|
|
@@ -130,5 +117,3 @@ const tsConfig = [
|
|
|
130
117
|
},
|
|
131
118
|
},
|
|
132
119
|
];
|
|
133
|
-
|
|
134
|
-
module.exports = tsConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const prettierRules = require('../prettier-rules');
|
|
2
|
+
const { presetAndSetup, gitlabRules } = require('../vue-fragments');
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Rules related to the GitLab Vue style guide.
|
|
6
|
+
Base JavaScript rules live in lib/flat-configs/base.js
|
|
7
|
+
|
|
8
|
+
eslint-config-prettier sits between the preset and this package's rules,
|
|
9
|
+
switching the preset's formatting rules off. lib/flat-configs/default.js
|
|
10
|
+
orders it the other way -- see the note there.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = [
|
|
13
|
+
...presetAndSetup,
|
|
14
|
+
{ name: '@gitlab/vue/prettier', rules: prettierRules },
|
|
15
|
+
...gitlabRules,
|
|
16
|
+
];
|
package/lib/index.js
CHANGED
|
@@ -1,45 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file is GENERATED, please run `yarn update` after adding or renaming a rule
|
|
3
3
|
*/
|
|
4
|
+
const plugin = require('./plugin.js');
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
Getters, so requiring the plugin never loads a config the consumer is not
|
|
8
|
+
using: `typescript` pulls in optional peer dependencies, and eagerly
|
|
9
|
+
requiring it would throw for anyone without the TypeScript toolchain. Getters
|
|
10
|
+
in an object literal are enumerable, so `Object.keys(configs)` is unaffected.
|
|
11
|
+
*/
|
|
4
12
|
module.exports = {
|
|
5
|
-
|
|
6
|
-
'no-global-event-off': require('./rules/no-global-event-off.js'),
|
|
7
|
-
'no-hardcoded-urls': require('./rules/no-hardcoded-urls.js'),
|
|
8
|
-
'no-runtime-template-compiler': require('./rules/no-runtime-template-compiler.js'),
|
|
9
|
-
'require-i18n-strings': require('./rules/require-i18n-strings.js'),
|
|
10
|
-
'require-valid-i18n-helpers': require('./rules/require-valid-i18n-helpers.js'),
|
|
11
|
-
'tailwind-no-interpolation': require('./rules/tailwind-no-interpolation.js'),
|
|
12
|
-
'tailwind-no-max-width-media-queries': require('./rules/tailwind-no-max-width-media-queries.js'),
|
|
13
|
-
'vtu-no-explicit-wrapper-destroy': require('./rules/vtu-no-explicit-wrapper-destroy.js'),
|
|
14
|
-
'vtu-no-wrapper-vm': require('./rules/vtu-no-wrapper-vm.js'),
|
|
15
|
-
'vue-no-data-toggle': require('./rules/vue-no-data-toggle.js'),
|
|
16
|
-
'vue-no-hardcoded-urls': require('./rules/vue-no-hardcoded-urls.js'),
|
|
17
|
-
'vue-no-new-non-primitive-in-template': require('./rules/vue-no-new-non-primitive-in-template.js'),
|
|
18
|
-
'vue-no-undef-apollo-properties': require('./rules/vue-no-undef-apollo-properties.js'),
|
|
19
|
-
'vue-prefer-dollar-scopedslots': require('./rules/vue-prefer-dollar-scopedslots.js'),
|
|
20
|
-
'vue-require-i18n-attribute-strings': require('./rules/vue-require-i18n-attribute-strings.js'),
|
|
21
|
-
'vue-require-i18n-strings': require('./rules/vue-require-i18n-strings.js'),
|
|
22
|
-
'vue-require-required-key': require('./rules/vue-require-required-key.js'),
|
|
23
|
-
'vue-require-valid-i18n-helpers': require('./rules/vue-require-valid-i18n-helpers.js'),
|
|
24
|
-
'vue-slot-name-casing': require('./rules/vue-slot-name-casing.js'),
|
|
25
|
-
'vue-tailwind-no-interpolation': require('./rules/vue-tailwind-no-interpolation.js'),
|
|
26
|
-
'vue-tailwind-no-max-width-media-queries': require('./rules/vue-tailwind-no-max-width-media-queries.js'),
|
|
27
|
-
},
|
|
13
|
+
...plugin,
|
|
28
14
|
configs: {
|
|
29
|
-
base
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
tailwind
|
|
42
|
-
|
|
43
|
-
|
|
15
|
+
get base() {
|
|
16
|
+
return require('./flat-configs/base.js');
|
|
17
|
+
},
|
|
18
|
+
get default() {
|
|
19
|
+
return require('./flat-configs/default.js');
|
|
20
|
+
},
|
|
21
|
+
get i18n() {
|
|
22
|
+
return require('./flat-configs/i18n.js');
|
|
23
|
+
},
|
|
24
|
+
get jest() {
|
|
25
|
+
return require('./flat-configs/jest.js');
|
|
26
|
+
},
|
|
27
|
+
get tailwind() {
|
|
28
|
+
return require('./flat-configs/tailwind.js');
|
|
29
|
+
},
|
|
30
|
+
get typescript() {
|
|
31
|
+
return require('./flat-configs/typescript.js');
|
|
32
|
+
},
|
|
33
|
+
get vue() {
|
|
34
|
+
return require('./flat-configs/vue.js');
|
|
35
|
+
},
|
|
44
36
|
},
|
|
45
37
|
};
|
package/lib/plugin.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is GENERATED, please run `yarn update` after adding or renaming a rule
|
|
3
|
+
*/
|
|
4
|
+
const { name, version } = require('../package.json');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
meta: { name, version },
|
|
8
|
+
rules: {
|
|
9
|
+
'no-global-event-off': require('./rules/no-global-event-off.js'),
|
|
10
|
+
'no-hardcoded-urls': require('./rules/no-hardcoded-urls.js'),
|
|
11
|
+
'no-runtime-template-compiler': require('./rules/no-runtime-template-compiler.js'),
|
|
12
|
+
'require-i18n-strings': require('./rules/require-i18n-strings.js'),
|
|
13
|
+
'require-valid-i18n-helpers': require('./rules/require-valid-i18n-helpers.js'),
|
|
14
|
+
'tailwind-no-interpolation': require('./rules/tailwind-no-interpolation.js'),
|
|
15
|
+
'tailwind-no-max-width-media-queries': require('./rules/tailwind-no-max-width-media-queries.js'),
|
|
16
|
+
'vtu-no-explicit-wrapper-destroy': require('./rules/vtu-no-explicit-wrapper-destroy.js'),
|
|
17
|
+
'vtu-no-wrapper-vm': require('./rules/vtu-no-wrapper-vm.js'),
|
|
18
|
+
'vue-no-data-toggle': require('./rules/vue-no-data-toggle.js'),
|
|
19
|
+
'vue-no-hardcoded-urls': require('./rules/vue-no-hardcoded-urls.js'),
|
|
20
|
+
'vue-no-new-non-primitive-in-template': require('./rules/vue-no-new-non-primitive-in-template.js'),
|
|
21
|
+
'vue-no-popover-target-dollar-el': require('./rules/vue-no-popover-target-dollar-el.js'),
|
|
22
|
+
'vue-no-undef-apollo-properties': require('./rules/vue-no-undef-apollo-properties.js'),
|
|
23
|
+
'vue-prefer-dollar-scopedslots': require('./rules/vue-prefer-dollar-scopedslots.js'),
|
|
24
|
+
'vue-require-i18n-attribute-strings': require('./rules/vue-require-i18n-attribute-strings.js'),
|
|
25
|
+
'vue-require-i18n-strings': require('./rules/vue-require-i18n-strings.js'),
|
|
26
|
+
'vue-require-required-key': require('./rules/vue-require-required-key.js'),
|
|
27
|
+
'vue-require-valid-i18n-helpers': require('./rules/vue-require-valid-i18n-helpers.js'),
|
|
28
|
+
'vue-slot-name-casing': require('./rules/vue-slot-name-casing.js'),
|
|
29
|
+
'vue-tailwind-no-interpolation': require('./rules/vue-tailwind-no-interpolation.js'),
|
|
30
|
+
'vue-tailwind-no-max-width-media-queries': require('./rules/vue-tailwind-no-max-width-media-queries.js'),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const prettierConfig = require('eslint-config-prettier');
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
eslint-config-prettier v10 also turns off `@stylistic/*` rules. This package
|
|
5
|
+
does not register that plugin, so those 180 entries are dropped. Consumers
|
|
6
|
+
using `@stylistic` should apply eslint-config-prettier themselves.
|
|
7
|
+
*/
|
|
8
|
+
module.exports = Object.fromEntries(
|
|
9
|
+
Object.entries(prettierConfig.rules).filter(([rule]) => !rule.startsWith('@stylistic/')),
|
|
10
|
+
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Requirements
|
|
3
3
|
// ------------------------------------------------------------------------------
|
|
4
4
|
const { DOCS_BASE_URL } = require('../constants');
|
|
5
|
-
const utils = require('eslint-plugin-vue/
|
|
5
|
+
const utils = require('eslint-plugin-vue/dist/utils').default;
|
|
6
6
|
|
|
7
7
|
// ------------------------------------------------------------------------------
|
|
8
8
|
// Rule Definition
|
|
@@ -30,7 +30,10 @@ module.exports = {
|
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
32
|
...utils.executeOnVue(context, (node, type) => {
|
|
33
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
type === 'definition' &&
|
|
35
|
+
utils.getVueComponentDefinitionType(context, node) === 'mixin'
|
|
36
|
+
) {
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ------------------------------------------------------------------------------
|
|
2
2
|
// Requirements
|
|
3
3
|
// ------------------------------------------------------------------------------
|
|
4
|
-
const utils = require('eslint-plugin-vue/
|
|
4
|
+
const utils = require('eslint-plugin-vue/dist/utils').default;
|
|
5
5
|
const { pickBy, identity } = require('lodash');
|
|
6
6
|
const { DOCS_BASE_URL } = require('../constants');
|
|
7
7
|
const { closest, NODE_TYPES } = require('../utils/rule-utils');
|