@useinsider/eslint-config 1.0.0-beta.2 → 1.0.0-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/eslint-config",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "keywords": [
5
5
  "useinsider",
6
6
  "eslint",
package/src/rules/vue.cjs CHANGED
@@ -1,180 +1,166 @@
1
- /** @type {import("eslint").Linter.RulesRecord} */
2
- const vueRules = {
3
- 'vue/array-bracket-newline': ['error'],
4
- 'vue/array-bracket-spacing': ['error', 'never'],
5
- 'vue/arrow-spacing': ['error'],
6
- 'vue/attribute-hyphenation': ['error', 'always'],
7
- 'vue/attributes-order': ['error', {
8
- alphabetical: false,
9
- order: [
10
- 'DEFINITION',
11
- 'LIST_RENDERING',
12
- 'CONDITIONALS',
13
- 'RENDER_MODIFIERS',
14
- 'GLOBAL',
15
- 'UNIQUE',
16
- 'TWO_WAY_BINDING',
17
- 'OTHER_DIRECTIVES',
18
- 'OTHER_ATTR',
19
- 'EVENTS',
20
- 'CONTENT',
21
- ],
22
- }],
23
- 'vue/brace-style': ['error', '1tbs'],
24
- 'vue/comma-dangle': ['error', {
25
- arrays: 'always-multiline',
26
- exports: 'always-multiline',
27
- functions: 'never',
28
- imports: 'always-multiline',
29
- objects: 'always-multiline',
30
- }],
31
- 'vue/comma-spacing': ['error'],
32
- 'vue/comma-style': ['error', 'last'],
33
- 'vue/component-definition-name-casing': ['error', 'PascalCase'],
34
- 'vue/component-name-in-template-casing': ['error', 'PascalCase', {
35
- registeredComponentsOnly: false,
36
- ignores: [
37
- 'component',
38
- 'transition',
39
- ],
40
- }],
41
- 'vue/component-tags-order': ['error', {
42
- order: [
43
- 'script[setup]',
44
- 'template',
45
- 'script:not([setup])',
46
- 'style',
47
- ],
48
- }],
49
- 'vue/dot-location': ['error'],
50
- 'vue/dot-notation': ['error'],
51
- 'vue/eqeqeq': ['error'],
52
- 'vue/func-call-spacing': ['error'],
53
- 'vue/html-closing-bracket-newline': ['error', {
54
- multiline: 'never',
55
- singleline: 'never',
56
- }],
57
- 'vue/html-end-tags': ['error'],
58
- 'vue/html-indent': ['error', 4],
59
- 'vue/html-quotes': ['error', 'double'],
60
- 'vue/html-self-closing': ['error'],
61
- 'vue/html-closing-bracket-spacing': ['error'],
62
- 'vue/key-spacing': ['error'],
63
- 'vue/keyword-spacing': ['error'],
64
- 'vue/max-attributes-per-line': ['error', {
65
- multiline: {
66
- max: 1,
67
- },
68
- singleline: 1,
69
- }],
70
- 'vue/max-len': ['error', 120, {
71
- ignoreComments: true,
72
- ignoreRegExpLiterals: true,
73
- ignoreTemplateLiterals: true,
74
- ignoreTrailingComments: true,
75
- ignoreUrls: true,
76
- }],
77
- 'vue/multi-word-component-names': 'off',
78
- 'vue/mustache-interpolation-spacing': ['error', 'always'],
79
- 'vue/no-bare-strings-in-template': ['error'],
80
- 'vue/no-constant-condition': ['error'],
81
- 'vue/no-empty-component-block': ['error'],
82
- 'vue/no-empty-pattern': ['error'],
83
- 'vue/no-extra-parens': ['error'],
84
- 'vue/no-irregular-whitespace': ['error'],
85
- 'vue/no-multi-spaces': ['error'],
86
- 'vue/no-multiple-objects-in-class': ['error'],
87
- 'vue/no-potential-component-option-typo': ['error'],
88
- 'vue/no-reserved-component-names': ['error'],
89
- 'vue/no-restricted-syntax': ['error'],
90
- 'vue/no-spaces-around-equal-signs-in-attribute': ['error'],
91
- 'vue/no-sparse-arrays': ['error'],
92
- 'vue/no-undef-components': ['error'],
93
- 'vue/no-unsupported-features': ['error'],
94
- 'vue/no-unused-properties': ['error'],
95
- 'vue/no-unused-refs': ['error'],
96
- 'vue/no-use-computed-property-like-method': ['error'],
97
- 'vue/no-use-v-if-with-v-for': 'error',
98
- 'vue/no-useless-concat': ['error'],
99
- 'vue/no-useless-mustaches': ['error'],
100
- 'vue/no-useless-v-bind': ['error'],
101
- 'vue/no-v-text': ['error'],
102
- 'vue/object-curly-newline': ['error', {
103
- consistent: true,
104
- }],
105
- 'vue/object-curly-spacing': ['error', 'always'],
106
- 'vue/object-property-newline': ['error', {
107
- allowAllPropertiesOnSameLine: true,
108
- }],
109
- 'vue/object-shorthand': ['error', 'always'],
110
- 'vue/order-in-components': ['error', {
111
- order: [
112
- 'el',
113
- 'name',
114
- 'parent',
115
- 'functional',
116
- ['delimiters', 'comments'],
117
- ['components', 'directives', 'filters'],
118
- 'extends',
119
- 'mixins',
120
- 'inheritAttrs',
121
- 'model',
122
- ['props', 'propsData'],
123
- 'data',
124
- 'computed',
125
- 'watch',
126
- 'LIFECYCLE_HOOKS',
127
- 'methods',
128
- ['template', 'render'],
129
- 'renderError',
130
- ],
131
- }],
132
- 'vue/padding-line-between-blocks': ['error'],
133
- 'vue/prefer-separate-static-class': ['error'],
134
- 'vue/prefer-template': ['error'],
135
- 'vue/prefer-true-attribute-shorthand': ['error'],
136
- 'vue/prop-name-casing': ['error', 'camelCase'],
137
- 'vue/quote-props': ['error', 'as-needed'],
138
- 'vue/require-default-prop': ['error'],
139
- 'vue/require-prop-type-constructor': 'error',
140
- 'vue/require-prop-types': ['error'],
141
- 'vue/script-indent': ['error', 4, {
142
- switchCase: 1,
143
- }],
144
- 'vue/space-in-parens': ['error', 'never'],
145
- 'vue/space-infix-ops': ['error'],
146
- 'vue/space-unary-ops': ['error'],
147
- 'vue/template-curly-spacing': ['error'],
148
- 'vue/this-in-template': ['error', 'never'],
149
- 'vue/v-bind-style': ['error', 'shorthand'],
150
- 'vue/v-on-function-call': 'off',
151
- 'vue/v-on-style': ['error', 'shorthand'],
152
- 'vue/v-on-event-hyphenation': 'off',
153
- 'vue/no-setup-props-destructure': 'off',
154
- 'vue/block-tag-newline': ['error', {
155
- singleline: 'always',
156
- multiline: 'always',
157
- }],
158
- 'vue/require-explicit-emits': ['error'],
159
- 'vue/no-required-prop-with-default': ['error'],
160
- 'vue/no-ref-object-destructure': ['error'],
161
- 'vue/no-template-target-blank': ['error'],
162
- 'vue/define-emits-declaration': ['error', 'type-based'],
163
- 'vue/define-props-declaration': ['error', 'type-based'],
164
- };
165
-
166
- // Following rules will be refactored within SD-71639
167
- const vueCSSRules = {
168
- 'vue-scoped-css/enforce-style-type': 'off',
169
- 'vue-scoped-css/require-v-deep-argument': 'off',
170
- 'vue-scoped-css/no-unused-selector': 'off',
171
- 'vue-scoped-css/no-deprecated-deep-combinator': ['error'],
172
- };
173
-
174
1
  /** @type {import("eslint").Linter.Config} */
175
2
  module.exports = {
176
3
  rules: {
177
- ...vueRules,
178
- ...vueCSSRules,
4
+ 'vue/array-bracket-newline': ['error'],
5
+ 'vue/array-bracket-spacing': ['error', 'never'],
6
+ 'vue/arrow-spacing': ['error'],
7
+ 'vue/attribute-hyphenation': ['error', 'always'],
8
+ 'vue/attributes-order': ['error', {
9
+ alphabetical: false,
10
+ order: [
11
+ 'DEFINITION',
12
+ 'LIST_RENDERING',
13
+ 'CONDITIONALS',
14
+ 'RENDER_MODIFIERS',
15
+ 'GLOBAL',
16
+ 'UNIQUE',
17
+ 'TWO_WAY_BINDING',
18
+ 'OTHER_DIRECTIVES',
19
+ 'OTHER_ATTR',
20
+ 'EVENTS',
21
+ 'CONTENT',
22
+ ],
23
+ }],
24
+ 'vue/brace-style': ['error', '1tbs'],
25
+ 'vue/comma-dangle': ['error', {
26
+ arrays: 'always-multiline',
27
+ exports: 'always-multiline',
28
+ functions: 'never',
29
+ imports: 'always-multiline',
30
+ objects: 'always-multiline',
31
+ }],
32
+ 'vue/comma-spacing': ['error'],
33
+ 'vue/comma-style': ['error', 'last'],
34
+ 'vue/component-definition-name-casing': ['error', 'PascalCase'],
35
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase', {
36
+ registeredComponentsOnly: false,
37
+ ignores: [
38
+ 'component',
39
+ 'transition',
40
+ ],
41
+ }],
42
+ 'vue/component-tags-order': ['error', {
43
+ order: [
44
+ 'script[setup]',
45
+ 'template',
46
+ 'script:not([setup])',
47
+ 'style',
48
+ ],
49
+ }],
50
+ 'vue/dot-location': ['error'],
51
+ 'vue/dot-notation': ['error'],
52
+ 'vue/eqeqeq': ['error'],
53
+ 'vue/func-call-spacing': ['error'],
54
+ 'vue/html-closing-bracket-newline': ['error', {
55
+ multiline: 'never',
56
+ singleline: 'never',
57
+ }],
58
+ 'vue/html-end-tags': ['error'],
59
+ 'vue/html-indent': ['error', 4],
60
+ 'vue/html-quotes': ['error', 'double'],
61
+ 'vue/html-self-closing': ['error'],
62
+ 'vue/html-closing-bracket-spacing': ['error'],
63
+ 'vue/key-spacing': ['error'],
64
+ 'vue/keyword-spacing': ['error'],
65
+ 'vue/max-attributes-per-line': ['error', {
66
+ multiline: {
67
+ max: 1,
68
+ },
69
+ singleline: 1,
70
+ }],
71
+ 'vue/max-len': ['error', 120, {
72
+ ignoreComments: true,
73
+ ignoreRegExpLiterals: true,
74
+ ignoreTemplateLiterals: true,
75
+ ignoreTrailingComments: true,
76
+ ignoreUrls: true,
77
+ }],
78
+ 'vue/multi-word-component-names': 'off',
79
+ 'vue/mustache-interpolation-spacing': ['error', 'always'],
80
+ 'vue/no-bare-strings-in-template': ['error'],
81
+ 'vue/no-constant-condition': ['error'],
82
+ 'vue/no-empty-component-block': ['error'],
83
+ 'vue/no-empty-pattern': ['error'],
84
+ 'vue/no-extra-parens': ['error'],
85
+ 'vue/no-irregular-whitespace': ['error'],
86
+ 'vue/no-multi-spaces': ['error'],
87
+ 'vue/no-multiple-objects-in-class': ['error'],
88
+ 'vue/no-potential-component-option-typo': ['error'],
89
+ 'vue/no-reserved-component-names': ['error'],
90
+ 'vue/no-restricted-syntax': ['error'],
91
+ 'vue/no-spaces-around-equal-signs-in-attribute': ['error'],
92
+ 'vue/no-sparse-arrays': ['error'],
93
+ 'vue/no-undef-components': ['error'],
94
+ 'vue/no-unsupported-features': ['error'],
95
+ 'vue/no-unused-properties': ['error'],
96
+ 'vue/no-unused-refs': ['error'],
97
+ 'vue/no-use-computed-property-like-method': ['error'],
98
+ 'vue/no-use-v-if-with-v-for': 'error',
99
+ 'vue/no-useless-concat': ['error'],
100
+ 'vue/no-useless-mustaches': ['error'],
101
+ 'vue/no-useless-v-bind': ['error'],
102
+ 'vue/no-v-text': ['error'],
103
+ 'vue/object-curly-newline': ['error', {
104
+ consistent: true,
105
+ }],
106
+ 'vue/object-curly-spacing': ['error', 'always'],
107
+ 'vue/object-property-newline': ['error', {
108
+ allowAllPropertiesOnSameLine: true,
109
+ }],
110
+ 'vue/object-shorthand': ['error', 'always'],
111
+ 'vue/order-in-components': ['error', {
112
+ order: [
113
+ 'el',
114
+ 'name',
115
+ 'parent',
116
+ 'functional',
117
+ ['delimiters', 'comments'],
118
+ ['components', 'directives', 'filters'],
119
+ 'extends',
120
+ 'mixins',
121
+ 'inheritAttrs',
122
+ 'model',
123
+ ['props', 'propsData'],
124
+ 'data',
125
+ 'computed',
126
+ 'watch',
127
+ 'LIFECYCLE_HOOKS',
128
+ 'methods',
129
+ ['template', 'render'],
130
+ 'renderError',
131
+ ],
132
+ }],
133
+ 'vue/padding-line-between-blocks': ['error'],
134
+ 'vue/prefer-separate-static-class': ['error'],
135
+ 'vue/prefer-template': ['error'],
136
+ 'vue/prefer-true-attribute-shorthand': ['error'],
137
+ 'vue/prop-name-casing': ['error', 'camelCase'],
138
+ 'vue/quote-props': ['error', 'as-needed'],
139
+ 'vue/require-default-prop': ['error'],
140
+ 'vue/require-prop-type-constructor': 'error',
141
+ 'vue/require-prop-types': ['error'],
142
+ 'vue/script-indent': ['error', 4, {
143
+ switchCase: 1,
144
+ }],
145
+ 'vue/space-in-parens': ['error', 'never'],
146
+ 'vue/space-infix-ops': ['error'],
147
+ 'vue/space-unary-ops': ['error'],
148
+ 'vue/template-curly-spacing': ['error'],
149
+ 'vue/this-in-template': ['error', 'never'],
150
+ 'vue/v-bind-style': ['error', 'shorthand'],
151
+ 'vue/v-on-function-call': 'off',
152
+ 'vue/v-on-style': ['error', 'shorthand'],
153
+ 'vue/v-on-event-hyphenation': 'off',
154
+ 'vue/no-setup-props-destructure': 'off',
155
+ 'vue/block-tag-newline': ['error', {
156
+ singleline: 'always',
157
+ multiline: 'always',
158
+ }],
159
+ 'vue/require-explicit-emits': ['error'],
160
+ 'vue/no-required-prop-with-default': ['error'],
161
+ 'vue/no-ref-object-destructure': ['error'],
162
+ 'vue/no-template-target-blank': ['error'],
163
+ 'vue/define-emits-declaration': ['error', 'type-based'],
164
+ 'vue/define-props-declaration': ['error', 'type-based'],
179
165
  },
180
166
  };
@@ -62,3 +62,24 @@ module.exports = {
62
62
  ],
63
63
  };
64
64
  ```
65
+
66
+ ### Vue Extension Configuration
67
+
68
+ To properly lint `.vue` files imported within `.ts` files, it's essential to
69
+ update the `parserOptions` in your ESLint configuration. This adjustment helps
70
+ prevent ESLint errors that may arise due to the import of Vue components. Add
71
+ the following configuration to your `.eslintrc` file:
72
+
73
+ ```js
74
+ {
75
+ // Existing configuration...
76
+ parserOptions: {
77
+ // Other existing parser options...
78
+ extraFileExtensions: ['.vue'], // Add this line
79
+ },
80
+ },
81
+ ```
82
+
83
+ This change ensures that ESLint correctly processes .vue files alongside
84
+ TypeScript files, maintaining consistent code quality and style across your
85
+ project.