@favorodera/eslint-config 0.0.10 → 0.0.11

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
@@ -18125,7 +18125,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
18125
18125
  exceptRange?: boolean;
18126
18126
  onlyEquality?: boolean;
18127
18127
  }]; // Names of all the configs
18128
- type ConfigNames = 'favorodera/ignores' | 'favorodera/imports/setup' | 'favorodera/imports/rules' | 'favorodera/javascript/setup' | 'favorodera/javascript/rules' | 'favorodera/jsdoc/setup' | 'favorodera/jsdoc/rules' | 'favorodera/jsonc/setup' | 'favorodera/jsonc/rules' | 'favorodera/jsonc/sort/package-json' | 'favorodera/jsonc/sort/tsconfig-json' | 'favorodera/markdown/setup' | 'favorodera/markdown/rules' | 'favorodera/markdown/code-in-md/disables' | 'favorodera/node/setup' | 'favorodera/node/rules' | 'favorodera/perfectionist/setup' | 'favorodera/perfectionist/rules' | 'favorodera/pnpm/setup' | 'favorodera/pnpm/package-json' | 'favorodera/pnpm/pnpm-workspace-yaml' | 'favorodera/stylistic/setup' | 'favorodera/stylistic/rules' | 'favorodera/tailwind/setup' | 'favorodera/tailwind/rules' | 'favorodera/test/setup' | 'favorodera/test/rules' | 'favorodera/test/disables' | 'favorodera/typescript/setup' | 'favorodera/typescript/rules' | 'favorodera/unicorn/setup' | 'favorodera/unicorn/rules' | 'favorodera/vue/setup' | 'favorodera/vue/rules' | 'favorodera/yaml/setup' | 'favorodera/yaml/rules' | 'favorodera/yaml/sort/pnpm-workspace-yaml';
18128
+ type ConfigNames = 'favorodera/ignores' | 'favorodera/imports/setup' | 'favorodera/imports/rules' | 'favorodera/javascript/setup' | 'favorodera/javascript/rules' | 'favorodera/jsdoc/setup' | 'favorodera/jsdoc/rules' | 'favorodera/jsonc/setup' | 'favorodera/jsonc/rules' | 'favorodera/jsonc/sort/package-json' | 'favorodera/jsonc/sort/tsconfig-json' | 'favorodera/jsonc/disables' | 'favorodera/markdown/setup' | 'favorodera/markdown/rules' | 'favorodera/markdown/code-in-md/disables' | 'favorodera/node/setup' | 'favorodera/node/rules' | 'favorodera/node/disables' | 'favorodera/perfectionist/setup' | 'favorodera/perfectionist/rules' | 'favorodera/pnpm/setup' | 'favorodera/pnpm/package-json' | 'favorodera/pnpm/pnpm-workspace-yaml' | 'favorodera/stylistic/setup' | 'favorodera/stylistic/rules' | 'favorodera/tailwind/setup' | 'favorodera/tailwind/rules' | 'favorodera/test/setup' | 'favorodera/test/rules' | 'favorodera/test/disables' | 'favorodera/typescript/setup' | 'favorodera/typescript/rules' | 'favorodera/unicorn/setup' | 'favorodera/unicorn/rules' | 'favorodera/vue/setup' | 'favorodera/vue/rules' | 'favorodera/yaml/setup' | 'favorodera/yaml/rules' | 'favorodera/yaml/sort/pnpm-workspace-yaml';
18129
18129
  //#endregion
18130
18130
  //#region src/types/utils.d.ts
18131
18131
  /** ESLint rules configuration with type-safe autocompletion */
@@ -18196,7 +18196,80 @@ type NodeConfigOptions = SharedOptions;
18196
18196
  //#endregion
18197
18197
  //#region src/configs/perfectionist.d.ts
18198
18198
  /** Options for configuring Perfectionist linting rules. */
18199
- type PerfectionistConfigOptions = SharedOptions;
18199
+ type PerfectionistConfigOptions = SharedOptions & {
18200
+ /**
18201
+ * Global settings for the Perfectionist plugin, applied to all rules
18202
+ * unless overridden by rule-specific options.
18203
+ * @see https://perfectionist.dev/guide/getting-started#settings
18204
+ * @see https://perfectionist.dev/configs/recommended-custom
18205
+ */
18206
+ settings?: {
18207
+ /**
18208
+ * The type of sorting algorithm.
18209
+ * @default 'natural'
18210
+ */
18211
+ type?: 'alphabetical' | 'custom' | 'line-length' | 'natural';
18212
+ /**
18213
+ * The order of sorting.
18214
+ * @default 'asc'
18215
+ */
18216
+ order?: 'asc' | 'desc';
18217
+ /**
18218
+ * The fallback sorting type and order used when two elements are equal
18219
+ * under the primary comparison.
18220
+ */
18221
+ fallbackSort?: {
18222
+ order?: 'asc' | 'desc';
18223
+ type: 'alphabetical' | 'custom' | 'line-length' | 'natural';
18224
+ };
18225
+ /**
18226
+ * Custom alphabet string for the `'custom'` sort type.
18227
+ * Defines the exact character order to use.
18228
+ */
18229
+ alphabet?: string;
18230
+ /**
18231
+ * Ignore case when sorting.
18232
+ * @default true
18233
+ */
18234
+ ignoreCase?: boolean;
18235
+ /**
18236
+ * Control whether special characters should be kept, trimmed or removed
18237
+ * before sorting.
18238
+ * @default 'keep'
18239
+ */
18240
+ specialCharacters?: 'keep' | 'remove' | 'trim';
18241
+ /**
18242
+ * Locale(s) used for locale-aware string comparison.
18243
+ * A BCP 47 language tag or an array of such tags.
18244
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#locales
18245
+ * @default 'en-US'
18246
+ */
18247
+ locales?: Array<string> | string;
18248
+ /**
18249
+ * Partition sorted elements by comments.
18250
+ * Can be `true`, `false`, a regexp pattern string, or an array of patterns.
18251
+ * @default true
18252
+ */
18253
+ partitionByComment?: Array<string> | boolean | string;
18254
+ /**
18255
+ * Partition sorted elements by newlines.
18256
+ * @default true
18257
+ */
18258
+ partitionByNewLine?: boolean;
18259
+ /**
18260
+ * Specifies how to handle newlines between groups.
18261
+ * `'ignore'` preserves existing newlines; a number enforces that many blank lines.
18262
+ * @default 'ignore'
18263
+ */
18264
+ newlinesBetween?: 'ignore' | number;
18265
+ /**
18266
+ * Specifies how to handle newlines between elements of each group.
18267
+ * `'ignore'` preserves existing newlines; a number enforces that many blank lines.
18268
+ * @default 'ignore'
18269
+ */
18270
+ newlinesInside?: 'ignore' | 'newlinesBetween' | number;
18271
+ };
18272
+ };
18200
18273
  //#endregion
18201
18274
  //#region src/configs/stylistic.d.ts
18202
18275
  /** Options for configuring Stylistic formatting rules. */
@@ -18210,6 +18283,7 @@ type TailwindConfigOptions = SharedOptions & {
18210
18283
  /**
18211
18284
  * Custom settings for the `eslint-plugin-better-tailwindcss` plugin.
18212
18285
  * Configure project paths, detection features, and rule specifics.
18286
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md
18213
18287
  */
18214
18288
  settings?: {
18215
18289
  /**
package/dist/index.mjs CHANGED
@@ -462,7 +462,9 @@ async function jsonc(options) {
462
462
  language: "jsonc/x",
463
463
  name: "favorodera/jsonc/rules",
464
464
  rules: {
465
+ "jsonc/array-bracket-newline": "error",
465
466
  "jsonc/array-bracket-spacing": ["error", "never"],
467
+ "jsonc/array-element-newline": "error",
466
468
  "jsonc/comma-dangle": ["error", "never"],
467
469
  "jsonc/comma-style": ["error", "last"],
468
470
  "jsonc/indent": ["error", 2],
@@ -478,6 +480,7 @@ async function jsonc(options) {
478
480
  "jsonc/no-floating-decimal": "error",
479
481
  "jsonc/no-hexadecimal-numeric-literals": "error",
480
482
  "jsonc/no-infinity": "error",
483
+ "jsonc/no-irregular-whitespace": "error",
481
484
  "jsonc/no-multi-str": "error",
482
485
  "jsonc/no-nan": "error",
483
486
  "jsonc/no-number-props": "error",
@@ -498,7 +501,7 @@ async function jsonc(options) {
498
501
  multiline: true
499
502
  }],
500
503
  "jsonc/object-curly-spacing": ["error", "always"],
501
- "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
504
+ "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: false }],
502
505
  "jsonc/quote-props": "error",
503
506
  "jsonc/quotes": "error",
504
507
  "jsonc/space-unary-ops": "error",
@@ -723,6 +726,12 @@ async function jsonc(options) {
723
726
  pathPattern: "^compilerOptions$"
724
727
  }
725
728
  ] }
729
+ },
730
+ {
731
+ files: resolved.files,
732
+ language: "jsonc/x",
733
+ name: "favorodera/jsonc/disables",
734
+ rules: { "no-irregular-whitespace": "off" }
726
735
  }
727
736
  ];
728
737
  }
@@ -809,36 +818,68 @@ const nodeDefaults = { files: [
809
818
  async function node(options) {
810
819
  const resolved = defu(options, nodeDefaults);
811
820
  const nodePlugin = await importModule(import("eslint-plugin-n"));
812
- const baseRules = nodePlugin.configs?.["flat/recommended"]?.rules || {};
813
- return [{
814
- name: "favorodera/node/setup",
815
- plugins: { node: nodePlugin }
816
- }, {
817
- files: resolved.files,
818
- name: "favorodera/node/rules",
819
- rules: {
820
- ...renamePluginsInRules(baseRules, { n: "node" }),
821
- "node/handle-callback-err": ["error", "^(err|error)$"],
822
- "node/no-deprecated-api": "error",
823
- "node/no-exports-assign": "error",
824
- "node/no-missing-import": "off",
825
- "node/no-new-require": "error",
826
- "node/no-path-concat": "error",
827
- "node/no-unpublished-import": "off",
828
- "node/prefer-global/buffer": ["error", "never"],
829
- "node/prefer-global/process": ["error", "never"],
830
- "node/process-exit-as-throw": "error",
831
- ...resolved.overrides
821
+ const baseRules = nodePlugin.configs?.["flat/recommended-module"]?.rules || {};
822
+ return [
823
+ {
824
+ name: "favorodera/node/setup",
825
+ plugins: { node: nodePlugin }
826
+ },
827
+ {
828
+ files: resolved.files,
829
+ name: "favorodera/node/rules",
830
+ rules: {
831
+ ...renamePluginsInRules(baseRules, { n: "node" }),
832
+ "node/callback-return": "error",
833
+ "node/handle-callback-err": ["error", "^(err|error)$"],
834
+ "node/no-callback-literal": "error",
835
+ "node/no-new-require": "error",
836
+ "node/no-path-concat": "error",
837
+ "node/no-unpublished-import": "error",
838
+ "node/prefer-global/buffer": "error",
839
+ "node/prefer-global/console": "error",
840
+ "node/prefer-global/crypto": "error",
841
+ "node/prefer-global/process": "error",
842
+ "node/prefer-global/text-decoder": "error",
843
+ "node/prefer-global/text-encoder": "error",
844
+ "node/prefer-global/timers": "error",
845
+ "node/prefer-global/url": "error",
846
+ "node/prefer-global/url-search-params": "error",
847
+ "node/prefer-node-protocol": "error",
848
+ "node/prefer-promises/dns": "error",
849
+ "node/prefer-promises/fs": "error",
850
+ ...resolved.overrides
851
+ }
852
+ },
853
+ {
854
+ files: [tsGlob, vueGlob],
855
+ name: "favorodera/node/disables",
856
+ rules: {
857
+ "node/no-missing-import": "off",
858
+ "node/no-missing-require": "off"
859
+ }
832
860
  }
833
- }];
861
+ ];
834
862
  }
835
863
  //#endregion
836
864
  //#region src/configs/perfectionist.ts
837
- const perfectionistDefaults = { files: [
838
- jsGlob,
839
- tsGlob,
840
- vueGlob
841
- ] };
865
+ const perfectionistDefaults = {
866
+ files: [
867
+ jsGlob,
868
+ tsGlob,
869
+ vueGlob
870
+ ],
871
+ settings: {
872
+ ignoreCase: true,
873
+ locales: "en-US",
874
+ newlinesBetween: "ignore",
875
+ newlinesInside: "ignore",
876
+ order: "asc",
877
+ partitionByComment: true,
878
+ partitionByNewLine: true,
879
+ specialCharacters: "keep",
880
+ type: "natural"
881
+ }
882
+ };
842
883
  /**
843
884
  * Constructs the flat config items for Perfectionist linting, providing rules
844
885
  * to naturally sort objects, imports, classes, and other elements in your code.
@@ -848,53 +889,17 @@ const perfectionistDefaults = { files: [
848
889
  async function perfectionist(options) {
849
890
  const resolved = defu(options, perfectionistDefaults);
850
891
  const perfectionistPlugin = await importModule(import("eslint-plugin-perfectionist"));
851
- const baseRules = perfectionistPlugin.configs["recommended-natural"]?.rules || {};
892
+ const safeType = resolved.settings?.type ?? "natural";
893
+ const baseRules = perfectionistPlugin.configs[`recommended-${safeType}`]?.rules || {};
852
894
  return [{
853
895
  name: "favorodera/perfectionist/setup",
854
- plugins: { perfectionist: perfectionistPlugin }
896
+ plugins: { perfectionist: perfectionistPlugin },
897
+ settings: { perfectionist: resolved.settings }
855
898
  }, {
856
899
  files: resolved.files,
857
900
  name: "favorodera/perfectionist/rules",
858
901
  rules: {
859
902
  ...baseRules,
860
- "perfectionist/sort-exports": ["error", {
861
- order: "asc",
862
- type: "natural"
863
- }],
864
- "perfectionist/sort-imports": ["error", {
865
- groups: [
866
- "type-import",
867
- [
868
- "type-parent",
869
- "type-sibling",
870
- "type-index",
871
- "type-internal"
872
- ],
873
- "value-builtin",
874
- "value-external",
875
- "value-internal",
876
- [
877
- "value-parent",
878
- "value-sibling",
879
- "value-index"
880
- ],
881
- "side-effect",
882
- "ts-equals-import",
883
- "unknown"
884
- ],
885
- newlinesBetween: "ignore",
886
- newlinesInside: "ignore",
887
- order: "asc",
888
- type: "natural"
889
- }],
890
- "perfectionist/sort-named-exports": ["error", {
891
- order: "asc",
892
- type: "natural"
893
- }],
894
- "perfectionist/sort-named-imports": ["error", {
895
- order: "asc",
896
- type: "natural"
897
- }],
898
903
  ...resolved.overrides
899
904
  }
900
905
  }];
@@ -919,6 +924,12 @@ async function pnpm() {
919
924
  rules: {
920
925
  "pnpm/json-enforce-catalog": ["error", {
921
926
  autofix: true,
927
+ fields: [
928
+ "dependencies",
929
+ "devDependencies",
930
+ "optionalDependencies",
931
+ "peerDependencies"
932
+ ],
922
933
  ignores: ["@types/vscode"]
923
934
  }],
924
935
  "pnpm/json-prefer-workspace-settings": ["error", { autofix: true }],
@@ -935,7 +946,8 @@ async function pnpm() {
935
946
  trustPolicy: "no-downgrade"
936
947
  } }],
937
948
  "pnpm/yaml-no-duplicate-catalog-item": ["error", { checkDuplicates: "exact-version" }],
938
- "pnpm/yaml-no-unused-catalog-item": "error"
949
+ "pnpm/yaml-no-unused-catalog-item": "error",
950
+ "pnpm/yaml-valid-packages": "error"
939
951
  }
940
952
  }
941
953
  ];
@@ -987,7 +999,7 @@ async function stylistic(options) {
987
999
  "style/implicit-arrow-linebreak": "error",
988
1000
  "style/line-comment-position": "error",
989
1001
  "style/linebreak-style": "error",
990
- "style/multiline-comment-style": "error",
1002
+ "style/multiline-comment-style": ["error", "separate-lines"],
991
1003
  "style/newline-per-chained-call": "error",
992
1004
  "style/no-confusing-arrow": "error",
993
1005
  "style/no-extra-semi": "error",
@@ -1039,11 +1051,11 @@ async function tailwind(options) {
1039
1051
  unknownClassOrder: "asc",
1040
1052
  unknownClassPosition: "start"
1041
1053
  }],
1042
- "tailwind/enforce-consistent-important-position": "off",
1043
1054
  "tailwind/enforce-consistent-line-wrapping": ["error", { group: "emptyLine" }],
1044
- "tailwind/enforce-consistent-variable-syntax": "off",
1045
1055
  "tailwind/enforce-consistent-variant-order": "error",
1046
1056
  "tailwind/enforce-logical-properties": "error",
1057
+ "tailwind/enforce-consistent-important-position": "off",
1058
+ "tailwind/enforce-consistent-variable-syntax": "off",
1047
1059
  "tailwind/enforce-shorthand-classes": "off",
1048
1060
  ...resolved.overrides
1049
1061
  }
@@ -1131,10 +1143,7 @@ async function test(options) {
1131
1143
  {
1132
1144
  files: resolved.files,
1133
1145
  name: "favorodera/test/disables",
1134
- rules: {
1135
- "no-unused-expressions": "off",
1136
- "node/prefer-global/process": "off"
1137
- }
1146
+ rules: { "no-unused-expressions": "off" }
1138
1147
  }
1139
1148
  ];
1140
1149
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@favorodera/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
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>",