@ariel-salgado/eslint-config 0.0.3 → 0.0.5-beta.1

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.ts CHANGED
@@ -13883,6 +13883,9 @@ interface OptionsStylistic {
13883
13883
  }
13884
13884
  interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'semi'> {}
13885
13885
  interface StylisticOptions extends StylisticConfig, OptionsOverrides {}
13886
+ interface TailwindCSSOptions extends OptionsOverrides {
13887
+ entryPoint?: string;
13888
+ }
13886
13889
  interface OptionsOverrides {
13887
13890
  overrides?: TypedFlatConfigItem['rules'];
13888
13891
  }
@@ -14004,7 +14007,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
14004
14007
  *
14005
14008
  * @default false
14006
14009
  */
14007
- tailwindcss?: boolean | OptionsOverrides;
14010
+ tailwindcss?: boolean | TailwindCSSOptions;
14008
14011
  /**
14009
14012
  * Enable pnpm (workspace/catalogs) support.
14010
14013
  *
@@ -14194,11 +14197,9 @@ declare function javascript(options?: OptionsOverrides): Promise<TypedFlatConfig
14194
14197
  declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
14195
14198
  //#endregion
14196
14199
  //#region src/configs/tailwindcss.d.ts
14197
- declare function tailwindcss(options?: OptionsHasTailwindCSS & OptionsOverrides & OptionsFiles & {
14198
- userRules?: Record<string, any>;
14199
- }): Promise<TypedFlatConfigItem[]>;
14200
+ declare function tailwindcss(options?: OptionsHasTailwindCSS & TailwindCSSOptions & OptionsFiles): Promise<TypedFlatConfigItem[]>;
14200
14201
  //#endregion
14201
14202
  //#region src/configs/perfectionist.d.ts
14202
14203
  declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
14203
14204
  //#endregion
14204
- export { Awaitable, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTailwindCSS, OptionsHasTypeScript, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, ResolvedOptions, Rules, StylisticConfig, StylisticOptions, TypedFlatConfigItem, ariel, combine, comments, ariel as default, default_plugin_renaming, defaults, disables, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, markdown, morgan, node, parserPlain, perfectionist, pnpm, regexp, rename_rules, resolve_sub_options, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, toml, typescript, unicorn, yaml };
14205
+ export { Awaitable, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTailwindCSS, OptionsHasTypeScript, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, ResolvedOptions, Rules, StylisticConfig, StylisticOptions, TailwindCSSOptions, TypedFlatConfigItem, ariel, combine, comments, ariel as default, default_plugin_renaming, defaults, disables, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, markdown, morgan, node, parserPlain, perfectionist, pnpm, regexp, rename_rules, resolve_sub_options, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, toml, typescript, unicorn, yaml };
package/dist/index.js CHANGED
@@ -15,6 +15,76 @@ import plugin_comments from "@eslint-community/eslint-plugin-eslint-comments";
15
15
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
16
16
  import globals from "globals";
17
17
 
18
+ //#region src/globs.ts
19
+ const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
20
+ const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
21
+ const GLOB_JS = "**/*.?([cm])js";
22
+ const GLOB_TS = "**/*.?([cm])ts";
23
+ const GLOB_STYLE = "**/*.{c,le,sc}ss";
24
+ const GLOB_CSS = "**/*.css";
25
+ const GLOB_POSTCSS = "**/*.{p,post}css";
26
+ const GLOB_LESS = "**/*.less";
27
+ const GLOB_SCSS = "**/*.scss";
28
+ const GLOB_JSON = "**/*.json";
29
+ const GLOB_JSON5 = "**/*.json5";
30
+ const GLOB_JSONC = "**/*.jsonc";
31
+ const GLOB_MARKDOWN = "**/*.md";
32
+ const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
33
+ const GLOB_SVELTE = "**/*.svelte{,.ts,.js}";
34
+ const GLOB_YAML = "**/*.y?(a)ml";
35
+ const GLOB_TOML = "**/*.toml";
36
+ const GLOB_XML = "**/*.xml";
37
+ const GLOB_SVG = "**/*.svg";
38
+ const GLOB_HTML = "**/*.htm?(l)";
39
+ const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
40
+ const GLOB_TESTS = [
41
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
42
+ `**/*.spec.${GLOB_SRC_EXT}`,
43
+ `**/*.test.${GLOB_SRC_EXT}`,
44
+ `**/*.bench.${GLOB_SRC_EXT}`,
45
+ `**/*.benchmark.${GLOB_SRC_EXT}`
46
+ ];
47
+ const GLOB_ALL_SRC = [
48
+ GLOB_SRC,
49
+ GLOB_STYLE,
50
+ GLOB_JSON,
51
+ GLOB_JSON5,
52
+ GLOB_MARKDOWN,
53
+ GLOB_SVELTE,
54
+ GLOB_YAML,
55
+ GLOB_XML,
56
+ GLOB_HTML
57
+ ];
58
+ const GLOB_EXCLUDE = [
59
+ "**/node_modules",
60
+ "**/dist",
61
+ "**/package-lock.json",
62
+ "**/pnpm-lock.yaml",
63
+ "**/bun.lockb",
64
+ "**/output",
65
+ "**/coverage",
66
+ "**/temp",
67
+ "**/.temp",
68
+ "**/tmp",
69
+ "**/.tmp",
70
+ "**/.history",
71
+ "**/.svelte-kit",
72
+ "**/.vercel",
73
+ "**/.changeset",
74
+ "**/.idea",
75
+ "**/.cache",
76
+ "**/.output",
77
+ "**/.vite-inspect",
78
+ "**/vite.config.*.timestamp-*",
79
+ "**/CHANGELOG*.md",
80
+ "**/*.min.*",
81
+ "**/LICENSE*",
82
+ "**/__snapshots__",
83
+ "**/auto-import?(s).d.ts",
84
+ "**/components.d.ts"
85
+ ];
86
+
87
+ //#endregion
18
88
  //#region src/utils.ts
19
89
  const scope_url = fileURLToPath(new URL(".", import.meta.url));
20
90
  const is_cwd_in_scope = isPackageExists("@ariel/eslint-config");
@@ -345,76 +415,6 @@ async function sort_ts_config() {
345
415
  }];
346
416
  }
347
417
 
348
- //#endregion
349
- //#region src/globs.ts
350
- const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
351
- const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
352
- const GLOB_JS = "**/*.?([cm])js";
353
- const GLOB_TS = "**/*.?([cm])ts";
354
- const GLOB_STYLE = "**/*.{c,le,sc}ss";
355
- const GLOB_CSS = "**/*.css";
356
- const GLOB_POSTCSS = "**/*.{p,post}css";
357
- const GLOB_LESS = "**/*.less";
358
- const GLOB_SCSS = "**/*.scss";
359
- const GLOB_JSON = "**/*.json";
360
- const GLOB_JSON5 = "**/*.json5";
361
- const GLOB_JSONC = "**/*.jsonc";
362
- const GLOB_MARKDOWN = "**/*.md";
363
- const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
364
- const GLOB_SVELTE = "**/*.svelte{,.ts,.js}";
365
- const GLOB_YAML = "**/*.y?(a)ml";
366
- const GLOB_TOML = "**/*.toml";
367
- const GLOB_XML = "**/*.xml";
368
- const GLOB_SVG = "**/*.svg";
369
- const GLOB_HTML = "**/*.htm?(l)";
370
- const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
371
- const GLOB_TESTS = [
372
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
373
- `**/*.spec.${GLOB_SRC_EXT}`,
374
- `**/*.test.${GLOB_SRC_EXT}`,
375
- `**/*.bench.${GLOB_SRC_EXT}`,
376
- `**/*.benchmark.${GLOB_SRC_EXT}`
377
- ];
378
- const GLOB_ALL_SRC = [
379
- GLOB_SRC,
380
- GLOB_STYLE,
381
- GLOB_JSON,
382
- GLOB_JSON5,
383
- GLOB_MARKDOWN,
384
- GLOB_SVELTE,
385
- GLOB_YAML,
386
- GLOB_XML,
387
- GLOB_HTML
388
- ];
389
- const GLOB_EXCLUDE = [
390
- "**/node_modules",
391
- "**/dist",
392
- "**/package-lock.json",
393
- "**/pnpm-lock.yaml",
394
- "**/bun.lockb",
395
- "**/output",
396
- "**/coverage",
397
- "**/temp",
398
- "**/.temp",
399
- "**/tmp",
400
- "**/.tmp",
401
- "**/.history",
402
- "**/.svelte-kit",
403
- "**/.vercel",
404
- "**/.changeset",
405
- "**/.idea",
406
- "**/.cache",
407
- "**/.output",
408
- "**/.vite-inspect",
409
- "**/vite.config.*.timestamp-*",
410
- "**/CHANGELOG*.md",
411
- "**/*.min.*",
412
- "**/LICENSE*",
413
- "**/__snapshots__",
414
- "**/auto-import?(s).d.ts",
415
- "**/components.d.ts"
416
- ];
417
-
418
418
  //#endregion
419
419
  //#region src/configs/test.ts
420
420
  let _plugin_test;
@@ -1365,21 +1365,15 @@ async function typescript(options = {}) {
1365
1365
  //#endregion
1366
1366
  //#region src/configs/tailwindcss.ts
1367
1367
  async function tailwindcss(options = {}) {
1368
- const { files = [GLOB_SVELTE], overrides = {}, userRules = {} } = options;
1368
+ const { files = [GLOB_SVELTE], overrides = {}, entryPoint = "src/app.css" } = options;
1369
1369
  await ensure_packages(["tailwindcss", "eslint-plugin-better-tailwindcss"]);
1370
1370
  const plugin_tailwindcss = await interop_default(import("eslint-plugin-better-tailwindcss"));
1371
- const tailwindcss_user_rules = Object.entries(userRules).filter(([key]) => key.startsWith("tailwindcss/")).reduce((acc, [key, value]) => {
1372
- acc[key] = value;
1373
- return acc;
1374
- }, {});
1375
1371
  return [{
1376
1372
  name: "ariel/tailwindcss",
1377
1373
  plugins: { tailwindcss: plugin_tailwindcss },
1378
1374
  files,
1379
- rules: {
1380
- ...plugin_tailwindcss.configs.recommended.rules,
1381
- ...tailwindcss_user_rules
1382
- },
1375
+ rules: { ...plugin_tailwindcss.configs.recommended.rules },
1376
+ settings: { tailwindcss: { entryPoint } },
1383
1377
  ...overrides
1384
1378
  }];
1385
1379
  }
@@ -1490,18 +1484,18 @@ function ariel(options = {}, ...userConfigs) {
1490
1484
  name: "ariel/gitignore",
1491
1485
  strict: false
1492
1486
  })]));
1493
- const extractedTailwindcssRules = {};
1494
- const cleanedUserConfigs = [];
1487
+ const extracted_tailwindcss_rules = {};
1488
+ const cleaned_user_configs = [];
1495
1489
  for (const config of userConfigs) if (config && typeof config === "object" && "rules" in config) {
1496
1490
  const { rules,...restConfig } = config;
1497
1491
  const nonTailwindcssRules = {};
1498
- if (rules) for (const [ruleName, ruleConfig] of Object.entries(rules)) if (ruleName.startsWith("tailwindcss/")) extractedTailwindcssRules[ruleName] = ruleConfig;
1492
+ if (rules) for (const [ruleName, ruleConfig] of Object.entries(rules)) if (ruleName.startsWith("tailwindcss/")) extracted_tailwindcss_rules[ruleName] = ruleConfig;
1499
1493
  else nonTailwindcssRules[ruleName] = ruleConfig;
1500
- if (Object.keys(nonTailwindcssRules).length > 0 || Object.keys(restConfig).length > 0) cleanedUserConfigs.push({
1494
+ if (Object.keys(nonTailwindcssRules).length > 0 || Object.keys(restConfig).length > 0) cleaned_user_configs.push({
1501
1495
  ...restConfig,
1502
1496
  ...Object.keys(nonTailwindcssRules).length > 0 ? { rules: nonTailwindcssRules } : {}
1503
1497
  });
1504
- } else cleanedUserConfigs.push(config);
1498
+ } else cleaned_user_configs.push(config);
1505
1499
  const typescript_options = resolve_sub_options(options, "typescript");
1506
1500
  configs.push(ignores(options.ignores), javascript({ overrides: get_overrides(options, "javascript") }), comments(), node(), jsdoc({ stylistic: stylistic_options }), imports({ stylistic: stylistic_options }), perfectionist(), morgan());
1507
1501
  if (enable_imports) configs.push(imports(enable_imports === true ? { stylistic: stylistic_options } : {
@@ -1528,7 +1522,10 @@ function ariel(options = {}, ...userConfigs) {
1528
1522
  }));
1529
1523
  if (enable_tailwindcss) configs.push(tailwindcss({
1530
1524
  overrides: get_overrides(options, "tailwindcss"),
1531
- userRules: extractedTailwindcssRules
1525
+ ...enable_svelte ? {
1526
+ files: [GLOB_SVELTE],
1527
+ entryPoint: "src/app.css"
1528
+ } : {}
1532
1529
  }));
1533
1530
  if (options.jsonc ?? true) configs.push(jsonc({
1534
1531
  overrides: get_overrides(options, "jsonc"),
@@ -1555,7 +1552,7 @@ function ariel(options = {}, ...userConfigs) {
1555
1552
  }, {});
1556
1553
  if (Object.keys(merged_config).length) configs.push([merged_config]);
1557
1554
  let composer = new FlatConfigComposer();
1558
- composer = composer.append(...configs, ...cleanedUserConfigs);
1555
+ composer = composer.append(...configs, ...cleaned_user_configs);
1559
1556
  if (autoRenamePlugins) composer = composer.renamePlugins(default_plugin_renaming);
1560
1557
  if (is_in_editor) composer = composer.disableRulesFix([
1561
1558
  "unused-imports/no-unused-imports",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ariel-salgado/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5-beta.1",
5
5
  "description": "ESLint config for @ariel-salgado.",
6
6
  "author": "Ariel Salgado <ariel.salgado.acevedo@gmail.com>",
7
7
  "license": "MIT",