@shayanthenerd/eslint-config 0.1.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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +496 -0
  3. package/dist/_virtual/rolldown_runtime.cjs +30 -0
  4. package/dist/configs/base.cjs +44 -0
  5. package/dist/configs/base.js +43 -0
  6. package/dist/configs/commons.cjs +26 -0
  7. package/dist/configs/commons.js +25 -0
  8. package/dist/configs/css.cjs +29 -0
  9. package/dist/configs/css.js +28 -0
  10. package/dist/configs/cypress.cjs +23 -0
  11. package/dist/configs/cypress.js +22 -0
  12. package/dist/configs/html.cjs +23 -0
  13. package/dist/configs/html.js +22 -0
  14. package/dist/configs/importX.cjs +26 -0
  15. package/dist/configs/importX.js +25 -0
  16. package/dist/configs/nuxtMultiRootTemplate.cjs +14 -0
  17. package/dist/configs/nuxtMultiRootTemplate.js +14 -0
  18. package/dist/configs/oxlintOverrides.cjs +49 -0
  19. package/dist/configs/oxlintOverrides.js +48 -0
  20. package/dist/configs/perfectionist.cjs +24 -0
  21. package/dist/configs/perfectionist.js +23 -0
  22. package/dist/configs/playwright.cjs +23 -0
  23. package/dist/configs/playwright.js +22 -0
  24. package/dist/configs/storybook.cjs +24 -0
  25. package/dist/configs/storybook.js +23 -0
  26. package/dist/configs/stylistic.cjs +23 -0
  27. package/dist/configs/stylistic.js +22 -0
  28. package/dist/configs/tailwind.cjs +43 -0
  29. package/dist/configs/tailwind.js +42 -0
  30. package/dist/configs/typescript.cjs +31 -0
  31. package/dist/configs/typescript.js +30 -0
  32. package/dist/configs/vitest.cjs +23 -0
  33. package/dist/configs/vitest.js +22 -0
  34. package/dist/configs/vue.cjs +35 -0
  35. package/dist/configs/vue.js +34 -0
  36. package/dist/configs/vueComponentNames.cjs +19 -0
  37. package/dist/configs/vueComponentNames.js +19 -0
  38. package/dist/index.cjs +55 -0
  39. package/dist/index.d.cts +16 -0
  40. package/dist/index.d.ts +16 -0
  41. package/dist/index.js +54 -0
  42. package/dist/oxlint.config.jsonc +192 -0
  43. package/dist/prettier.config.js +42 -0
  44. package/dist/rules/css.cjs +65 -0
  45. package/dist/rules/css.js +65 -0
  46. package/dist/rules/cypress.cjs +16 -0
  47. package/dist/rules/cypress.js +15 -0
  48. package/dist/rules/html.cjs +53 -0
  49. package/dist/rules/html.js +53 -0
  50. package/dist/rules/importX.cjs +51 -0
  51. package/dist/rules/importX.js +50 -0
  52. package/dist/rules/javascript.cjs +164 -0
  53. package/dist/rules/javascript.js +163 -0
  54. package/dist/rules/perfectionist.cjs +73 -0
  55. package/dist/rules/perfectionist.js +73 -0
  56. package/dist/rules/playwright.cjs +28 -0
  57. package/dist/rules/playwright.js +27 -0
  58. package/dist/rules/storybook.cjs +16 -0
  59. package/dist/rules/storybook.js +15 -0
  60. package/dist/rules/stylistic.cjs +160 -0
  61. package/dist/rules/stylistic.js +160 -0
  62. package/dist/rules/tailwind.cjs +36 -0
  63. package/dist/rules/tailwind.js +36 -0
  64. package/dist/rules/typescript.cjs +62 -0
  65. package/dist/rules/typescript.js +62 -0
  66. package/dist/rules/vitest.cjs +47 -0
  67. package/dist/rules/vitest.js +46 -0
  68. package/dist/rules/vue.cjs +169 -0
  69. package/dist/rules/vue.js +169 -0
  70. package/dist/rules/vueAccessibility.cjs +23 -0
  71. package/dist/rules/vueAccessibility.js +23 -0
  72. package/dist/types/configOptions/base.d.cts +47 -0
  73. package/dist/types/configOptions/base.d.ts +47 -0
  74. package/dist/types/configOptions/css.d.cts +27 -0
  75. package/dist/types/configOptions/css.d.ts +27 -0
  76. package/dist/types/configOptions/html.d.cts +27 -0
  77. package/dist/types/configOptions/html.d.ts +27 -0
  78. package/dist/types/configOptions/importX.d.cts +20 -0
  79. package/dist/types/configOptions/importX.d.ts +20 -0
  80. package/dist/types/configOptions/nuxt.d.cts +42 -0
  81. package/dist/types/configOptions/nuxt.d.ts +42 -0
  82. package/dist/types/configOptions/perfectionist.d.cts +16 -0
  83. package/dist/types/configOptions/perfectionist.d.ts +16 -0
  84. package/dist/types/configOptions/stylistic.d.cts +145 -0
  85. package/dist/types/configOptions/stylistic.d.ts +145 -0
  86. package/dist/types/configOptions/tailwind.d.cts +46 -0
  87. package/dist/types/configOptions/tailwind.d.ts +46 -0
  88. package/dist/types/configOptions/test.d.cts +55 -0
  89. package/dist/types/configOptions/test.d.ts +55 -0
  90. package/dist/types/configOptions/typescript.d.cts +36 -0
  91. package/dist/types/configOptions/typescript.d.ts +36 -0
  92. package/dist/types/configOptions/vue.d.cts +211 -0
  93. package/dist/types/configOptions/vue.d.ts +211 -0
  94. package/dist/types/configOptions/vueAccessibility.d.cts +34 -0
  95. package/dist/types/configOptions/vueAccessibility.d.ts +34 -0
  96. package/dist/types/eslint-schema.d.cts +13258 -0
  97. package/dist/types/eslint-schema.d.ts +13258 -0
  98. package/dist/types/eslintRules.d.cts +12 -0
  99. package/dist/types/eslintRules.d.ts +12 -0
  100. package/dist/types/helpers.d.cts +5 -0
  101. package/dist/types/helpers.d.ts +5 -0
  102. package/dist/types/index.d.cts +360 -0
  103. package/dist/types/index.d.ts +360 -0
  104. package/dist/utils/globs.cjs +31 -0
  105. package/dist/utils/globs.js +30 -0
  106. package/dist/utils/ignores/defaultIgnorePatterns.cjs +58 -0
  107. package/dist/utils/ignores/defaultIgnorePatterns.js +57 -0
  108. package/dist/utils/ignores/getIgnorePatterns.cjs +16 -0
  109. package/dist/utils/ignores/getIgnorePatterns.js +16 -0
  110. package/dist/utils/ignores/resolveGitignorePatterns.cjs +27 -0
  111. package/dist/utils/ignores/resolveGitignorePatterns.js +26 -0
  112. package/dist/utils/isEmptyString.cjs +8 -0
  113. package/dist/utils/isEmptyString.js +7 -0
  114. package/dist/utils/isEnabled.cjs +8 -0
  115. package/dist/utils/isEnabled.js +7 -0
  116. package/dist/utils/isPackageDetected.cjs +22 -0
  117. package/dist/utils/isPackageDetected.js +20 -0
  118. package/dist/utils/options/defaultOptions.cjs +168 -0
  119. package/dist/utils/options/defaultOptions.js +167 -0
  120. package/dist/utils/options/enableDetectedConfigs.cjs +36 -0
  121. package/dist/utils/options/enableDetectedConfigs.js +36 -0
  122. package/dist/utils/options/mergeWithDefaults.cjs +22 -0
  123. package/dist/utils/options/mergeWithDefaults.js +21 -0
  124. package/dist/utils/vue/getRestrictedVueElements.cjs +28 -0
  125. package/dist/utils/vue/getRestrictedVueElements.js +27 -0
  126. package/dist/utils/vue/getRestrictedVueInputs.cjs +24 -0
  127. package/dist/utils/vue/getRestrictedVueInputs.js +23 -0
  128. package/package.json +130 -0
@@ -0,0 +1,160 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/stylistic.ts
5
+ function getStylisticRules(options) {
6
+ const { stylistic } = options.configs;
7
+ const { semi, quotes, indent, useTabs, jsxQuotes, arrowParens, trailingComma, maxLineLength, memberDelimiterStyle, maxConsecutiveEmptyLines } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
8
+ const stylisticRules = {
9
+ "@stylistic/wrap-regex": "warn",
10
+ "@stylistic/semi-style": "warn",
11
+ "@stylistic/semi": ["warn", semi],
12
+ "@stylistic/spaced-comment": "off",
13
+ "@stylistic/no-extra-semi": "warn",
14
+ "@stylistic/linebreak-style": "warn",
15
+ "@stylistic/quotes": ["warn", quotes],
16
+ "@stylistic/no-confusing-arrow": "warn",
17
+ "@stylistic/switch-colon-spacing": "warn",
18
+ "@stylistic/jsx-quotes": ["warn", jsxQuotes],
19
+ "@stylistic/type-annotation-spacing": "warn",
20
+ "@stylistic/no-tabs": useTabs ? "off" : "warn",
21
+ "@stylistic/lines-between-class-members": "off",
22
+ "@stylistic/arrow-parens": ["warn", arrowParens],
23
+ "@stylistic/comma-dangle": ["warn", trailingComma],
24
+ "@stylistic/object-curly-spacing": ["warn", "always"],
25
+ "@stylistic/nonblock-statement-body-position": "error",
26
+ "@stylistic/generator-star-spacing": ["warn", "after"],
27
+ "@stylistic/implicit-arrow-linebreak": ["error", "beside"],
28
+ "@stylistic/array-bracket-newline": ["warn", "consistent"],
29
+ "@stylistic/no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
30
+ "@stylistic/indent-binary-ops": ["warn", useTabs ? "tab" : indent],
31
+ "@stylistic/function-call-argument-newline": ["warn", "consistent"],
32
+ "@stylistic/brace-style": [
33
+ "warn",
34
+ "1tbs",
35
+ { allowSingleLine: true }
36
+ ],
37
+ "@stylistic/padded-blocks": [
38
+ "error",
39
+ "never",
40
+ { allowSingleLineBlocks: true }
41
+ ],
42
+ "@stylistic/object-property-newline": ["warn", { allowAllPropertiesOnSameLine: true }],
43
+ "@stylistic/indent": [
44
+ "warn",
45
+ useTabs ? "tab" : indent,
46
+ { tabLength: indent }
47
+ ],
48
+ "@stylistic/max-len": ["warn", {
49
+ tabWidth: indent,
50
+ code: maxLineLength,
51
+ ignoreUrls: true,
52
+ ignoreStrings: true,
53
+ ignoreComments: true,
54
+ ignoreRegExpLiterals: true,
55
+ ignoreTrailingComments: true,
56
+ ignoreTemplateLiterals: true
57
+ }],
58
+ "@stylistic/object-curly-newline": ["warn", {
59
+ multiline: true,
60
+ consistent: true
61
+ }],
62
+ "@stylistic/lines-around-comment": ["warn", {
63
+ allowTypeStart: true,
64
+ allowEnumStart: true,
65
+ allowClassStart: true,
66
+ allowBlockStart: true,
67
+ allowArrayStart: true,
68
+ allowModuleStart: true,
69
+ allowObjectStart: true,
70
+ allowInterfaceStart: true
71
+ }],
72
+ "@stylistic/no-multiple-empty-lines": ["warn", {
73
+ maxBOF: 0,
74
+ maxEOF: 0,
75
+ max: maxConsecutiveEmptyLines
76
+ }],
77
+ "@stylistic/member-delimiter-style": ["error", {
78
+ singleline: { delimiter: memberDelimiterStyle },
79
+ multiline: {
80
+ delimiter: memberDelimiterStyle,
81
+ requireLast: trailingComma !== "never"
82
+ }
83
+ }],
84
+ "@stylistic/operator-linebreak": [
85
+ "error",
86
+ "none",
87
+ { overrides: {
88
+ "=": "after",
89
+ "?": "before",
90
+ ":": "before",
91
+ "|": "before",
92
+ "&": "before"
93
+ } }
94
+ ],
95
+ "@stylistic/padding-line-between-statements": [
96
+ "warn",
97
+ {
98
+ prev: "*",
99
+ next: [
100
+ "do",
101
+ "try",
102
+ "for",
103
+ "iife",
104
+ "with",
105
+ "class",
106
+ "block",
107
+ "while",
108
+ "throw",
109
+ "return",
110
+ "switch",
111
+ "export",
112
+ "function",
113
+ "directive",
114
+ "block-like",
115
+ "cjs-export",
116
+ "multiline-block-like"
117
+ ],
118
+ blankLine: "always"
119
+ },
120
+ {
121
+ prev: "import",
122
+ next: "*",
123
+ blankLine: "always"
124
+ },
125
+ {
126
+ prev: "import",
127
+ next: "import",
128
+ blankLine: "any"
129
+ },
130
+ {
131
+ prev: "export",
132
+ next: "export",
133
+ blankLine: "any"
134
+ },
135
+ {
136
+ prev: "function-overload",
137
+ next: "function",
138
+ blankLine: "never"
139
+ },
140
+ {
141
+ prev: [
142
+ "const",
143
+ "let",
144
+ "var"
145
+ ],
146
+ next: "block-like",
147
+ blankLine: "any"
148
+ },
149
+ {
150
+ prev: "block-like",
151
+ next: "*",
152
+ blankLine: "always"
153
+ }
154
+ ]
155
+ };
156
+ return stylisticRules;
157
+ }
158
+
159
+ //#endregion
160
+ export { getStylisticRules };
@@ -0,0 +1,36 @@
1
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
2
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
3
+
4
+ //#region src/rules/tailwind.ts
5
+ function getTailwindRules(options) {
6
+ const { tailwind, stylistic } = options.configs;
7
+ const { multilineSort, ignoredUnregisteredClasses: userIgnoredUnregisteredClasses } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(tailwind) ? tailwind : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.tailwind;
8
+ const { indent, useTabs, maxLineLength } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(stylistic) ? stylistic : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.stylistic;
9
+ const isTailwindV4 = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(tailwind) && tailwind.entryPoint;
10
+ const tailwindRules = {
11
+ "vue/max-len": "off",
12
+ "@stylistic/max-len": "off",
13
+ "css/no-duplicate-imports": "off",
14
+ "better-tailwindcss/no-duplicate-classes": "error",
15
+ "better-tailwindcss/no-deprecated-classes": "error",
16
+ "better-tailwindcss/no-conflicting-classes": "error",
17
+ "better-tailwindcss/enforce-shorthand-classes": "warn",
18
+ "better-tailwindcss/no-unnecessary-whitespace": "warn",
19
+ "better-tailwindcss/enforce-consistent-class-order": "warn",
20
+ "better-tailwindcss/enforce-consistent-variable-syntax": "warn",
21
+ "better-tailwindcss/enforce-consistent-important-position": "warn",
22
+ "better-tailwindcss/no-unregistered-classes": [isTailwindV4 ? "warn" : "off", {
23
+ detectComponentClasses: true,
24
+ ignore: userIgnoredUnregisteredClasses
25
+ }],
26
+ "better-tailwindcss/enforce-consistent-line-wrapping": [multilineSort ? "warn" : "off", {
27
+ preferSingleLine: true,
28
+ printWidth: maxLineLength,
29
+ indent: useTabs ? "tab" : indent
30
+ }]
31
+ };
32
+ return tailwindRules;
33
+ }
34
+
35
+ //#endregion
36
+ exports.getTailwindRules = getTailwindRules;
@@ -0,0 +1,36 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/tailwind.ts
5
+ function getTailwindRules(options) {
6
+ const { tailwind, stylistic } = options.configs;
7
+ const { multilineSort, ignoredUnregisteredClasses: userIgnoredUnregisteredClasses } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
8
+ const { indent, useTabs, maxLineLength } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
9
+ const isTailwindV4 = isEnabled(tailwind) && tailwind.entryPoint;
10
+ const tailwindRules = {
11
+ "vue/max-len": "off",
12
+ "@stylistic/max-len": "off",
13
+ "css/no-duplicate-imports": "off",
14
+ "better-tailwindcss/no-duplicate-classes": "error",
15
+ "better-tailwindcss/no-deprecated-classes": "error",
16
+ "better-tailwindcss/no-conflicting-classes": "error",
17
+ "better-tailwindcss/enforce-shorthand-classes": "warn",
18
+ "better-tailwindcss/no-unnecessary-whitespace": "warn",
19
+ "better-tailwindcss/enforce-consistent-class-order": "warn",
20
+ "better-tailwindcss/enforce-consistent-variable-syntax": "warn",
21
+ "better-tailwindcss/enforce-consistent-important-position": "warn",
22
+ "better-tailwindcss/no-unregistered-classes": [isTailwindV4 ? "warn" : "off", {
23
+ detectComponentClasses: true,
24
+ ignore: userIgnoredUnregisteredClasses
25
+ }],
26
+ "better-tailwindcss/enforce-consistent-line-wrapping": [multilineSort ? "warn" : "off", {
27
+ preferSingleLine: true,
28
+ printWidth: maxLineLength,
29
+ indent: useTabs ? "tab" : indent
30
+ }]
31
+ };
32
+ return tailwindRules;
33
+ }
34
+
35
+ //#endregion
36
+ export { getTailwindRules };
@@ -0,0 +1,62 @@
1
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
2
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
3
+
4
+ //#region src/rules/typescript.ts
5
+ function getTypeScriptRules(options) {
6
+ const { typescript } = options.configs;
7
+ const { typeDefinitionStyle, methodSignatureStyle } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(typescript) ? typescript : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.typescript;
8
+ const tsRules = {
9
+ "no-loop-func": "off",
10
+ "no-unused-vars": "off",
11
+ "default-param-last": "off",
12
+ "prefer-destructuring": "off",
13
+ "@typescript-eslint/no-loop-func": "error",
14
+ "@typescript-eslint/default-param-last": "warn",
15
+ "@typescript-eslint/no-unsafe-assignment": "warn",
16
+ "@typescript-eslint/prefer-destructuring": "warn",
17
+ "@typescript-eslint/promise-function-async": "error",
18
+ "@typescript-eslint/no-unsafe-member-access": "warn",
19
+ "@typescript-eslint/consistent-type-imports": "warn",
20
+ "@typescript-eslint/no-useless-empty-export": "error",
21
+ "@typescript-eslint/no-unsafe-type-assertion": "warn",
22
+ "@typescript-eslint/prefer-enum-initializers": "error",
23
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
24
+ "@typescript-eslint/switch-exhaustiveness-check": "warn",
25
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",
26
+ "@typescript-eslint/method-signature-style": ["error", methodSignatureStyle],
27
+ "@typescript-eslint/consistent-type-definitions": ["warn", typeDefinitionStyle],
28
+ "@typescript-eslint/naming-convention": [
29
+ "warn",
30
+ {
31
+ selector: "variable",
32
+ format: [
33
+ "camelCase",
34
+ "PascalCase",
35
+ "UPPER_CASE"
36
+ ]
37
+ },
38
+ {
39
+ selector: "memberLike",
40
+ modifiers: ["private"],
41
+ format: ["camelCase"],
42
+ leadingUnderscore: "require"
43
+ },
44
+ {
45
+ selector: "enumMember",
46
+ format: ["PascalCase"]
47
+ },
48
+ {
49
+ selector: "typeLike",
50
+ format: ["PascalCase"],
51
+ custom: {
52
+ regex: "^(I|T(?!S))[A-Z]",
53
+ match: false
54
+ }
55
+ }
56
+ ]
57
+ };
58
+ return tsRules;
59
+ }
60
+
61
+ //#endregion
62
+ exports.getTypeScriptRules = getTypeScriptRules;
@@ -0,0 +1,62 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/typescript.ts
5
+ function getTypeScriptRules(options) {
6
+ const { typescript } = options.configs;
7
+ const { typeDefinitionStyle, methodSignatureStyle } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
8
+ const tsRules = {
9
+ "no-loop-func": "off",
10
+ "no-unused-vars": "off",
11
+ "default-param-last": "off",
12
+ "prefer-destructuring": "off",
13
+ "@typescript-eslint/no-loop-func": "error",
14
+ "@typescript-eslint/default-param-last": "warn",
15
+ "@typescript-eslint/no-unsafe-assignment": "warn",
16
+ "@typescript-eslint/prefer-destructuring": "warn",
17
+ "@typescript-eslint/promise-function-async": "error",
18
+ "@typescript-eslint/no-unsafe-member-access": "warn",
19
+ "@typescript-eslint/consistent-type-imports": "warn",
20
+ "@typescript-eslint/no-useless-empty-export": "error",
21
+ "@typescript-eslint/no-unsafe-type-assertion": "warn",
22
+ "@typescript-eslint/prefer-enum-initializers": "error",
23
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
24
+ "@typescript-eslint/switch-exhaustiveness-check": "warn",
25
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",
26
+ "@typescript-eslint/method-signature-style": ["error", methodSignatureStyle],
27
+ "@typescript-eslint/consistent-type-definitions": ["warn", typeDefinitionStyle],
28
+ "@typescript-eslint/naming-convention": [
29
+ "warn",
30
+ {
31
+ selector: "variable",
32
+ format: [
33
+ "camelCase",
34
+ "PascalCase",
35
+ "UPPER_CASE"
36
+ ]
37
+ },
38
+ {
39
+ selector: "memberLike",
40
+ modifiers: ["private"],
41
+ format: ["camelCase"],
42
+ leadingUnderscore: "require"
43
+ },
44
+ {
45
+ selector: "enumMember",
46
+ format: ["PascalCase"]
47
+ },
48
+ {
49
+ selector: "typeLike",
50
+ format: ["PascalCase"],
51
+ custom: {
52
+ regex: "^(I|T(?!S))[A-Z]",
53
+ match: false
54
+ }
55
+ }
56
+ ]
57
+ };
58
+ return tsRules;
59
+ }
60
+
61
+ //#endregion
62
+ export { getTypeScriptRules };
@@ -0,0 +1,47 @@
1
+
2
+ //#region src/rules/vitest.ts
3
+ function getVitestRules(options) {
4
+ const { testFunction, maxNestedDescribe } = options.configs.test;
5
+ const vitestRules = {
6
+ "vitest/prefer-todo": "warn",
7
+ "vitest/prefer-to-be": "warn",
8
+ "vitest/require-hook": "error",
9
+ "vitest/prefer-spy-on": "warn",
10
+ "vitest/no-mocks-import": "error",
11
+ "vitest/no-test-prefixes": "error",
12
+ "vitest/no-alias-methods": "error",
13
+ "vitest/no-focused-tests": "error",
14
+ "vitest/prefer-to-contain": "warn",
15
+ "vitest/no-disabled-tests": "error",
16
+ "vitest/prefer-called-with": "warn",
17
+ "vitest/prefer-to-be-falsy": "warn",
18
+ "vitest/no-duplicate-hooks": "error",
19
+ "vitest/prefer-strict-equal": "warn",
20
+ "vitest/prefer-to-be-truthy": "warn",
21
+ "vitest/prefer-to-be-object": "warn",
22
+ "vitest/no-conditional-tests": "error",
23
+ "vitest/no-standalone-expect": "error",
24
+ "vitest/prefer-to-have-length": "warn",
25
+ "vitest/prefer-hooks-in-order": "warn",
26
+ "vitest/no-conditional-expect": "error",
27
+ "vitest/prefer-lowercase-title": "warn",
28
+ "vitest/no-conditional-in-test": "error",
29
+ "vitest/prefer-equality-matcher": "warn",
30
+ "vitest/consistent-test-filename": "warn",
31
+ "vitest/no-test-return-statement": "error",
32
+ "vitest/require-to-throw-message": "error",
33
+ "vitest/prefer-comparison-matcher": "warn",
34
+ "vitest/prefer-mock-promise-shorthand": "warn",
35
+ "vitest/no-interpolation-in-snapshots": "error",
36
+ "vitest/prefer-snapshot-hint": ["warn", "always"],
37
+ "vitest/max-nested-describe": ["warn", { max: maxNestedDescribe }],
38
+ "vitest/consistent-test-it": ["warn", {
39
+ fn: testFunction,
40
+ withinDescribe: testFunction
41
+ }]
42
+ };
43
+ return vitestRules;
44
+ }
45
+
46
+ //#endregion
47
+ exports.getVitestRules = getVitestRules;
@@ -0,0 +1,46 @@
1
+ //#region src/rules/vitest.ts
2
+ function getVitestRules(options) {
3
+ const { testFunction, maxNestedDescribe } = options.configs.test;
4
+ const vitestRules = {
5
+ "vitest/prefer-todo": "warn",
6
+ "vitest/prefer-to-be": "warn",
7
+ "vitest/require-hook": "error",
8
+ "vitest/prefer-spy-on": "warn",
9
+ "vitest/no-mocks-import": "error",
10
+ "vitest/no-test-prefixes": "error",
11
+ "vitest/no-alias-methods": "error",
12
+ "vitest/no-focused-tests": "error",
13
+ "vitest/prefer-to-contain": "warn",
14
+ "vitest/no-disabled-tests": "error",
15
+ "vitest/prefer-called-with": "warn",
16
+ "vitest/prefer-to-be-falsy": "warn",
17
+ "vitest/no-duplicate-hooks": "error",
18
+ "vitest/prefer-strict-equal": "warn",
19
+ "vitest/prefer-to-be-truthy": "warn",
20
+ "vitest/prefer-to-be-object": "warn",
21
+ "vitest/no-conditional-tests": "error",
22
+ "vitest/no-standalone-expect": "error",
23
+ "vitest/prefer-to-have-length": "warn",
24
+ "vitest/prefer-hooks-in-order": "warn",
25
+ "vitest/no-conditional-expect": "error",
26
+ "vitest/prefer-lowercase-title": "warn",
27
+ "vitest/no-conditional-in-test": "error",
28
+ "vitest/prefer-equality-matcher": "warn",
29
+ "vitest/consistent-test-filename": "warn",
30
+ "vitest/no-test-return-statement": "error",
31
+ "vitest/require-to-throw-message": "error",
32
+ "vitest/prefer-comparison-matcher": "warn",
33
+ "vitest/prefer-mock-promise-shorthand": "warn",
34
+ "vitest/no-interpolation-in-snapshots": "error",
35
+ "vitest/prefer-snapshot-hint": ["warn", "always"],
36
+ "vitest/max-nested-describe": ["warn", { max: maxNestedDescribe }],
37
+ "vitest/consistent-test-it": ["warn", {
38
+ fn: testFunction,
39
+ withinDescribe: testFunction
40
+ }]
41
+ };
42
+ return vitestRules;
43
+ }
44
+
45
+ //#endregion
46
+ export { getVitestRules };
@@ -0,0 +1,169 @@
1
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
2
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
3
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_vue_getRestrictedVueInputs = require('../utils/vue/getRestrictedVueInputs.cjs');
4
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_vue_getRestrictedVueElements = require('../utils/vue/getRestrictedVueElements.cjs');
5
+
6
+ //#region src/rules/vue.ts
7
+ function getVueRules(options) {
8
+ const { typescript, stylistic, vue, nuxt } = options.configs;
9
+ const { indent, useTabs, trailingComma, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(stylistic) ? stylistic : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.stylistic;
10
+ const { blockLang, blocksOrder, macrosOrder, attributesOrder, vOnHandlerStyle, destructureProps, vForDelimiterStyle, attributeHyphenation, allowedStyleAttributes, preferVBindTrueShorthand, componentNameCaseInTemplate, preferVBindSameNameShorthand, restrictedElements: userRestrictedElements, ignoredUndefinedComponents: userIgnoredUndefinedComponents, restrictedStaticAttributes: userRestrictedStaticAttributes } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(vue) ? vue : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.vue;
11
+ const nuxtImage = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(nuxt) ? nuxt.image : void 0;
12
+ const nuxtUI = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(nuxt) ? nuxt.ui : void 0;
13
+ const nuxtUIPrefix = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(nuxt) && require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(nuxt.ui) ? nuxt.ui.prefix : void 0;
14
+ const isScriptLangTS = blockLang.script === "ts";
15
+ const vueRules = {
16
+ "no-undef": "off",
17
+ "no-useless-assignment": "off",
18
+ "vue/comment-directive": ["error", { reportUnusedDisableDirectives: true }],
19
+ "vue/html-closing-bracket-newline": "warn",
20
+ "vue/singleline-html-element-content-newline": "off",
21
+ "vue/html-indent": ["warn", useTabs ? "tab" : indent],
22
+ "vue/v-slot-style": ["warn", { atComponent: "shorthand" }],
23
+ "vue/attribute-hyphenation": ["warn", attributeHyphenation],
24
+ "vue/first-attribute-linebreak": ["warn", { singleline: "beside" }],
25
+ "vue/v-on-event-hyphenation": [
26
+ "warn",
27
+ attributeHyphenation,
28
+ { autofix: true }
29
+ ],
30
+ "vue/v-bind-style": [
31
+ "warn",
32
+ "shorthand",
33
+ { sameNameShorthand: preferVBindSameNameShorthand }
34
+ ],
35
+ "vue/html-self-closing": ["error", { html: {
36
+ normal: "never",
37
+ void: selfCloseVoidHTMLElements
38
+ } }],
39
+ "vue/max-attributes-per-line": ["warn", { singleline: { max: maxAttributesPerLine } }],
40
+ "vue/attributes-order": ["warn", { order: attributesOrder }],
41
+ "vue/camelcase": "warn",
42
+ "vue/no-root-v-if": "warn",
43
+ "vue/require-expose": "error",
44
+ "vue/no-unused-refs": "error",
45
+ "vue/prop-name-casing": "warn",
46
+ "vue/slot-name-casing": "warn",
47
+ "vue/no-useless-v-bind": "error",
48
+ "vue/component-api-style": "error",
49
+ "vue/html-button-has-type": "error",
50
+ "vue/valid-define-options": "error",
51
+ "vue/prefer-define-options": "warn",
52
+ "vue/require-emit-validator": "error",
53
+ "vue/require-default-export": "error",
54
+ "vue/custom-event-name-casing": "warn",
55
+ "vue/no-use-v-else-with-v-for": "error",
56
+ "vue/no-empty-component-block": "error",
57
+ "vue/no-import-compiler-macros": "error",
58
+ "vue/require-typed-object-prop": "error",
59
+ "vue/require-macro-variable-name": "warn",
60
+ "vue/padding-line-between-blocks": "warn",
61
+ "vue/match-component-import-name": "error",
62
+ "vue/html-comment-content-newline": "warn",
63
+ "vue/no-multiple-objects-in-class": "warn",
64
+ "vue/prefer-separate-static-class": "warn",
65
+ "vue/html-comment-content-spacing": "warn",
66
+ "vue/comma-dangle": ["warn", trailingComma],
67
+ "vue/component-options-name-casing": "warn",
68
+ "vue/no-ref-object-reactivity-loss": "error",
69
+ "vue/no-duplicate-attr-inheritance": "error",
70
+ "vue/no-this-in-before-route-enter": "error",
71
+ "vue/prefer-prop-type-boolean-first": "warn",
72
+ "vue/no-setup-props-reactivity-loss": "error",
73
+ "vue/block-order": ["warn", { order: blocksOrder }],
74
+ "vue/v-on-handler-style": ["error", vOnHandlerStyle],
75
+ "vue/v-for-delimiter-style": ["warn", vForDelimiterStyle],
76
+ "vue/require-typed-ref": isScriptLangTS ? "error" : "off",
77
+ "vue/define-macros-order": ["warn", { order: macrosOrder }],
78
+ "vue/html-comment-indent": ["warn", useTabs ? "tab" : indent],
79
+ "vue/no-static-inline-styles": ["warn", { allowBinding: true }],
80
+ "vue/no-required-prop-with-default": ["error", { autofix: true }],
81
+ "vue/prefer-true-attribute-shorthand": ["warn", preferVBindTrueShorthand],
82
+ "vue/no-deprecated-model-definition": ["error", { allowVue3Compat: true }],
83
+ "vue/enforce-style-attribute": ["error", { allow: allowedStyleAttributes }],
84
+ "vue/define-props-destructuring": ["warn", { destructure: destructureProps }],
85
+ "vue/define-emits-declaration": ["warn", isScriptLangTS ? "type-based" : "runtime"],
86
+ "vue/define-props-declaration": ["error", isScriptLangTS ? "type-based" : "runtime"],
87
+ "vue/max-len": ["warn", {
88
+ tabWidth: indent,
89
+ code: maxLineLength,
90
+ template: Infinity,
91
+ ignoreUrls: true,
92
+ ignoreStrings: true,
93
+ ignoreComments: true,
94
+ ignoreRegExpLiterals: true,
95
+ ignoreTrailingComments: true,
96
+ ignoreTemplateLiterals: true,
97
+ ignoreHTMLTextContents: true,
98
+ ignoreHTMLAttributeValues: true
99
+ }],
100
+ "vue/block-lang": ["error", {
101
+ script: { lang: blockLang.script },
102
+ style: {
103
+ lang: blockLang.style,
104
+ allowNoLang: blockLang.style === "implicit"
105
+ }
106
+ }],
107
+ "vue/block-tag-newline": ["warn", {
108
+ singleline: "always",
109
+ maxEmptyLines: maxConsecutiveEmptyLines ? maxConsecutiveEmptyLines - 1 : 0
110
+ }],
111
+ "vue/no-restricted-html-elements": [
112
+ "error",
113
+ {
114
+ element: nuxt ? "time" : "",
115
+ message: "Use `<NuxtTime>`."
116
+ },
117
+ {
118
+ element: nuxtImage ? "img" : "",
119
+ message: "Use `<NuxtImg>`."
120
+ },
121
+ {
122
+ element: nuxtImage ? "picture" : "",
123
+ message: "Use `<NuxtPicture>`."
124
+ },
125
+ {
126
+ element: nuxtUI ? [
127
+ "a",
128
+ "RouterLink",
129
+ "NuxtLink"
130
+ ] : "",
131
+ message: nuxtUI && nuxtUIPrefix ? `Use <${nuxtUIPrefix}Link>.` : void 0
132
+ },
133
+ {
134
+ element: ["a", nuxt ? "RouterLink" : ""],
135
+ message: `Use <${nuxt ? "NuxtLink" : "RouterLink"}>.`
136
+ },
137
+ ...nuxtUI && nuxtUIPrefix ? require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_vue_getRestrictedVueElements.getRestrictedVueElements(nuxtUIPrefix) : [],
138
+ ...userRestrictedElements
139
+ ],
140
+ "vue/no-restricted-static-attribute": [
141
+ "error",
142
+ ...nuxtUI && nuxtUIPrefix ? require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_vue_getRestrictedVueInputs.getRestrictedVueInputs(nuxtUIPrefix) : [],
143
+ ...userRestrictedStaticAttributes
144
+ ],
145
+ "vue/no-undef-components": ["error", { ignorePatterns: [
146
+ "^(Nuxt|U)",
147
+ "^(Icon|Html|Head|Title|Base|Meta|Link|Style|Body|NoScript)$",
148
+ ...userIgnoredUndefinedComponents
149
+ ] }],
150
+ "vue/match-component-file-name": ["error", {
151
+ shouldMatchCase: true,
152
+ extensions: [
153
+ "vue",
154
+ "js",
155
+ "jsx",
156
+ ...typescript ? ["ts", "tsx"] : []
157
+ ]
158
+ }],
159
+ "vue/component-name-in-template-casing": [
160
+ "warn",
161
+ componentNameCaseInTemplate,
162
+ { registeredComponentsOnly: false }
163
+ ]
164
+ };
165
+ return vueRules;
166
+ }
167
+
168
+ //#endregion
169
+ exports.getVueRules = getVueRules;