@favorodera/eslint-config 0.0.6 → 0.0.8

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/dist/index.d.mts CHANGED
@@ -18329,6 +18329,43 @@ interface ConfigOptions {
18329
18329
  */
18330
18330
  declare function factory(options?: ConfigOptions): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
18331
18331
  //#endregion
18332
+ //#region src/globs.d.ts
18333
+ /** Glob pattern for matching JavaScript files */
18334
+ declare const jsGlob = "**/*.{js,cjs,mjs}";
18335
+ /** Glob pattern for matching TypeScript files */
18336
+ declare const tsGlob = "**/*.{ts,cts,mts}";
18337
+ /** Glob pattern for matching Vue single-file components */
18338
+ declare const vueGlob = "**/*.vue";
18339
+ /** Glob pattern for matching Markdown files */
18340
+ declare const mdGlob = "**/*.md";
18341
+ /** Glob pattern for matching virtual files extracted from Markdown */
18342
+ declare const mdInMdGlob = "**/*.md/*.md";
18343
+ /** Glob pattern for matching code blocks embedded in Markdown files */
18344
+ declare const codeInMdGlob = "**/*.md/**/*.{js,cjs,mjs,ts,cts,mts,vue}";
18345
+ /** Glob pattern for matching scripts files */
18346
+ declare const scriptsGlob = "**/*.{js,cjs,mjs,ts,cts,mts}";
18347
+ /** Glob pattern for matching test files */
18348
+ declare const testGlob = "**/*.{test,spec,bench,benchmark}.{js,cjs,mjs,ts,cts,mts}";
18349
+ /** Glob pattern for matching JSON files */
18350
+ declare const jsonGlob = "**/*.json";
18351
+ /** Glob pattern for matching JSON5 files */
18352
+ declare const json5Glob = "**/*.json5";
18353
+ /** Glob pattern for matching JSON with Comments files */
18354
+ declare const jsoncGlob = "**/*.jsonc";
18355
+ /** Glob patterns for matching TypeScript configuration files */
18356
+ declare const tsConfigGlob: string[];
18357
+ /** Glob pattern for matching YAML files */
18358
+ declare const yamlGlob = "**/*.{yml,yaml}";
18359
+ /** Glob pattern for matching pnpm-workspace.yaml file */
18360
+ declare const pnpmWorkspaceGlob = "pnpm-workspace.yaml";
18361
+ /** Glob pattern for matching package.json files */
18362
+ declare const packageJsonGlob = "**/package.json";
18363
+ /**
18364
+ * Common glob patterns for files and directories that should be ignored by ESLint.
18365
+ * Includes node_modules, build outputs, lock files, temporary files, and tool-specific caches.
18366
+ */
18367
+ declare const ignoresGlob: string[];
18368
+ //#endregion
18332
18369
  //#region src/utils.d.ts
18333
18370
  /**
18334
18371
  * Extracts and merges the rules from multiple ESLint configuration arrays.
@@ -18352,4 +18389,4 @@ declare function importModule<TModule>(module: Awaitable<TModule>): Promise<TMod
18352
18389
  default: infer TModuleDefault;
18353
18390
  } ? TModuleDefault : TModule>;
18354
18391
  //#endregion
18355
- export { type ConfigNames, type ConfigOptions, type RuleOptions, type Rules, type SharedOptions, type TypedFlatConfigItem, extractRules, factory, importModule };
18392
+ export { type ConfigNames, type ConfigOptions, type RuleOptions, type Rules, type SharedOptions, type TypedFlatConfigItem, codeInMdGlob, extractRules, factory, ignoresGlob, importModule, jsGlob, json5Glob, jsonGlob, jsoncGlob, mdGlob, mdInMdGlob, packageJsonGlob, pnpmWorkspaceGlob, scriptsGlob, testGlob, tsConfigGlob, tsGlob, vueGlob, yamlGlob };
package/dist/index.mjs CHANGED
@@ -16,8 +16,10 @@ const mdGlob = "**/*.md";
16
16
  const mdInMdGlob = "**/*.md/*.md";
17
17
  /** Glob pattern for matching code blocks embedded in Markdown files */
18
18
  const codeInMdGlob = "**/*.md/**/*.{js,cjs,mjs,ts,cts,mts,vue}";
19
+ /** Glob pattern for matching scripts files */
20
+ const scriptsGlob = "**/*.{js,cjs,mjs,ts,cts,mts}";
19
21
  /** Glob pattern for matching test files */
20
- const testsGlob = ["**/*.{tests,specs,benchmark,bench}.{js,cjs,mjs,ts,cts,mts}", "**/__tests__/**/*.{js,cjs,mjs,ts,cts,mts}"];
22
+ const testGlob = "**/*.{test,spec,bench,benchmark}.{js,cjs,mjs,ts,cts,mts}";
21
23
  /** Glob pattern for matching JSON files */
22
24
  const jsonGlob = "**/*.json";
23
25
  /** Glob pattern for matching JSON5 files */
@@ -32,9 +34,11 @@ const yamlGlob = "**/*.{yml,yaml}";
32
34
  const pnpmWorkspaceGlob = "pnpm-workspace.yaml";
33
35
  /** Glob pattern for matching package.json files */
34
36
  const packageJsonGlob = "**/package.json";
35
- //#endregion
36
- //#region src/configs/ignores.ts
37
- const defaultPatterns = [
37
+ /**
38
+ * Common glob patterns for files and directories that should be ignored by ESLint.
39
+ * Includes node_modules, build outputs, lock files, temporary files, and tool-specific caches.
40
+ */
41
+ const ignoresGlob = [
38
42
  "**/node_modules/**",
39
43
  "**/dist/**",
40
44
  "**/package-lock.json",
@@ -71,6 +75,9 @@ const defaultPatterns = [
71
75
  "**/.agents",
72
76
  "**/.*/skills"
73
77
  ];
78
+ //#endregion
79
+ //#region src/configs/ignores.ts
80
+ const defaultPatterns = ignoresGlob;
74
81
  /**
75
82
  * Globs for ignoring files and directories from ESLint scanning.
76
83
  * @param patterns Additional ignore patterns or a function to modify the defaults.
@@ -1034,7 +1041,7 @@ async function tailwind(options) {
1034
1041
  }
1035
1042
  //#endregion
1036
1043
  //#region src/configs/test.ts
1037
- const testDefaults = { files: testsGlob };
1044
+ const testDefaults = { files: [testGlob] };
1038
1045
  /**
1039
1046
  * Constructs the flat config items for test linting, extending
1040
1047
  * the recommended Vitest rule sets.
@@ -1055,14 +1062,59 @@ async function test(options) {
1055
1062
  name: "favorodera/test/rules",
1056
1063
  rules: {
1057
1064
  ...renamePluginsInRules(baseRules, { vitest: "test" }),
1065
+ "test/consistent-each-for": ["error", {
1066
+ describe: "for",
1067
+ it: "for",
1068
+ suite: "for",
1069
+ test: "for"
1070
+ }],
1058
1071
  "test/consistent-test-it": ["error", {
1059
1072
  fn: "it",
1060
1073
  withinDescribe: "it"
1061
1074
  }],
1062
- "test/no-identical-title": "error",
1063
- "test/no-import-node-test": "error",
1075
+ "test/consistent-vitest-vi": "error",
1076
+ "test/hoisted-apis-on-top": "error",
1077
+ "test/max-expects": "error",
1078
+ "test/max-nested-describe": "error",
1079
+ "test/no-alias-methods": "error",
1080
+ "test/no-conditional-in-test": "error",
1081
+ "test/no-conditional-tests": "error",
1082
+ "test/no-duplicate-hooks": "error",
1083
+ "test/no-hooks": "error",
1084
+ "test/no-large-snapshots": "warn",
1085
+ "test/no-test-prefixes": "error",
1086
+ "test/no-test-return-statement": "error",
1087
+ "test/padding-around-all": "error",
1088
+ "test/prefer-called-times": "error",
1089
+ "test/prefer-called-with": "error",
1090
+ "test/prefer-comparison-matcher": "error",
1091
+ "test/prefer-each": "error",
1092
+ "test/prefer-equality-matcher": "error",
1093
+ "test/prefer-expect-resolves": "error",
1094
+ "test/prefer-expect-type-of": "error",
1064
1095
  "test/prefer-hooks-in-order": "error",
1096
+ "test/prefer-hooks-on-top": "error",
1097
+ "test/prefer-import-in-mock": "error",
1098
+ "test/prefer-importing-vitest-globals": "error",
1065
1099
  "test/prefer-lowercase-title": "error",
1100
+ "test/prefer-mock-promise-shorthand": "error",
1101
+ "test/prefer-mock-return-shorthand": "error",
1102
+ "test/prefer-snapshot-hint": "error",
1103
+ "test/prefer-spy-on": "error",
1104
+ "test/prefer-strict-boolean-matchers": "error",
1105
+ "test/prefer-strict-equal": "error",
1106
+ "test/prefer-to-be": "error",
1107
+ "test/prefer-to-be-object": "error",
1108
+ "test/prefer-to-contain": "error",
1109
+ "test/prefer-to-have-been-called-times": "error",
1110
+ "test/prefer-to-have-length": "error",
1111
+ "test/prefer-todo": "error",
1112
+ "test/prefer-vi-mocked": "error",
1113
+ "test/require-awaited-expect-poll": "error",
1114
+ "test/require-hook": "error",
1115
+ "test/require-to-throw-message": "error",
1116
+ "test/require-top-level-describe": "error",
1117
+ "test/warn-todo": "warn",
1066
1118
  ...resolved.overrides
1067
1119
  }
1068
1120
  },
@@ -1088,7 +1140,7 @@ const typescriptDefaults = { files: [tsGlob] };
1088
1140
  async function typescript(options) {
1089
1141
  const resolved = defu(options, typescriptDefaults);
1090
1142
  const tsEsLint = await importModule(import("typescript-eslint"));
1091
- const baseRules = extractRules(tsEsLint.configs.recommended, tsEsLint.configs.strict);
1143
+ const baseRules = extractRules(tsEsLint.configs.strict, tsEsLint.configs.stylistic);
1092
1144
  return [{
1093
1145
  name: "favorodera/typescript/setup",
1094
1146
  plugins: { ts: tsEsLint.plugin }
@@ -1105,8 +1157,12 @@ async function typescript(options) {
1105
1157
  default: "generic",
1106
1158
  readonly: "generic"
1107
1159
  }],
1108
- "ts/consistent-type-imports": ["error", { prefer: "type-imports" }],
1109
- "ts/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }],
1160
+ "ts/consistent-type-imports": "error",
1161
+ "ts/default-param-last": "error",
1162
+ "ts/method-signature-style": "error",
1163
+ "ts/no-import-type-side-effects": "error",
1164
+ "ts/no-loop-func": "error",
1165
+ "ts/no-redeclare": "error",
1110
1166
  ...resolved.overrides
1111
1167
  }
1112
1168
  }];
@@ -1127,7 +1183,7 @@ const unicornDefaults = { files: [
1127
1183
  async function unicorn(options) {
1128
1184
  const resolved = defu(options, unicornDefaults);
1129
1185
  const unicornPlugin = await importModule(import("eslint-plugin-unicorn"));
1130
- const baseRules = unicornPlugin.configs.unopinionated?.rules || {};
1186
+ const baseRules = unicornPlugin.configs.recommended?.rules || {};
1131
1187
  return [{
1132
1188
  name: "favorodera/unicorn/setup",
1133
1189
  plugins: { unicorn: unicornPlugin }
@@ -1137,21 +1193,7 @@ async function unicorn(options) {
1137
1193
  name: "favorodera/unicorn/rules",
1138
1194
  rules: {
1139
1195
  ...baseRules,
1140
- "unicorn/consistent-empty-array-spread": "error",
1141
- "unicorn/error-message": "error",
1142
- "unicorn/escape-case": "error",
1143
- "unicorn/new-for-builtins": "error",
1144
- "unicorn/no-instanceof-builtins": "error",
1145
- "unicorn/no-new-array": "error",
1146
- "unicorn/no-new-buffer": "error",
1147
- "unicorn/number-literal-case": "error",
1148
- "unicorn/prefer-dom-node-text-content": "error",
1149
- "unicorn/prefer-includes": "error",
1150
- "unicorn/prefer-node-protocol": "error",
1151
- "unicorn/prefer-number-properties": "error",
1152
- "unicorn/prefer-string-starts-ends-with": "error",
1153
- "unicorn/prefer-type-error": "error",
1154
- "unicorn/throw-new-error": "error",
1196
+ "unicorn/filename-case": "off",
1155
1197
  ...resolved.overrides
1156
1198
  }
1157
1199
  }];
@@ -1181,7 +1223,7 @@ async function vue(options) {
1181
1223
  importModule(import("vue-eslint-parser")),
1182
1224
  importModule(import("typescript-eslint"))
1183
1225
  ]);
1184
- const baseRules = extractRules(vuePlugin.configs["flat/essential"], vuePlugin.configs["flat/strongly-recommended"], vuePlugin.configs["flat/recommended"]);
1226
+ const baseRules = extractRules(vuePlugin.configs["flat/recommended-error"]);
1185
1227
  const processor = sfcBlocks === false ? vuePlugin.processors[".vue"] : mergeProcessors([vuePlugin.processors[".vue"], vueBlocksProcessor(sfcBlocks)]);
1186
1228
  return [{
1187
1229
  languageOptions: { globals: {
@@ -1216,22 +1258,78 @@ async function vue(options) {
1216
1258
  processor,
1217
1259
  rules: {
1218
1260
  ...baseRules,
1261
+ "vue/block-lang": ["error", { script: { lang: "ts" } }],
1219
1262
  "vue/block-order": ["error", { order: [
1220
1263
  "script",
1221
1264
  "template",
1222
1265
  "style"
1223
1266
  ] }],
1224
1267
  "vue/block-tag-newline": ["error", {
1225
- multiline: "ignore",
1226
- singleline: "ignore"
1268
+ multiline: "always",
1269
+ singleline: "always"
1270
+ }],
1271
+ "vue/comment-directive": ["error", { reportUnusedDisableDirectives: true }],
1272
+ "vue/define-macros-order": ["error", {
1273
+ defineExposeLast: true,
1274
+ order: [
1275
+ "defineOptions",
1276
+ "definePage",
1277
+ "defineSlots",
1278
+ "defineEmits",
1279
+ "defineProps",
1280
+ "defineModel"
1281
+ ]
1227
1282
  }],
1228
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
1229
- "vue/component-options-name-casing": ["error", "PascalCase"],
1283
+ "vue/define-props-declaration": ["error", "type-based"],
1284
+ "vue/define-props-destructuring": ["error", { destructure: "never" }],
1230
1285
  "vue/multi-word-component-names": "off",
1231
- "vue/multiline-html-element-content-newline": ["error", {
1232
- allowEmptyLines: true,
1233
- ignores: ["pre", "textarea"]
1286
+ "vue/next-tick-style": ["error", "promise"],
1287
+ "vue/no-import-compiler-macros": "error",
1288
+ "vue/no-negated-v-if-condition": "error",
1289
+ "vue/no-reserved-component-names": ["error", {
1290
+ disallowVue3BuiltInComponents: true,
1291
+ disallowVueBuiltInComponents: true,
1292
+ htmlElementCaseSensitive: false
1234
1293
  }],
1294
+ "vue/no-root-v-if": "error",
1295
+ "vue/no-template-target-blank": "error",
1296
+ "vue/no-unused-emit-declarations": "error",
1297
+ "vue/no-unused-properties": "error",
1298
+ "vue/no-unused-refs": "error",
1299
+ "vue/no-use-v-else-with-v-for": "error",
1300
+ "vue/no-useless-mustaches": "error",
1301
+ "vue/no-useless-v-bind": "error",
1302
+ "vue/padding-line-between-blocks": "error",
1303
+ "vue/padding-line-between-tags": ["error", [
1304
+ {
1305
+ blankLine: "always",
1306
+ next: "*:multi-line",
1307
+ prev: "*:single-line"
1308
+ },
1309
+ {
1310
+ blankLine: "always",
1311
+ next: "*:single-line",
1312
+ prev: "*:multi-line"
1313
+ },
1314
+ {
1315
+ blankLine: "always",
1316
+ next: "*:multi-line",
1317
+ prev: "*:multi-line"
1318
+ },
1319
+ {
1320
+ blankLine: "never",
1321
+ next: "*:single-line",
1322
+ prev: "*:single-line"
1323
+ }
1324
+ ]],
1325
+ "vue/prefer-prop-type-boolean-first": "error",
1326
+ "vue/prefer-separate-static-class": "error",
1327
+ "vue/prefer-single-event-payload": "error",
1328
+ "vue/prefer-use-template-ref": "error",
1329
+ "vue/require-explicit-slots": "error",
1330
+ "vue/require-macro-variable-name": "error",
1331
+ "vue/slot-name-casing": ["error", "kebab-case"],
1332
+ "vue/v-for-delimiter-style": ["error", "in"],
1235
1333
  ...resolved.overrides
1236
1334
  }
1237
1335
  }];
@@ -1248,7 +1346,7 @@ const yamlDefaults = { files: [yamlGlob] };
1248
1346
  async function yaml(options) {
1249
1347
  const resolved = defu(options, yamlDefaults);
1250
1348
  const [yamlPlugin, yamlParser] = await Promise.all([importModule(import("eslint-plugin-yml")), importModule(import("yaml-eslint-parser"))]);
1251
- const baseRules = extractRules(yamlPlugin.configs.recommended);
1349
+ const baseRules = extractRules(yamlPlugin.configs.standard);
1252
1350
  return [
1253
1351
  {
1254
1352
  name: "favorodera/yaml/setup",
@@ -1260,28 +1358,11 @@ async function yaml(options) {
1260
1358
  name: "favorodera/yaml/rules",
1261
1359
  rules: {
1262
1360
  ...renamePluginsInRules(baseRules, { yml: "yaml" }),
1263
- "style/spaced-comment": "off",
1264
- "yaml/block-mapping": "error",
1265
- "yaml/block-mapping-question-indicator-newline": "error",
1266
- "yaml/block-sequence": "error",
1267
- "yaml/block-sequence-hyphen-indicator-newline": "error",
1268
- "yaml/flow-mapping-curly-newline": "error",
1269
- "yaml/flow-mapping-curly-spacing": "error",
1270
- "yaml/flow-sequence-bracket-newline": "error",
1271
- "yaml/flow-sequence-bracket-spacing": "error",
1272
- "yaml/indent": ["error", 2],
1273
- "yaml/key-spacing": "error",
1274
- "yaml/no-empty-key": "error",
1275
- "yaml/no-empty-sequence-entry": "error",
1276
- "yaml/no-irregular-whitespace": "error",
1277
- "yaml/no-tab-indent": "error",
1278
- "yaml/plain-scalar": "error",
1279
1361
  "yaml/quotes": ["error", {
1280
1362
  avoidEscape: true,
1281
1363
  prefer: "single"
1282
1364
  }],
1283
- "yaml/spaced-comment": "error",
1284
- "yaml/vue-custom-block/no-parsing-error": "error",
1365
+ "yaml/require-string-key": "error",
1285
1366
  ...resolved.overrides
1286
1367
  }
1287
1368
  },
@@ -1405,4 +1486,4 @@ function factory(options = {}) {
1405
1486
  return composer;
1406
1487
  }
1407
1488
  //#endregion
1408
- export { extractRules, factory, importModule };
1489
+ export { codeInMdGlob, extractRules, factory, ignoresGlob, importModule, jsGlob, json5Glob, jsonGlob, jsoncGlob, mdGlob, mdInMdGlob, packageJsonGlob, pnpmWorkspaceGlob, scriptsGlob, testGlob, tsConfigGlob, tsGlob, vueGlob, yamlGlob };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@favorodera/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "private": false,
6
6
  "description": "Opinionated, type-safe flat ESLint configuration factory for Vue, TypeScript, Tailwind, and more.",
7
7
  "author": "Favour Emeka <favorodera@gmail.com>",
@@ -28,14 +28,9 @@
28
28
  "linter"
29
29
  ],
30
30
  "exports": {
31
- ".": {
32
- "import": "./dist/index.mjs",
33
- "require": "./dist/index.cjs"
34
- },
31
+ ".": "./dist/index.mjs",
35
32
  "./package.json": "./package.json"
36
33
  },
37
- "main": "./dist/index.cjs",
38
- "module": "./dist/index.mjs",
39
34
  "types": "./dist/index.d.cts",
40
35
  "files": [
41
36
  "dist"