@fewangsit/eslint-config-vue-code-standard 1.0.2

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 (3) hide show
  1. package/index.cjs +324 -0
  2. package/index.js +294 -0
  3. package/package.json +30 -0
package/index.cjs ADDED
@@ -0,0 +1,324 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ default: () => index_default
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+ var import_compat = require("@eslint/compat");
36
+ var import_js = __toESM(require("@eslint/js"), 1);
37
+ var import_eslint_plugin_css = __toESM(require("eslint-plugin-css"), 1);
38
+ var import_eslint_plugin_cypress = __toESM(require("eslint-plugin-cypress"), 1);
39
+ var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
40
+ var import_recommended = __toESM(require("eslint-plugin-prettier/recommended"), 1);
41
+ var import_eslint_plugin_promise = __toESM(require("eslint-plugin-promise"), 1);
42
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
43
+ var import_globals = __toESM(require("globals"), 1);
44
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
45
+
46
+ // rules/cypress.js
47
+ var cypress_default = {
48
+ "cypress/no-force": "error",
49
+ "promise/catch-or-return": "off",
50
+ "promise/always-return": "off",
51
+ "promise/prefer-await-to-then": "off"
52
+ };
53
+
54
+ // rules/import.js
55
+ var import_default = {
56
+ "import/newline-after-import": ["error", { count: 1 }],
57
+ "import/order": [
58
+ "error",
59
+ {
60
+ "groups": [
61
+ ["builtin", "external"],
62
+ ["internal"],
63
+ ["parent", "sibling", "index"]
64
+ ],
65
+ "named": true,
66
+ "newlines-between": "always",
67
+ "alphabetize": { order: "asc", caseInsensitive: true }
68
+ }
69
+ ]
70
+ };
71
+
72
+ // rules/vue.js
73
+ var vue_default = {
74
+ "vue/attributes-order": [
75
+ "error",
76
+ {
77
+ order: [
78
+ ["GLOBAL", "UNIQUE", "SLOT"],
79
+ "DEFINITION",
80
+ "CONDITIONALS",
81
+ "LIST_RENDERING",
82
+ "RENDER_MODIFIERS",
83
+ "CONTENT",
84
+ "TWO_WAY_BINDING",
85
+ "OTHER_DIRECTIVES",
86
+ "ATTR_DYNAMIC",
87
+ "EVENTS",
88
+ ["ATTR_SHORTHAND_BOOL", "ATTR_STATIC"]
89
+ ],
90
+ alphabetical: true
91
+ }
92
+ ],
93
+ "vue/block-lang": ["error", { script: { lang: "ts" } }],
94
+ "vue/block-order": [
95
+ "error",
96
+ {
97
+ order: ["script[setup]", "script", "template", "style"]
98
+ }
99
+ ],
100
+ "vue/custom-event-name-casing": "error",
101
+ "vue/define-emits-declaration": ["error", "type-based"],
102
+ "vue/define-macros-order": [
103
+ "error",
104
+ {
105
+ order: ["defineProps", "defineEmits", "defineModel"],
106
+ defineExposeLast: true
107
+ }
108
+ ],
109
+ "vue/define-props-declaration": ["error", "type-based"],
110
+ "vue/html-comment-content-newline": "error",
111
+ "vue/html-self-closing": [
112
+ "error",
113
+ {
114
+ html: {
115
+ void: "always",
116
+ normal: "always",
117
+ component: "always"
118
+ },
119
+ svg: "always",
120
+ math: "always"
121
+ }
122
+ ],
123
+ "vue/max-attributes-per-line": "off",
124
+ "vue/multi-word-component-names": "off",
125
+ "vue/new-line-between-multi-line-property": "error",
126
+ "vue/next-tick-style": ["error", "callback"],
127
+ "vue/no-dupe-keys": "error",
128
+ "vue/no-export-in-script-setup": "error",
129
+ "vue/no-lone-template": "error",
130
+ "vue/no-reserved-component-names": "error",
131
+ "vue/no-spaces-around-equal-signs-in-attribute": ["error"],
132
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
133
+ "vue/no-unused-emit-declarations": "error",
134
+ "vue/no-unused-refs": "error",
135
+ "vue/no-useless-v-bind": [
136
+ "error",
137
+ { ignoreIncludesComment: false, ignoreStringEscape: false }
138
+ ],
139
+ "vue/padding-line-between-blocks": ["error", "always"],
140
+ "vue/prefer-import-from-vue": "error",
141
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
142
+ "vue/prop-name-casing": ["error", "camelCase"],
143
+ "vue/require-explicit-emits": [
144
+ "error",
145
+ {
146
+ allowProps: false
147
+ }
148
+ ],
149
+ "vue/require-typed-ref": "error",
150
+ "vue/singleline-html-element-content-newline": "off",
151
+ "vue/v-on-event-hyphenation": [
152
+ "error",
153
+ "always",
154
+ {
155
+ autofix: true
156
+ }
157
+ ]
158
+ };
159
+
160
+ // index.js
161
+ var patchedImportPlugin = (0, import_compat.fixupPluginRules)(import_eslint_plugin_import.default);
162
+ var index_default = import_typescript_eslint.default.config(
163
+ // Base configs
164
+ import_js.default.configs.recommended,
165
+ ...import_typescript_eslint.default.configs.recommended,
166
+ ...import_eslint_plugin_vue.default.configs["flat/recommended"],
167
+ import_eslint_plugin_css.default.configs["flat/recommended"],
168
+ import_eslint_plugin_promise.default.configs["flat/recommended"],
169
+ import_recommended.default,
170
+ // Global Ignore
171
+ {
172
+ ignores: ["**/dist/**"]
173
+ },
174
+ // Config for import plugin (legacy)
175
+ {
176
+ plugins: { import: patchedImportPlugin },
177
+ settings: {
178
+ "import/resolver": {
179
+ typescript: true,
180
+ node: true
181
+ }
182
+ },
183
+ rules: {
184
+ ...import_eslint_plugin_import.default.configs.recommended.rules,
185
+ ...import_eslint_plugin_import.default.configs.typescript.rules,
186
+ ...import_default
187
+ }
188
+ },
189
+ // Config for Cypress
190
+ {
191
+ files: ["**/*.cy.spec.ts"],
192
+ plugins: { cypress: import_eslint_plugin_cypress.default },
193
+ rules: {
194
+ ...import_eslint_plugin_cypress.default.configs.recommended.rules,
195
+ ...cypress_default
196
+ },
197
+ languageOptions: {
198
+ ...import_eslint_plugin_cypress.default.configs.globals.languageOptions,
199
+ ...import_eslint_plugin_cypress.default.configs.recommended.languageOptions
200
+ }
201
+ },
202
+ // General setup
203
+ {
204
+ languageOptions: {
205
+ ecmaVersion: "latest",
206
+ sourceType: "module",
207
+ globals: {
208
+ ...import_globals.default.browser,
209
+ ...import_globals.default.node,
210
+ ...import_globals.default.es2021,
211
+ defineEmits: "readonly",
212
+ defineExpose: "readonly",
213
+ defineProps: "readonly",
214
+ withDefaults: "readonly"
215
+ },
216
+ parserOptions: {
217
+ parser: import_typescript_eslint.default.parser
218
+ }
219
+ }
220
+ },
221
+ // Rules overrides
222
+ {
223
+ rules: {
224
+ // Vue rules override
225
+ ...vue_default,
226
+ // Typescript Rules
227
+ "@typescript-eslint/explicit-function-return-type": "error",
228
+ "@typescript-eslint/explicit-module-boundary-types": "error",
229
+ "@typescript-eslint/naming-convention": [
230
+ "error",
231
+ {
232
+ format: ["PascalCase"],
233
+ selector: "interface"
234
+ },
235
+ {
236
+ format: ["PascalCase"],
237
+ selector: "typeAlias"
238
+ },
239
+ {
240
+ format: ["camelCase", "UPPER_CASE", "PascalCase"],
241
+ selector: "variable"
242
+ },
243
+ {
244
+ format: ["PascalCase"],
245
+ selector: "typeLike"
246
+ },
247
+ {
248
+ format: ["camelCase"],
249
+ selector: "function"
250
+ }
251
+ ],
252
+ "@typescript-eslint/no-explicit-any": "error",
253
+ "@typescript-eslint/no-non-null-assertion": "error",
254
+ "@typescript-eslint/no-shadow": "error",
255
+ // Standard Rules
256
+ "camelcase": "error",
257
+ "capitalized-comments": "error",
258
+ "complexity": ["error", 50],
259
+ "default-param-last": "error",
260
+ "func-style": ["error", "expression"],
261
+ "multiline-comment-style": "error",
262
+ "no-console": [
263
+ "error",
264
+ {
265
+ allow: ["error"]
266
+ }
267
+ ],
268
+ /*
269
+ * Note: process.env might not be available in flat config build time unless we use a define or just keep it as runtime check if it's evaluated at runtime.
270
+ * But tseslint.config is evaluated at runtime (when eslint runs).
271
+ */
272
+ "no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn",
273
+ "no-duplicate-imports": "error",
274
+ "no-else-return": "error",
275
+ "no-empty-function": "error",
276
+ "no-nested-ternary": "error",
277
+ "no-shadow": "off",
278
+ // Turned off in favor of @typescript-eslint/no-shadow
279
+ "no-unneeded-ternary": "error",
280
+ "no-useless-return": "error",
281
+ "no-var": "error",
282
+ "operator-assignment": "error",
283
+ "prefer-const": "error",
284
+ "prefer-destructuring": [
285
+ "error",
286
+ { array: false, object: true },
287
+ { enforceForRenamedProperties: false }
288
+ ],
289
+ "prettier/prettier": [
290
+ "error",
291
+ {
292
+ endOfLine: "auto",
293
+ quoteProps: "consistent",
294
+ semi: true,
295
+ singleQuote: true,
296
+ tabWidth: 2,
297
+ useTabs: false
298
+ }
299
+ ],
300
+ "promise/prefer-await-to-callbacks": "error",
301
+ "promise/prefer-await-to-then": "error",
302
+ "quotes": ["error", "single", { avoidEscape: true }]
303
+ }
304
+ },
305
+ // Specific overrides
306
+ {
307
+ files: [
308
+ "**/main.ts",
309
+ "**/components/{v1,v2}/index.ts",
310
+ "**/registerComponent.util.ts"
311
+ ],
312
+ rules: {
313
+ "vue/multi-word-component-names": "off",
314
+ "vue/no-reserved-component-names": "off"
315
+ }
316
+ },
317
+ {
318
+ files: ["vue.config.js"],
319
+ rules: {
320
+ "@typescript-eslint/no-var-requires": "off",
321
+ "@typescript-eslint/no-require-imports": "off"
322
+ }
323
+ }
324
+ );
package/index.js ADDED
@@ -0,0 +1,294 @@
1
+ // index.js
2
+ import { fixupPluginRules } from "@eslint/compat";
3
+ import js from "@eslint/js";
4
+ import css from "eslint-plugin-css";
5
+ import cypress from "eslint-plugin-cypress";
6
+ import importPlugin from "eslint-plugin-import";
7
+ import prettierRecommended from "eslint-plugin-prettier/recommended";
8
+ import promise from "eslint-plugin-promise";
9
+ import vue from "eslint-plugin-vue";
10
+ import globals from "globals";
11
+ import tseslint from "typescript-eslint";
12
+
13
+ // rules/cypress.js
14
+ var cypress_default = {
15
+ "cypress/no-force": "error",
16
+ "promise/catch-or-return": "off",
17
+ "promise/always-return": "off",
18
+ "promise/prefer-await-to-then": "off"
19
+ };
20
+
21
+ // rules/import.js
22
+ var import_default = {
23
+ "import/newline-after-import": ["error", { count: 1 }],
24
+ "import/order": [
25
+ "error",
26
+ {
27
+ "groups": [
28
+ ["builtin", "external"],
29
+ ["internal"],
30
+ ["parent", "sibling", "index"]
31
+ ],
32
+ "named": true,
33
+ "newlines-between": "always",
34
+ "alphabetize": { order: "asc", caseInsensitive: true }
35
+ }
36
+ ]
37
+ };
38
+
39
+ // rules/vue.js
40
+ var vue_default = {
41
+ "vue/attributes-order": [
42
+ "error",
43
+ {
44
+ order: [
45
+ ["GLOBAL", "UNIQUE", "SLOT"],
46
+ "DEFINITION",
47
+ "CONDITIONALS",
48
+ "LIST_RENDERING",
49
+ "RENDER_MODIFIERS",
50
+ "CONTENT",
51
+ "TWO_WAY_BINDING",
52
+ "OTHER_DIRECTIVES",
53
+ "ATTR_DYNAMIC",
54
+ "EVENTS",
55
+ ["ATTR_SHORTHAND_BOOL", "ATTR_STATIC"]
56
+ ],
57
+ alphabetical: true
58
+ }
59
+ ],
60
+ "vue/block-lang": ["error", { script: { lang: "ts" } }],
61
+ "vue/block-order": [
62
+ "error",
63
+ {
64
+ order: ["script[setup]", "script", "template", "style"]
65
+ }
66
+ ],
67
+ "vue/custom-event-name-casing": "error",
68
+ "vue/define-emits-declaration": ["error", "type-based"],
69
+ "vue/define-macros-order": [
70
+ "error",
71
+ {
72
+ order: ["defineProps", "defineEmits", "defineModel"],
73
+ defineExposeLast: true
74
+ }
75
+ ],
76
+ "vue/define-props-declaration": ["error", "type-based"],
77
+ "vue/html-comment-content-newline": "error",
78
+ "vue/html-self-closing": [
79
+ "error",
80
+ {
81
+ html: {
82
+ void: "always",
83
+ normal: "always",
84
+ component: "always"
85
+ },
86
+ svg: "always",
87
+ math: "always"
88
+ }
89
+ ],
90
+ "vue/max-attributes-per-line": "off",
91
+ "vue/multi-word-component-names": "off",
92
+ "vue/new-line-between-multi-line-property": "error",
93
+ "vue/next-tick-style": ["error", "callback"],
94
+ "vue/no-dupe-keys": "error",
95
+ "vue/no-export-in-script-setup": "error",
96
+ "vue/no-lone-template": "error",
97
+ "vue/no-reserved-component-names": "error",
98
+ "vue/no-spaces-around-equal-signs-in-attribute": ["error"],
99
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
100
+ "vue/no-unused-emit-declarations": "error",
101
+ "vue/no-unused-refs": "error",
102
+ "vue/no-useless-v-bind": [
103
+ "error",
104
+ { ignoreIncludesComment: false, ignoreStringEscape: false }
105
+ ],
106
+ "vue/padding-line-between-blocks": ["error", "always"],
107
+ "vue/prefer-import-from-vue": "error",
108
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
109
+ "vue/prop-name-casing": ["error", "camelCase"],
110
+ "vue/require-explicit-emits": [
111
+ "error",
112
+ {
113
+ allowProps: false
114
+ }
115
+ ],
116
+ "vue/require-typed-ref": "error",
117
+ "vue/singleline-html-element-content-newline": "off",
118
+ "vue/v-on-event-hyphenation": [
119
+ "error",
120
+ "always",
121
+ {
122
+ autofix: true
123
+ }
124
+ ]
125
+ };
126
+
127
+ // index.js
128
+ var patchedImportPlugin = fixupPluginRules(importPlugin);
129
+ var index_default = tseslint.config(
130
+ // Base configs
131
+ js.configs.recommended,
132
+ ...tseslint.configs.recommended,
133
+ ...vue.configs["flat/recommended"],
134
+ css.configs["flat/recommended"],
135
+ promise.configs["flat/recommended"],
136
+ prettierRecommended,
137
+ // Global Ignore
138
+ {
139
+ ignores: ["**/dist/**"]
140
+ },
141
+ // Config for import plugin (legacy)
142
+ {
143
+ plugins: { import: patchedImportPlugin },
144
+ settings: {
145
+ "import/resolver": {
146
+ typescript: true,
147
+ node: true
148
+ }
149
+ },
150
+ rules: {
151
+ ...importPlugin.configs.recommended.rules,
152
+ ...importPlugin.configs.typescript.rules,
153
+ ...import_default
154
+ }
155
+ },
156
+ // Config for Cypress
157
+ {
158
+ files: ["**/*.cy.spec.ts"],
159
+ plugins: { cypress },
160
+ rules: {
161
+ ...cypress.configs.recommended.rules,
162
+ ...cypress_default
163
+ },
164
+ languageOptions: {
165
+ ...cypress.configs.globals.languageOptions,
166
+ ...cypress.configs.recommended.languageOptions
167
+ }
168
+ },
169
+ // General setup
170
+ {
171
+ languageOptions: {
172
+ ecmaVersion: "latest",
173
+ sourceType: "module",
174
+ globals: {
175
+ ...globals.browser,
176
+ ...globals.node,
177
+ ...globals.es2021,
178
+ defineEmits: "readonly",
179
+ defineExpose: "readonly",
180
+ defineProps: "readonly",
181
+ withDefaults: "readonly"
182
+ },
183
+ parserOptions: {
184
+ parser: tseslint.parser
185
+ }
186
+ }
187
+ },
188
+ // Rules overrides
189
+ {
190
+ rules: {
191
+ // Vue rules override
192
+ ...vue_default,
193
+ // Typescript Rules
194
+ "@typescript-eslint/explicit-function-return-type": "error",
195
+ "@typescript-eslint/explicit-module-boundary-types": "error",
196
+ "@typescript-eslint/naming-convention": [
197
+ "error",
198
+ {
199
+ format: ["PascalCase"],
200
+ selector: "interface"
201
+ },
202
+ {
203
+ format: ["PascalCase"],
204
+ selector: "typeAlias"
205
+ },
206
+ {
207
+ format: ["camelCase", "UPPER_CASE", "PascalCase"],
208
+ selector: "variable"
209
+ },
210
+ {
211
+ format: ["PascalCase"],
212
+ selector: "typeLike"
213
+ },
214
+ {
215
+ format: ["camelCase"],
216
+ selector: "function"
217
+ }
218
+ ],
219
+ "@typescript-eslint/no-explicit-any": "error",
220
+ "@typescript-eslint/no-non-null-assertion": "error",
221
+ "@typescript-eslint/no-shadow": "error",
222
+ // Standard Rules
223
+ "camelcase": "error",
224
+ "capitalized-comments": "error",
225
+ "complexity": ["error", 50],
226
+ "default-param-last": "error",
227
+ "func-style": ["error", "expression"],
228
+ "multiline-comment-style": "error",
229
+ "no-console": [
230
+ "error",
231
+ {
232
+ allow: ["error"]
233
+ }
234
+ ],
235
+ /*
236
+ * Note: process.env might not be available in flat config build time unless we use a define or just keep it as runtime check if it's evaluated at runtime.
237
+ * But tseslint.config is evaluated at runtime (when eslint runs).
238
+ */
239
+ "no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn",
240
+ "no-duplicate-imports": "error",
241
+ "no-else-return": "error",
242
+ "no-empty-function": "error",
243
+ "no-nested-ternary": "error",
244
+ "no-shadow": "off",
245
+ // Turned off in favor of @typescript-eslint/no-shadow
246
+ "no-unneeded-ternary": "error",
247
+ "no-useless-return": "error",
248
+ "no-var": "error",
249
+ "operator-assignment": "error",
250
+ "prefer-const": "error",
251
+ "prefer-destructuring": [
252
+ "error",
253
+ { array: false, object: true },
254
+ { enforceForRenamedProperties: false }
255
+ ],
256
+ "prettier/prettier": [
257
+ "error",
258
+ {
259
+ endOfLine: "auto",
260
+ quoteProps: "consistent",
261
+ semi: true,
262
+ singleQuote: true,
263
+ tabWidth: 2,
264
+ useTabs: false
265
+ }
266
+ ],
267
+ "promise/prefer-await-to-callbacks": "error",
268
+ "promise/prefer-await-to-then": "error",
269
+ "quotes": ["error", "single", { avoidEscape: true }]
270
+ }
271
+ },
272
+ // Specific overrides
273
+ {
274
+ files: [
275
+ "**/main.ts",
276
+ "**/components/{v1,v2}/index.ts",
277
+ "**/registerComponent.util.ts"
278
+ ],
279
+ rules: {
280
+ "vue/multi-word-component-names": "off",
281
+ "vue/no-reserved-component-names": "off"
282
+ }
283
+ },
284
+ {
285
+ files: ["vue.config.js"],
286
+ rules: {
287
+ "@typescript-eslint/no-var-requires": "off",
288
+ "@typescript-eslint/no-require-imports": "off"
289
+ }
290
+ }
291
+ );
292
+ export {
293
+ index_default as default
294
+ };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@fewangsit/eslint-config-vue-code-standard",
3
+ "version": "1.0.2",
4
+ "description": "A shareable ESLint configuration for standardized Vue TypeScript code for Wangsti FE Developers.",
5
+ "type": "module",
6
+ "main": "index.cjs",
7
+ "author": "fewangsit",
8
+ "license": "proprietary",
9
+ "peerDependencies": {
10
+ "@typescript-eslint/eslint-plugin": ">=8.52.0",
11
+ "@typescript-eslint/parser": ">=8.52.0",
12
+ "eslint": ">=9.39.0",
13
+ "eslint-config-prettier": ">=10.1.0",
14
+ "eslint-import-resolver-typescript": ">=4.4.0",
15
+ "eslint-plugin-css": ">=0.11.0",
16
+ "eslint-plugin-cypress": ">=5.2.0",
17
+ "eslint-plugin-import": ">=2.31.0",
18
+ "eslint-plugin-prettier": ">=5.5.0",
19
+ "eslint-plugin-promise": ">=7.2.0",
20
+ "eslint-plugin-vue": ">=10.6.0",
21
+ "typescript": ">=5.5.0"
22
+ },
23
+ "module": "index.js",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./index.js",
27
+ "require": "./index.cjs"
28
+ }
29
+ }
30
+ }