@gitlab/eslint-plugin 21.5.0 → 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/README.md +16 -11
  3. package/docs/development.md +2 -1
  4. package/docs/usage.md +158 -47
  5. package/eslint9/index.js +6 -7
  6. package/lib/configs/base/best-practices.js +0 -4
  7. package/lib/configs/base/es6.js +0 -12
  8. package/lib/configs/base/imports.js +0 -9
  9. package/lib/configs/base/node.js +0 -4
  10. package/lib/confusing-browser-globals.js +68 -0
  11. package/lib/flat-configs/base.js +122 -0
  12. package/lib/flat-configs/default.js +13 -0
  13. package/lib/flat-configs/i18n.js +14 -0
  14. package/lib/flat-configs/jest.js +20 -0
  15. package/lib/flat-configs/tailwind.js +19 -0
  16. package/{eslint9/configs → lib/flat-configs}/typescript.js +47 -62
  17. package/lib/flat-configs/vue.js +16 -0
  18. package/lib/index.js +30 -39
  19. package/lib/plugin.js +32 -0
  20. package/lib/prettier-rules.js +10 -0
  21. package/lib/rules/no-runtime-template-compiler.js +5 -2
  22. package/lib/rules/vue-no-new-non-primitive-in-template.js +1 -1
  23. package/lib/rules/vue-no-undef-apollo-properties.js +1 -1
  24. package/lib/rules/vue-prefer-dollar-scopedslots.js +1 -1
  25. package/lib/rules/vue-require-required-key.js +1 -1
  26. package/lib/rules/vue-slot-name-casing.js +2 -2
  27. package/lib/vue-fragments.js +111 -0
  28. package/package.json +29 -11
  29. package/scripts/generateRuleMapFixtures.js +75 -0
  30. package/scripts/helpers/getConfigs.js +13 -6
  31. package/scripts/updateFiles.js +30 -6
  32. package/eslint9/configs/base.js +0 -140
  33. package/lib/configs/base.js +0 -115
  34. package/lib/configs/default.js +0 -17
  35. package/lib/configs/i18n.js +0 -10
  36. package/lib/configs/jest.js +0 -21
  37. package/lib/configs/tailwind.js +0 -10
  38. package/lib/configs/typescript.js +0 -95
  39. package/lib/configs/vue.js +0 -91
@@ -1,95 +0,0 @@
1
- const baseConfig = require('./base');
2
-
3
- const tsConfig = {
4
- env: {
5
- mocha: true,
6
- jest: true,
7
- },
8
- parserOptions: baseConfig.parserOptions,
9
- extends: [...baseConfig.extends],
10
- plugins: [...baseConfig.plugins],
11
- rules: {
12
- ...baseConfig.rules,
13
- 'import/extensions': [
14
- 'error',
15
- 'ignorePackages',
16
- {
17
- js: 'never',
18
- jsx: 'never',
19
- ts: 'never',
20
- tsx: 'never',
21
- },
22
- ],
23
- },
24
- overrides: [
25
- {
26
- files: ['**/*.ts'],
27
- parserOptions: {
28
- parser: '@typescript-eslint/parser',
29
- project: ['./tsconfig.json'],
30
- },
31
- plugins: ['@typescript-eslint', 'import'],
32
- extends: [
33
- 'eslint:recommended',
34
- 'plugin:@typescript-eslint/strict',
35
- 'plugin:import/typescript',
36
- ],
37
- reportUnusedDisableDirectives: true,
38
- rules: {
39
- semi: [2, 'always'],
40
- 'max-params': 'off',
41
- 'no-throw-literal': 'off',
42
- 'no-shadow': 'off',
43
- 'no-empty-function': 'off',
44
- 'no-plusplus': 'off',
45
- 'unicorn/no-array-callback-reference': 'off',
46
- '@typescript-eslint/no-throw-literal': 'error',
47
- '@typescript-eslint/no-unused-vars': 'error',
48
- '@typescript-eslint/no-shadow': 'error',
49
- '@typescript-eslint/return-await': 'error',
50
- '@typescript-eslint/no-floating-promises': 'error',
51
- '@typescript-eslint/explicit-member-accessibility': [
52
- 'error',
53
- {
54
- accessibility: 'no-public',
55
- },
56
- ],
57
- 'class-methods-use-this': 'off',
58
- 'import/no-cycle': 'error',
59
- 'promise/param-names': 'off',
60
- 'no-use-before-define': ['warn', 'nofunc'],
61
- 'no-restricted-syntax': [
62
- 'error',
63
- {
64
- selector: ':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
65
- message: 'Use # prefix instead of `private` to indicate private class members.',
66
- },
67
- {
68
- selector: 'ForInStatement',
69
- message:
70
- 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
71
- },
72
- {
73
- selector: 'LabeledStatement',
74
- message:
75
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
76
- },
77
- {
78
- selector: 'WithStatement',
79
- message:
80
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
81
- },
82
- ],
83
- },
84
- },
85
- {
86
- files: ['*.test.ts', '*.test.js'],
87
- rules: {
88
- 'max-classes-per-file': 'off',
89
- '@typescript-eslint/no-non-null-assertion': 'off',
90
- },
91
- },
92
- ],
93
- };
94
-
95
- module.exports = tsConfig;
@@ -1,91 +0,0 @@
1
- /*
2
- This plugin contains rules related to GitLab Vue style guide
3
- base JavaScript rules are in lib/configs/base.js
4
- */
5
-
6
- module.exports = {
7
- env: {
8
- browser: true,
9
- es2020: true,
10
- },
11
- extends: ['plugin:vue/recommended', 'prettier'],
12
- parserOptions: {
13
- parser: 'espree',
14
- ecmaVersion: 'latest',
15
- },
16
- plugins: ['unicorn', 'promise', 'import', '@gitlab'],
17
- rules: {
18
- 'vue/html-self-closing': [
19
- 'error',
20
- {
21
- html: {
22
- void: 'any',
23
- normal: 'never',
24
- component: 'always',
25
- },
26
- svg: 'always',
27
- math: 'always',
28
- },
29
- ],
30
- 'vue/component-tags-order': [
31
- 'error',
32
- {
33
- order: ['script', 'template', 'style'],
34
- },
35
- ],
36
- // Turning this off for now as we violate this rule in many places.
37
- 'vue/max-attributes-per-line': 'off',
38
- 'vue/component-options-name-casing': ['error', 'PascalCase'],
39
- 'vue/component-name-in-template-casing': ['error', 'kebab-case'],
40
- '@gitlab/vue-require-required-key': 'error',
41
- 'vue/v-slot-style': [
42
- 'error',
43
- {
44
- atComponent: 'shorthand',
45
- },
46
- ],
47
- '@gitlab/vue-no-data-toggle': 'error',
48
- '@gitlab/vue-no-popover-target-dollar-el': 'warn',
49
- '@gitlab/vue-prefer-dollar-scopedslots': 'error',
50
- '@gitlab/vue-slot-name-casing': 'error',
51
- '@gitlab/no-runtime-template-compiler': 'error',
52
- 'import/order': [
53
- 'error',
54
- {
55
- groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
56
- },
57
- ],
58
- // See https://gitlab.com/gitlab-org/frontend/eslint-plugin/-/issues/52.
59
- 'vue/component-api-style': ['error', ['options']],
60
- // We might not want to enable vue/singleline-html-element-content-newline and vue/multiline-html-element-content-newline
61
- // just yet as they might cause regression depending on how the consumers compile Vue templates.
62
- 'vue/singleline-html-element-content-newline': 'off',
63
- 'vue/multiline-html-element-content-newline': 'off',
64
- // Disabling these as they might conflict with prettier.
65
- 'vue/html-indent': 'off',
66
- 'vue/html-closing-bracket-newline': 'off',
67
- // BEGIN rules to aid migration from Vue 2.x to 3.x.
68
- // See https://gitlab.com/groups/gitlab-org/-/epics/3174 for more details.
69
- 'vue/no-deprecated-data-object-declaration': 'error',
70
- 'vue/no-deprecated-events-api': 'error',
71
- 'vue/no-deprecated-filter': 'error',
72
- 'vue/no-deprecated-functional-template': 'error',
73
- 'vue/no-deprecated-html-element-is': 'error',
74
- 'vue/no-deprecated-inline-template': 'error',
75
- 'vue/no-deprecated-props-default-this': 'error',
76
- 'vue/no-deprecated-scope-attribute': 'error',
77
- 'vue/no-deprecated-slot-attribute': 'error',
78
- 'vue/no-deprecated-slot-scope-attribute': 'error',
79
- 'vue/no-deprecated-v-on-number-modifiers': 'error',
80
- 'vue/no-deprecated-vue-config-keycodes': 'error',
81
- // END rules to aid migration from Vue 2.x to 3.x.
82
- },
83
- overrides: [
84
- {
85
- files: ['**/*.vue'],
86
- rules: {
87
- 'import/no-default-export': 'off',
88
- },
89
- },
90
- ],
91
- };