@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,360 @@
1
+ import { DeepNonNullable } from "./helpers.js";
2
+ import { CSSOptions } from "./configOptions/css.js";
3
+ import { VueOptions } from "./configOptions/vue.js";
4
+ import { BaseOptions } from "./configOptions/base.js";
5
+ import { HTMLOptions } from "./configOptions/html.js";
6
+ import { NuxtOptions } from "./configOptions/nuxt.js";
7
+ import { TestOptions } from "./configOptions/test.js";
8
+ import { ImportXOptions } from "./configOptions/importX.js";
9
+ import { TailwindOptions } from "./configOptions/tailwind.js";
10
+ import { StylisticOptions } from "./configOptions/stylistic.js";
11
+ import { TypeScriptOptions } from "./configOptions/typescript.js";
12
+ import { PerfectionistOptions } from "./configOptions/perfectionist.js";
13
+ import { ConfigWithExtends } from "typescript-eslint";
14
+ import { Linter } from "eslint";
15
+
16
+ //#region src/types/index.d.ts
17
+ type ConfigObject = ConfigWithExtends & {
18
+ rules?: Linter.RulesRecord;
19
+ };
20
+ type ConfigOverrides = Pick<ConfigObject, 'name' | 'files' | 'rules' | 'ignores' | 'plugins' | 'settings'>;
21
+ interface ConfigWithOverrides {
22
+ /**
23
+ * Override the configuration.
24
+ *
25
+ * The properties of this object are merged with and take precedence over the default configuration.
26
+ *
27
+ * There is no guarantee that the resulting configuration works correctly — it depends on the options you provide.
28
+ *
29
+ * @see [eslint-flat-config-utils: `mergeConfigs`](https://jsr.io/@antfu/eslint-flat-config-utils/doc/~/mergeConfigs)
30
+ */
31
+ overrides?: ConfigOverrides & {
32
+ rules?: Linter.RulesRecord;
33
+ languageOptions?: {
34
+ parser?: DeepNonNullable<ConfigObject>['languageOptions']['parser'];
35
+ globals?: DeepNonNullable<ConfigObject>['languageOptions']['globals'];
36
+ };
37
+ };
38
+ }
39
+
40
+ /** The options passed to the `defineConfig` function. */
41
+ interface Options {
42
+ /**
43
+ * Automatically enable configurations based on the detected dependencies, dev-dependencies, etc. in the _package.json_ file.
44
+ *
45
+ * Set to `'verbose'` to log the detected dependencies.
46
+ *
47
+ * Use the `packageDir` option to specify the path to the _package.json_ file.
48
+ *
49
+ * @default true
50
+ */
51
+ autoDetectDeps?: boolean | 'verbose';
52
+
53
+ /**
54
+ * Path to the _.gitignore_ file (relative to the current working directory).
55
+ *
56
+ * ESLint will ignore files and directories found in your _.gitignore_ file. Set to `false` to disable this behavior.
57
+ *
58
+ * It will fall back to the default value if set to an empty string (`''`).
59
+ *
60
+ * @default '.gitignore'
61
+ *
62
+ * @see [ESLint Ignore: Including GitIgnore Files](https://eslint.org/docs/latest/use/configure/ignore#including-gitignore-files)
63
+ */
64
+ gitignore?: false | string;
65
+
66
+ /**
67
+ * Path to directory of the _package.json_ file (relative to the current working directory).
68
+ *
69
+ * This is used by
70
+ * - `autoDetectDeps` option
71
+ * - [import-x/no-extraneous-dependencies: `packageDir` option](https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md#packagedir)
72
+ * - [storybook/no-uninstalled-addons: `packageJsonLocation` option](https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-uninstalled-addons.md#packagejsonlocation)
73
+ *
74
+ * It will fall back to the default value if set to an empty string (`''`).
75
+ *
76
+ * @default '.'
77
+ */
78
+ packageDir?: string;
79
+
80
+ /**
81
+ * Specify the runtime environment to correctly resolve its built-in modules
82
+ *
83
+ * This is used by
84
+ * [perfectionist/sort-imports: `env` option](https://perfectionist.dev/rules/sort-imports#environment)
85
+ * to recognize the environment’s built-in modules when sorting the imports.
86
+ *
87
+ * @default 'node'
88
+ */
89
+ env?: 'bun' | 'node';
90
+
91
+ /**
92
+ * The path and the name of the root TypeScript config file.
93
+ *
94
+ * If you don't use TypeScript, provide the path and the name of the root JavaScript config file.
95
+ *
96
+ * This is used by
97
+ * - [better-tailwindcss: `tsconfig` option](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tsconfig)
98
+ * - [perfectionist/sort-imports: `tsconfig` option](https://perfectionist.dev/rules/sort-imports#tsconfig)
99
+ *
100
+ * @default undefined // `{ rootDir: '.', filename: 'tsconfig.json' }` if "typescript" is detected in the package.json file when `autoDetectDeps` is enabled
101
+ */
102
+ tsConfig?: false | {
103
+ /**
104
+ * The directory of the root TypeScript config file.
105
+ *
106
+ * If you don't use TypeScript, provide the directory of the root JavaScript config file.
107
+ *
108
+ * It will fall back to the default value if set to an empty string (`''`).
109
+ *
110
+ * @default '.'
111
+ */
112
+ rootDir: string;
113
+
114
+ /**
115
+ * The name of the root TypeScript config file.
116
+ *
117
+ * If you don't use TypeScript, provide the name of the root JavaScript config file.
118
+ *
119
+ * It will fall back to the default value if set to an empty string (`''`).
120
+ *
121
+ * @default 'tsconfig.json'
122
+ */
123
+ filename?: string;
124
+ };
125
+
126
+ /*** Global ***/
127
+ /**
128
+ * Global configuration options applied to all files. Individual configurations will override these.
129
+ *
130
+ * @default
131
+ * {
132
+ * name: 'shayanthenerd/eslint-config',
133
+ * basePath: '.',
134
+ * linterOptions: {
135
+ * noInlineConfig: true,
136
+ * reportUnusedInlineConfigs: 'warn',
137
+ * reportUnusedDisableDirectives: 'warn'
138
+ * }
139
+ * languageOptions: {
140
+ * parserOptions: {},
141
+ * sourceType: 'module',
142
+ * ecmaVersion: 'latest',
143
+ * },
144
+ * }
145
+ */
146
+ global?: {
147
+ /**
148
+ * A name for the configuration object. This is used in error messages and [config inspector](https://github.com/eslint/config-inspector) to help identify which configuration object is being used.
149
+ *
150
+ * It will fall back to the default value if set to an empty string (`''`).
151
+ *
152
+ * @default 'shayanthenerd/eslint-config'
153
+ *
154
+ * @see [ESLint Configuration: Naming Conventions](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-naming-conventions)
155
+ */
156
+ name?: string;
157
+
158
+ /**
159
+ * The base path for resolving `files` and `ignores` patterns.
160
+ *
161
+ * Glob patterns in the configuration objects will be resolved relative to this path.
162
+ *
163
+ * It will fall back to the default value if set to an empty string (`''`).
164
+ *
165
+ * @default '.'
166
+ *
167
+ * @see [ESLint Configuration: Specifying Base Path](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-base-path)
168
+ */
169
+ basePath?: string;
170
+
171
+ /**
172
+ * Patterns that ESLint should ignore globally. These patterns are resolved relative to the current working directory.
173
+ *
174
+ * @see [ESLint Configuration: Globally Ignoring Files](https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores)
175
+ */
176
+ ignores?: string[];
177
+
178
+ /**
179
+ * Specify global variables.
180
+ *
181
+ * @default
182
+ * {
183
+ * node: true,
184
+ * commonjs: false,
185
+ * browser: true,
186
+ * worker: true,
187
+ * serviceworker: false,
188
+ * webextension: false,
189
+ * custom: {},
190
+ * }
191
+ *
192
+ * @see [Language Options: Specifying Globals: Using Configuration Files](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
193
+ */
194
+ globals?: {
195
+ node?: boolean;
196
+ commonjs?: boolean;
197
+ browser?: boolean;
198
+ worker?: boolean;
199
+ serviceworker?: boolean;
200
+ webextension?: boolean;
201
+ custom?: Linter.LanguageOptions['globals'];
202
+ };
203
+
204
+ /**
205
+ * Specify the linting process.
206
+ *
207
+ * @see [ESLint Configuration: Linter Options](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options)
208
+ */
209
+ linterOptions?: {
210
+ /**
211
+ * Disallow inline (comment) configurations and disable-directives.
212
+ *
213
+ * @default false
214
+ *
215
+ * @see [ESLint Configuration: Disabling Inline Configuration](https://eslint.org/docs/latest/use/configure/configuration-files#disabling-inline-configuration)
216
+ */
217
+ noInlineConfig?: Linter.LintOptions['allowInlineConfig'];
218
+
219
+ /**
220
+ * A severity string indicating if and how unused inline configs should be tracked and reported.
221
+ *
222
+ * @default 'warn'
223
+ *
224
+ * @see [ESLint Configuration: Reporting Unused Inline Configs](https://eslint.org/docs/latest/use/configure/configuration-files#reporting-unused-inline-configs)
225
+ */
226
+ reportUnusedInlineConfigs?: Linter.StringSeverity;
227
+
228
+ /**
229
+ * A severity string indicating if and how unused disable and enable directives should be tracked and reported.
230
+ *
231
+ * @default 'warn'
232
+ *
233
+ * @see [ESLint Configuration: Reporting Unused Disable Directives](https://eslint.org/docs/latest/use/configure/configuration-files#reporting-unused-disable-directives)
234
+ */
235
+ reportUnusedDisableDirectives?: Linter.StringSeverity;
236
+ };
237
+
238
+ /**
239
+ * Settings shared across all rules. Use this to specify information that should be available to every rule.
240
+ *
241
+ * @see [ESLint Configuration: Shared Settings](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings)
242
+ */
243
+ settings?: ConfigObject['settings'];
244
+
245
+ /**
246
+ * The available rules.
247
+ *
248
+ * @see [ESLint Configuration: Rules](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-rules)
249
+ */
250
+ rules?: Linter.RulesRecord;
251
+ };
252
+
253
+ /*** Configs ***/
254
+ /**
255
+ * Enable, disable, or customize the configurations.
256
+ *
257
+ * `autoDetectDeps` can enable configurations that are disabled by default. However, explicitly enabling or disabling a configuration takes precedence over `autoDetectDeps`.
258
+ */
259
+ configs?: {
260
+ /**
261
+ * Use [eslint-plugin-oxlint](https://github.com/oxc-project/eslint-plugin-oxlint) to disable rules that are already handled by OXLint.
262
+ *
263
+ * Provide the path to your OXLint configuration file (relative to the current working directory) or set to `false` to disable it.
264
+ *
265
+ * Enabling this improves performance and feedback loops when using OXLint.
266
+ *
267
+ * It will fall back to the default value if set to an empty string (`''`).
268
+ *
269
+ * @default false // `'.oxlintrc.json'` if "oxlint" is detected in the package.json file when `autoDetectDeps` is enabled
270
+ */
271
+ oxlint?: false | string;
272
+
273
+ /**
274
+ * Customize some of the JavaScript (core) rules.
275
+ *
276
+ * JavaScript rules cannot be turned off.
277
+ */
278
+ base?: BaseOptions;
279
+
280
+ /**
281
+ * Use [@stylistic/eslint-plugin](https://eslint.style) to enforce stylistic rules such as indentation, line length, spacing, quotes, semicolons, etc.
282
+ *
283
+ * @default true
284
+ */
285
+ stylistic?: boolean | StylisticOptions;
286
+
287
+ /**
288
+ * Use [@html-eslint/eslint-plugin](https://html-eslint.org) to enforce SEO and accessibility best practices, as well as some stylistic rules.
289
+ *
290
+ * @default false
291
+ */
292
+ html?: boolean | HTMLOptions;
293
+
294
+ /**
295
+ * Use [@eslint/css](https://github.com/eslint/css) to enforce CSS best practices and identify mistakes.
296
+ *
297
+ * @default false // `true` if "tailwindcss" is detected in the package.json file when `autoDetectDeps` is enabled
298
+ */
299
+ css?: boolean | CSSOptions;
300
+
301
+ /**
302
+ * Use [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss) to sort Tailwind classes, check for unused or conflicting ones, and enforce best practices.
303
+ *
304
+ * @default false
305
+ */
306
+ tailwind?: false | (TailwindOptions & ConfigWithOverrides);
307
+
308
+ /**
309
+ * Use [typescript-eslint](https://typescript-eslint.io) to enforce TypeScript-specific rules.
310
+ *
311
+ * Setting this to `false` doesn't prevent ESLint from linting TypeScript files.
312
+ *
313
+ * This enables
314
+ * - [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) to better understand imports from TypeScript files such as ".ts", ".tsx", etc.
315
+ * - [eslint-plugin-vue](https://eslint.vuejs.org) to enforce TypeScript-specific rules in the `<script setup lang="ts">` of Vue SFCs.
316
+ *
317
+ * @default false // `true` if "typescript" is detected in the package.json file when `autoDetectDeps` is enabled
318
+ */
319
+ typescript?: boolean | TypeScriptOptions;
320
+
321
+ /**
322
+ * Use [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) to organize imports and exports, and detect related issues.
323
+ *
324
+ * @default true
325
+ */
326
+ importX?: boolean | ImportXOptions;
327
+
328
+ /**
329
+ * Use [eslint-plugin-perfectionist](https://perfectionist.dev) to sort imports, exports, maps, union types, etc.
330
+ *
331
+ * @default true
332
+ */
333
+ perfectionist?: boolean | PerfectionistOptions;
334
+
335
+ /**
336
+ * Use [eslint-plugin-vue](https://eslint.vuejs.org) to enforce Vue best practices, accessibility guidelines, stylistic rules, and identify mistakes.
337
+ *
338
+ * @default false // `true` if "vue" is detected in the package.json file when `autoDetectDeps` is enabled
339
+ */
340
+ vue?: boolean | VueOptions;
341
+
342
+ /**
343
+ * Whether [Nuxt](https://nuxt.com) is used in the project.
344
+ *
345
+ * Enforce best practices and the use of Nuxt-specific components over their standard counterparts. For example, `<NuxtLink>` must be used instead of `<a>`, and `<NuxtTime>` instead of `<time>`.
346
+ *
347
+ * **This configuration requires `configs.vue` to be enabled.**
348
+ *
349
+ * @default false // `true` if "nuxt" is detected in the package.json file when `autoDetectDeps` is enabled
350
+ */
351
+ nuxt?: boolean | NuxtOptions;
352
+
353
+ /**
354
+ * Configuration options for the testing tools.
355
+ */
356
+ test?: TestOptions;
357
+ };
358
+ }
359
+ //#endregion
360
+ export { type ConfigObject, type ConfigWithOverrides, type Options };
@@ -0,0 +1,31 @@
1
+
2
+ //#region src/utils/globs.ts
3
+ const srcExtensions = "?([mc])[jt]s?(x)";
4
+ const vueExtensions = `{vue,${srcExtensions}}`;
5
+ const commonsFolders = [
6
+ "shared",
7
+ "dto?(s)",
8
+ "model?(s)",
9
+ "helper?(s)",
10
+ "module?(s)",
11
+ "?(@)type?(s)",
12
+ "util?(s|ities)",
13
+ "composable?(s)",
14
+ "repo?(s|sitory|sitories)"
15
+ ];
16
+ const globs = {
17
+ src: `**/*.${srcExtensions}`,
18
+ commons: `**/{${commonsFolders.join(",")}}/**/*.${srcExtensions}`,
19
+ commonsIgnore: `**/lint-staged.config.${srcExtensions}`,
20
+ html: "**/*.html",
21
+ css: "**/*.css",
22
+ vue: `**/*.${vueExtensions}`,
23
+ vueMultiRootTemplate: `**/pages/**/(_|-)components/**/*.${vueExtensions}`,
24
+ vueComponentNames: `**/{{app,error},{layouts,pages}/**/*}.${vueExtensions}`,
25
+ vueComponentNamesIgnore: `**/{layouts,pages}/**/(_|-)components/**/*.${vueExtensions}`,
26
+ storybook: `**/*.(story|stories).${srcExtensions}`,
27
+ test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`
28
+ };
29
+
30
+ //#endregion
31
+ exports.globs = globs;
@@ -0,0 +1,30 @@
1
+ //#region src/utils/globs.ts
2
+ const srcExtensions = "?([mc])[jt]s?(x)";
3
+ const vueExtensions = `{vue,${srcExtensions}}`;
4
+ const commonsFolders = [
5
+ "shared",
6
+ "dto?(s)",
7
+ "model?(s)",
8
+ "helper?(s)",
9
+ "module?(s)",
10
+ "?(@)type?(s)",
11
+ "util?(s|ities)",
12
+ "composable?(s)",
13
+ "repo?(s|sitory|sitories)"
14
+ ];
15
+ const globs = {
16
+ src: `**/*.${srcExtensions}`,
17
+ commons: `**/{${commonsFolders.join(",")}}/**/*.${srcExtensions}`,
18
+ commonsIgnore: `**/lint-staged.config.${srcExtensions}`,
19
+ html: "**/*.html",
20
+ css: "**/*.css",
21
+ vue: `**/*.${vueExtensions}`,
22
+ vueMultiRootTemplate: `**/pages/**/(_|-)components/**/*.${vueExtensions}`,
23
+ vueComponentNames: `**/{{app,error},{layouts,pages}/**/*}.${vueExtensions}`,
24
+ vueComponentNamesIgnore: `**/{layouts,pages}/**/(_|-)components/**/*.${vueExtensions}`,
25
+ storybook: `**/*.(story|stories).${srcExtensions}`,
26
+ test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`
27
+ };
28
+
29
+ //#endregion
30
+ export { globs };
@@ -0,0 +1,58 @@
1
+
2
+ //#region src/utils/ignores/defaultIgnorePatterns.ts
3
+ const defaultIgnorePatterns = [
4
+ "**/*.min.*",
5
+ "**/jspm_packages",
6
+ "**/pnpm-lock.yaml",
7
+ "**/bower_components",
8
+ "**/package-lock.json",
9
+ "**/typegen.d.ts",
10
+ "**/components.d.ts",
11
+ "**/auto-import?(s).d.ts",
12
+ "**/out",
13
+ "**/dist",
14
+ "**/build",
15
+ "**/.data",
16
+ "**/output",
17
+ "**/.output",
18
+ "**/.serverless",
19
+ "**/public/build",
20
+ "**/public/static",
21
+ "**/.eslint-config-inspector",
22
+ "**/tmp",
23
+ "**/.tmp",
24
+ "**/.npm",
25
+ "**/temp",
26
+ "**/.temp",
27
+ "**/cache",
28
+ "**/.cache",
29
+ "**/deno_dir",
30
+ "**/.parcel-cache",
31
+ "**/*.lerna_backup",
32
+ "**/.postcss-cache",
33
+ "**/.vitepress/cache",
34
+ "**/vite.config.*.timestamp-*",
35
+ "**/.nx",
36
+ "**/.vite",
37
+ "**/.yarn",
38
+ "**/.nuxt",
39
+ "**/.next",
40
+ "**/.vitest",
41
+ "**/.vercel",
42
+ "**/.svelte-kit",
43
+ "**/.vite-inspect",
44
+ "**/coverage",
45
+ "**/_fixtures",
46
+ "**/.nyc_output",
47
+ "**/__snapshots__",
48
+ "**/.idea",
49
+ "**/.fleet",
50
+ "**/.history",
51
+ "**/LICENSE*",
52
+ "**/CHANGELOG*.md",
53
+ "**/CODEOWNERS.md",
54
+ "**/CODE_OF_CONDUCT.md"
55
+ ];
56
+
57
+ //#endregion
58
+ exports.defaultIgnorePatterns = defaultIgnorePatterns;
@@ -0,0 +1,57 @@
1
+ //#region src/utils/ignores/defaultIgnorePatterns.ts
2
+ const defaultIgnorePatterns = [
3
+ "**/*.min.*",
4
+ "**/jspm_packages",
5
+ "**/pnpm-lock.yaml",
6
+ "**/bower_components",
7
+ "**/package-lock.json",
8
+ "**/typegen.d.ts",
9
+ "**/components.d.ts",
10
+ "**/auto-import?(s).d.ts",
11
+ "**/out",
12
+ "**/dist",
13
+ "**/build",
14
+ "**/.data",
15
+ "**/output",
16
+ "**/.output",
17
+ "**/.serverless",
18
+ "**/public/build",
19
+ "**/public/static",
20
+ "**/.eslint-config-inspector",
21
+ "**/tmp",
22
+ "**/.tmp",
23
+ "**/.npm",
24
+ "**/temp",
25
+ "**/.temp",
26
+ "**/cache",
27
+ "**/.cache",
28
+ "**/deno_dir",
29
+ "**/.parcel-cache",
30
+ "**/*.lerna_backup",
31
+ "**/.postcss-cache",
32
+ "**/.vitepress/cache",
33
+ "**/vite.config.*.timestamp-*",
34
+ "**/.nx",
35
+ "**/.vite",
36
+ "**/.yarn",
37
+ "**/.nuxt",
38
+ "**/.next",
39
+ "**/.vitest",
40
+ "**/.vercel",
41
+ "**/.svelte-kit",
42
+ "**/.vite-inspect",
43
+ "**/coverage",
44
+ "**/_fixtures",
45
+ "**/.nyc_output",
46
+ "**/__snapshots__",
47
+ "**/.idea",
48
+ "**/.fleet",
49
+ "**/.history",
50
+ "**/LICENSE*",
51
+ "**/CHANGELOG*.md",
52
+ "**/CODEOWNERS.md",
53
+ "**/CODE_OF_CONDUCT.md"
54
+ ];
55
+
56
+ //#endregion
57
+ export { defaultIgnorePatterns };
@@ -0,0 +1,16 @@
1
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_defaultIgnorePatterns = require('./defaultIgnorePatterns.cjs');
2
+ const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_resolveGitignorePatterns = require('./resolveGitignorePatterns.cjs');
3
+
4
+ //#region src/utils/ignores/getIgnorePatterns.ts
5
+ function getIgnorePatterns({ patterns, gitignore }) {
6
+ if (gitignore) {
7
+ const gitignorePatterns = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_resolveGitignorePatterns.resolveGitignorePatterns(gitignore);
8
+ if (gitignorePatterns.length > 0) require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_defaultIgnorePatterns.defaultIgnorePatterns.push(...gitignorePatterns);
9
+ }
10
+ if (patterns.length > 0) require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_defaultIgnorePatterns.defaultIgnorePatterns.push(...patterns);
11
+ const uniqueIgnorePatterns = [...new Set(require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_ignores_defaultIgnorePatterns.defaultIgnorePatterns)];
12
+ return uniqueIgnorePatterns;
13
+ }
14
+
15
+ //#endregion
16
+ exports.getIgnorePatterns = getIgnorePatterns;
@@ -0,0 +1,16 @@
1
+ import { defaultIgnorePatterns } from "./defaultIgnorePatterns.js";
2
+ import { resolveGitignorePatterns } from "./resolveGitignorePatterns.js";
3
+
4
+ //#region src/utils/ignores/getIgnorePatterns.ts
5
+ function getIgnorePatterns({ patterns, gitignore }) {
6
+ if (gitignore) {
7
+ const gitignorePatterns = resolveGitignorePatterns(gitignore);
8
+ if (gitignorePatterns.length > 0) defaultIgnorePatterns.push(...gitignorePatterns);
9
+ }
10
+ if (patterns.length > 0) defaultIgnorePatterns.push(...patterns);
11
+ const uniqueIgnorePatterns = [...new Set(defaultIgnorePatterns)];
12
+ return uniqueIgnorePatterns;
13
+ }
14
+
15
+ //#endregion
16
+ export { getIgnorePatterns };
@@ -0,0 +1,27 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const node_path = require_rolldown_runtime.__toESM(require("node:path"));
3
+ const __eslint_compat = require_rolldown_runtime.__toESM(require("@eslint/compat"));
4
+ const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
5
+ const node_util = require_rolldown_runtime.__toESM(require("node:util"));
6
+
7
+ //#region src/utils/ignores/resolveGitignorePatterns.ts
8
+ const warningMessage = (0, node_util.styleText)("yellow", "⚠ Warning:");
9
+ const gitignoreDisableFlag = (0, node_util.styleText)("bgBlack", " gitignore: false ");
10
+ const fallbackMessage = `Falling back to default ignore patterns. You can suppress this warning by setting ${gitignoreDisableFlag} in the config.`;
11
+ function resolveGitignorePatterns(gitignorePath) {
12
+ const gitignoreAbsolutePath = node_path.default.resolve(process.cwd(), gitignorePath);
13
+ const styledGitignorePath = (0, node_util.styleText)("blue", gitignoreAbsolutePath);
14
+ const gitignoreExists = node_fs.default.existsSync(gitignoreAbsolutePath);
15
+ const gitignorePatterns = [];
16
+ if (!gitignoreExists) {
17
+ console.warn(warningMessage, `No .gitignore file found at "${styledGitignorePath}".`, fallbackMessage);
18
+ return gitignorePatterns;
19
+ }
20
+ const ignorePatterns = (0, __eslint_compat.includeIgnoreFile)(gitignoreAbsolutePath).ignores ?? [];
21
+ if (ignorePatterns.length > 0) gitignorePatterns.push(...ignorePatterns);
22
+ else console.warn(warningMessage, `No patterns found in .gitignore file at "${styledGitignorePath}".`, fallbackMessage);
23
+ return gitignorePatterns;
24
+ }
25
+
26
+ //#endregion
27
+ exports.resolveGitignorePatterns = resolveGitignorePatterns;
@@ -0,0 +1,26 @@
1
+ import path from "node:path";
2
+ import { includeIgnoreFile } from "@eslint/compat";
3
+ import fs from "node:fs";
4
+ import { styleText } from "node:util";
5
+
6
+ //#region src/utils/ignores/resolveGitignorePatterns.ts
7
+ const warningMessage = styleText("yellow", "⚠ Warning:");
8
+ const gitignoreDisableFlag = styleText("bgBlack", " gitignore: false ");
9
+ const fallbackMessage = `Falling back to default ignore patterns. You can suppress this warning by setting ${gitignoreDisableFlag} in the config.`;
10
+ function resolveGitignorePatterns(gitignorePath) {
11
+ const gitignoreAbsolutePath = path.resolve(process.cwd(), gitignorePath);
12
+ const styledGitignorePath = styleText("blue", gitignoreAbsolutePath);
13
+ const gitignoreExists = fs.existsSync(gitignoreAbsolutePath);
14
+ const gitignorePatterns = [];
15
+ if (!gitignoreExists) {
16
+ console.warn(warningMessage, `No .gitignore file found at "${styledGitignorePath}".`, fallbackMessage);
17
+ return gitignorePatterns;
18
+ }
19
+ const ignorePatterns = includeIgnoreFile(gitignoreAbsolutePath).ignores ?? [];
20
+ if (ignorePatterns.length > 0) gitignorePatterns.push(...ignorePatterns);
21
+ else console.warn(warningMessage, `No patterns found in .gitignore file at "${styledGitignorePath}".`, fallbackMessage);
22
+ return gitignorePatterns;
23
+ }
24
+
25
+ //#endregion
26
+ export { resolveGitignorePatterns };
@@ -0,0 +1,8 @@
1
+
2
+ //#region src/utils/isEmptyString.ts
3
+ function isEmptyString(value) {
4
+ return typeof value === "string" && value.trim().length === 0;
5
+ }
6
+
7
+ //#endregion
8
+ exports.isEmptyString = isEmptyString;
@@ -0,0 +1,7 @@
1
+ //#region src/utils/isEmptyString.ts
2
+ function isEmptyString(value) {
3
+ return typeof value === "string" && value.trim().length === 0;
4
+ }
5
+
6
+ //#endregion
7
+ export { isEmptyString };
@@ -0,0 +1,8 @@
1
+
2
+ //#region src/utils/isEnabled.ts
3
+ function isEnabled(option) {
4
+ return Boolean(option);
5
+ }
6
+
7
+ //#endregion
8
+ exports.isEnabled = isEnabled;
@@ -0,0 +1,7 @@
1
+ //#region src/utils/isEnabled.ts
2
+ function isEnabled(option) {
3
+ return Boolean(option);
4
+ }
5
+
6
+ //#endregion
7
+ export { isEnabled };