@vinicunca/eslint-config 2.3.0 → 2.4.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.
package/dist/index.js CHANGED
@@ -759,8 +759,8 @@ function zip_(first2, second) {
759
759
  // src/base.ts
760
760
  import { FlatConfigPipeline } from "eslint-flat-config-utils";
761
761
  import { isPackageExists } from "local-pkg";
762
- import fs from "fs";
763
- import process2 from "process";
762
+ import fs from "node:fs";
763
+ import process2 from "node:process";
764
764
 
765
765
  // src/flags.ts
766
766
  var ERROR = "error";
@@ -866,6 +866,341 @@ var GLOB_EXCLUDE = [
866
866
  "**/components.d.ts"
867
867
  ];
868
868
 
869
+ // src/utils.ts
870
+ async function combineConfigs(...configs) {
871
+ const resolved = await Promise.all(configs);
872
+ return resolved.flat();
873
+ }
874
+ function renameRules(rules, map2) {
875
+ return Object.fromEntries(
876
+ Object.entries(rules).map(([key, value]) => {
877
+ for (const [from, to] of Object.entries(map2)) {
878
+ if (key.startsWith(`${from}/`)) {
879
+ return [to + key.slice(from.length), value];
880
+ }
881
+ }
882
+ return [key, value];
883
+ })
884
+ );
885
+ }
886
+ function renamePluginInConfigs(configs, map2) {
887
+ return configs.map((i) => {
888
+ const clone = { ...i };
889
+ if (clone.rules) {
890
+ clone.rules = renameRules(clone.rules, map2);
891
+ }
892
+ if (clone.plugins) {
893
+ clone.plugins = Object.fromEntries(
894
+ Object.entries(clone.plugins).map(([key, value]) => {
895
+ if (key in map2) {
896
+ return [map2[key], value];
897
+ }
898
+ return [key, value];
899
+ })
900
+ );
901
+ }
902
+ return clone;
903
+ });
904
+ }
905
+ async function interopDefault(m) {
906
+ const resolved = await m;
907
+ return resolved.default || resolved;
908
+ }
909
+ var parserPlain = {
910
+ meta: {
911
+ name: "parser-plain"
912
+ },
913
+ parseForESLint: (code) => ({
914
+ ast: {
915
+ body: [],
916
+ comments: [],
917
+ loc: { end: code.length, start: 0 },
918
+ range: [0, code.length],
919
+ tokens: [],
920
+ type: "Program"
921
+ },
922
+ scopeManager: null,
923
+ services: { isPlain: true },
924
+ visitorKeys: {
925
+ Program: []
926
+ }
927
+ })
928
+ };
929
+ function toArray(value) {
930
+ return Array.isArray(value) ? value : [value];
931
+ }
932
+
933
+ // src/configs/stylistic.ts
934
+ var STR_PARENS_NEW_LINE = "parens-new-line";
935
+ var STYLISTIC_CONFIG_DEFAULTS = {
936
+ indent: 2,
937
+ jsx: true,
938
+ quotes: "single",
939
+ semi: true
940
+ };
941
+ async function stylistic(options = {}) {
942
+ const {
943
+ indent,
944
+ jsx,
945
+ overrides = {},
946
+ quotes,
947
+ semi
948
+ } = {
949
+ ...STYLISTIC_CONFIG_DEFAULTS,
950
+ ...options
951
+ };
952
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
953
+ const config = pluginStylistic.configs.customize({
954
+ flat: true,
955
+ indent,
956
+ jsx,
957
+ pluginName: "style",
958
+ quotes,
959
+ semi
960
+ });
961
+ return [
962
+ {
963
+ name: "vinicunca:stylistic",
964
+ plugins: {
965
+ style: pluginStylistic,
966
+ vinicunca: default2
967
+ },
968
+ rules: {
969
+ ...config.rules,
970
+ "curly": [ERROR, "all"],
971
+ "style/array-bracket-newline": [ERROR, CONSISTENT],
972
+ "style/array-bracket-spacing": [ERROR, NEVER],
973
+ "style/array-element-newline": [ERROR, CONSISTENT],
974
+ "style/arrow-parens": [ERROR, ALWAYS],
975
+ "style/brace-style": [ERROR],
976
+ "style/func-call-spacing": [ERROR, NEVER],
977
+ "style/jsx-child-element-spacing": OFF,
978
+ "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
979
+ "style/jsx-closing-tag-location": ERROR,
980
+ "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
981
+ "style/jsx-curly-newline": [ERROR, {
982
+ multiline: "consistent",
983
+ singleline: "consistent"
984
+ }],
985
+ "style/jsx-curly-spacing": [ERROR, {
986
+ children: true,
987
+ spacing: {
988
+ objectLiterals: NEVER
989
+ },
990
+ when: "always"
991
+ }],
992
+ "style/jsx-equals-spacing": [ERROR, NEVER],
993
+ "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
994
+ "style/jsx-indent": [ERROR, 2],
995
+ "style/jsx-indent-props": [ERROR, 2],
996
+ "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
997
+ "style/jsx-newline": ERROR,
998
+ "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
999
+ "style/jsx-props-no-multi-spaces": ERROR,
1000
+ // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1001
+ "style/jsx-sort-props": [OFF],
1002
+ "style/jsx-tag-spacing": [ERROR, {
1003
+ afterOpening: NEVER,
1004
+ beforeClosing: NEVER,
1005
+ beforeSelfClosing: "always",
1006
+ closingSlash: NEVER
1007
+ }],
1008
+ "style/jsx-wrap-multilines": [ERROR, {
1009
+ arrow: STR_PARENS_NEW_LINE,
1010
+ assignment: STR_PARENS_NEW_LINE,
1011
+ condition: STR_PARENS_NEW_LINE,
1012
+ declaration: STR_PARENS_NEW_LINE,
1013
+ logical: STR_PARENS_NEW_LINE,
1014
+ prop: STR_PARENS_NEW_LINE,
1015
+ return: STR_PARENS_NEW_LINE
1016
+ }],
1017
+ "style/member-delimiter-style": [ERROR],
1018
+ "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1019
+ "style/object-curly-spacing": [ERROR, ALWAYS],
1020
+ "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1021
+ "style/operator-linebreak": [ERROR, "before"],
1022
+ "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
1023
+ "style/quote-props": [ERROR, "consistent-as-needed"],
1024
+ "style/quotes": [ERROR, quotes],
1025
+ "style/rest-spread-spacing": [ERROR, NEVER],
1026
+ "style/semi": [ERROR, semi ? ALWAYS : NEVER],
1027
+ "style/semi-spacing": [ERROR, { after: true, before: false }],
1028
+ "vinicunca/consistent-list-newline": ERROR,
1029
+ "vinicunca/if-newline": ERROR,
1030
+ "vinicunca/top-level-function": ERROR,
1031
+ ...overrides
1032
+ }
1033
+ },
1034
+ {
1035
+ files: [GLOB_JSX, GLOB_TSX],
1036
+ rules: {
1037
+ "vinicunca/consistent-list-newline": OFF
1038
+ }
1039
+ }
1040
+ ];
1041
+ }
1042
+
1043
+ // src/configs/formatters.ts
1044
+ async function formatters(options = {}, stylistic2 = {}) {
1045
+ if (options === true) {
1046
+ options = {
1047
+ css: true,
1048
+ graphql: true,
1049
+ html: true,
1050
+ markdown: true
1051
+ };
1052
+ }
1053
+ const {
1054
+ indent,
1055
+ quotes,
1056
+ semi
1057
+ } = {
1058
+ ...STYLISTIC_CONFIG_DEFAULTS,
1059
+ ...stylistic2
1060
+ };
1061
+ const prettierOptions = Object.assign(
1062
+ {
1063
+ endOfLine: "auto",
1064
+ semi,
1065
+ singleQuote: quotes === "single",
1066
+ tabWidth: typeof indent === "number" ? indent : 2,
1067
+ trailingComma: "all",
1068
+ useTabs: indent === "tab"
1069
+ },
1070
+ options.prettierOptions || {}
1071
+ );
1072
+ const dprintOptions = Object.assign(
1073
+ {
1074
+ indentWidth: typeof indent === "number" ? indent : 2,
1075
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
1076
+ useTabs: indent === "tab"
1077
+ },
1078
+ options.dprintOptions || {}
1079
+ );
1080
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
1081
+ const configs = [
1082
+ {
1083
+ name: "vinicunca:formatters:setup",
1084
+ plugins: {
1085
+ format: pluginFormat
1086
+ }
1087
+ }
1088
+ ];
1089
+ if (options.css) {
1090
+ configs.push(
1091
+ {
1092
+ files: [GLOB_CSS, GLOB_POSTCSS],
1093
+ languageOptions: {
1094
+ parser: parserPlain
1095
+ },
1096
+ name: "vinicunca:formatters:css",
1097
+ rules: {
1098
+ "format/prettier": [
1099
+ "error",
1100
+ {
1101
+ ...prettierOptions,
1102
+ parser: "css"
1103
+ }
1104
+ ]
1105
+ }
1106
+ },
1107
+ {
1108
+ files: [GLOB_SCSS],
1109
+ languageOptions: {
1110
+ parser: parserPlain
1111
+ },
1112
+ name: "vinicunca:formatters:scss",
1113
+ rules: {
1114
+ "format/prettier": [
1115
+ "error",
1116
+ {
1117
+ ...prettierOptions,
1118
+ parser: "scss"
1119
+ }
1120
+ ]
1121
+ }
1122
+ },
1123
+ {
1124
+ files: [GLOB_LESS],
1125
+ languageOptions: {
1126
+ parser: parserPlain
1127
+ },
1128
+ name: "vinicunca:formatters:less",
1129
+ rules: {
1130
+ "format/prettier": [
1131
+ "error",
1132
+ {
1133
+ ...prettierOptions,
1134
+ parser: "less"
1135
+ }
1136
+ ]
1137
+ }
1138
+ }
1139
+ );
1140
+ }
1141
+ if (options.html) {
1142
+ configs.push({
1143
+ files: ["**/*.html"],
1144
+ languageOptions: {
1145
+ parser: parserPlain
1146
+ },
1147
+ name: "vinicunca:formatters:html",
1148
+ rules: {
1149
+ "format/prettier": [
1150
+ "error",
1151
+ {
1152
+ ...prettierOptions,
1153
+ parser: "html"
1154
+ }
1155
+ ]
1156
+ }
1157
+ });
1158
+ }
1159
+ if (options.markdown) {
1160
+ const formater = options.markdown === true ? "prettier" : options.markdown;
1161
+ configs.push({
1162
+ files: [GLOB_MARKDOWN],
1163
+ languageOptions: {
1164
+ parser: parserPlain
1165
+ },
1166
+ name: "vinicunca:formatters:markdown",
1167
+ rules: {
1168
+ [`format/${formater}`]: [
1169
+ "error",
1170
+ formater === "prettier" ? {
1171
+ printWidth: 120,
1172
+ ...prettierOptions,
1173
+ embeddedLanguageFormatting: "off",
1174
+ parser: "markdown"
1175
+ } : {
1176
+ ...dprintOptions,
1177
+ language: "markdown"
1178
+ }
1179
+ ]
1180
+ }
1181
+ });
1182
+ }
1183
+ if (options.graphql) {
1184
+ configs.push({
1185
+ files: ["**/*.graphql"],
1186
+ languageOptions: {
1187
+ parser: parserPlain
1188
+ },
1189
+ name: "vinicunca:formatters:graphql",
1190
+ rules: {
1191
+ "format/prettier": [
1192
+ "error",
1193
+ {
1194
+ ...prettierOptions,
1195
+ parser: "graphql"
1196
+ }
1197
+ ]
1198
+ }
1199
+ });
1200
+ }
1201
+ return configs;
1202
+ }
1203
+
869
1204
  // src/configs/ignores.ts
870
1205
  async function ignores() {
871
1206
  return [
@@ -938,7 +1273,6 @@ async function javascript(options = {}) {
938
1273
  },
939
1274
  name: "vinicunca:javascript",
940
1275
  plugins: {
941
- "perfectionist": default5,
942
1276
  "unused-imports": default7,
943
1277
  "vinicunca": default2
944
1278
  },
@@ -1160,106 +1494,18 @@ async function javascript(options = {}) {
1160
1494
  }],
1161
1495
  "vars-on-top": ERROR,
1162
1496
  "yoda": [ERROR, NEVER],
1163
- ...default2.configs.recommended.rules,
1164
- ...default5.configs["recommended-natural"].rules,
1165
- "perfectionist/sort-imports": [
1166
- ERROR,
1167
- {
1168
- "groups": [
1169
- "type",
1170
- ["builtin", "external"],
1171
- "internal-type",
1172
- "internal",
1173
- ["parent-type", "sibling-type", "index-type"],
1174
- ["parent", "sibling", "index"],
1175
- "object",
1176
- "unknown"
1177
- ],
1178
- "internal-pattern": [
1179
- "~/**",
1180
- "~~/**"
1181
- ],
1182
- "newlines-between": "always",
1183
- "order": "asc",
1184
- "type": "natural"
1185
- }
1186
- ],
1187
- "perfectionist/sort-vue-attributes": [OFF],
1188
- ...overrides
1189
- }
1190
- },
1191
- {
1192
- files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1193
- name: "vinicunca:javascript:overrides",
1194
- rules: {
1195
- "no-console": OFF
1196
- }
1197
- }
1198
- ];
1199
- }
1200
-
1201
- // src/utils.ts
1202
- async function combineConfigs(...configs) {
1203
- const resolved = await Promise.all(configs);
1204
- return resolved.flat();
1205
- }
1206
- function renameRules(rules, map2) {
1207
- return Object.fromEntries(
1208
- Object.entries(rules).map(([key, value]) => {
1209
- for (const [from, to] of Object.entries(map2)) {
1210
- if (key.startsWith(`${from}/`)) {
1211
- return [to + key.slice(from.length), value];
1212
- }
1213
- }
1214
- return [key, value];
1215
- })
1216
- );
1217
- }
1218
- function renamePluginInConfigs(configs, map2) {
1219
- return configs.map((i) => {
1220
- const clone = { ...i };
1221
- if (clone.rules) {
1222
- clone.rules = renameRules(clone.rules, map2);
1223
- }
1224
- if (clone.plugins) {
1225
- clone.plugins = Object.fromEntries(
1226
- Object.entries(clone.plugins).map(([key, value]) => {
1227
- if (key in map2) {
1228
- return [map2[key], value];
1229
- }
1230
- return [key, value];
1231
- })
1232
- );
1233
- }
1234
- return clone;
1235
- });
1236
- }
1237
- async function interopDefault(m) {
1238
- const resolved = await m;
1239
- return resolved.default || resolved;
1240
- }
1241
- var parserPlain = {
1242
- meta: {
1243
- name: "parser-plain"
1244
- },
1245
- parseForESLint: (code) => ({
1246
- ast: {
1247
- body: [],
1248
- comments: [],
1249
- loc: { end: code.length, start: 0 },
1250
- range: [0, code.length],
1251
- tokens: [],
1252
- type: "Program"
1497
+ ...default2.configs.recommended.rules,
1498
+ ...overrides
1499
+ }
1253
1500
  },
1254
- scopeManager: null,
1255
- services: { isPlain: true },
1256
- visitorKeys: {
1257
- Program: []
1501
+ {
1502
+ files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1503
+ name: "vinicunca:javascript:overrides",
1504
+ rules: {
1505
+ "no-console": OFF
1506
+ }
1258
1507
  }
1259
- })
1260
- };
1261
- function toArray(value) {
1262
- return Array.isArray(value) ? value : [value];
1508
+ ];
1263
1509
  }
1264
1510
 
1265
1511
  // src/configs/jsdoc.ts
@@ -1496,6 +1742,44 @@ async function node() {
1496
1742
  ];
1497
1743
  }
1498
1744
 
1745
+ // src/configs/perfectionist.ts
1746
+ async function perfectionist() {
1747
+ return [
1748
+ {
1749
+ name: "vinicunca:perfectionist",
1750
+ plugins: {
1751
+ perfectionist: default5
1752
+ },
1753
+ rules: {
1754
+ ...default5.configs["recommended-natural"].rules,
1755
+ "perfectionist/sort-imports": [
1756
+ ERROR,
1757
+ {
1758
+ "groups": [
1759
+ "type",
1760
+ ["builtin", "external"],
1761
+ "internal-type",
1762
+ "internal",
1763
+ ["parent-type", "sibling-type", "index-type"],
1764
+ ["parent", "sibling", "index"],
1765
+ "object",
1766
+ "unknown"
1767
+ ],
1768
+ "internal-pattern": [
1769
+ "~/**",
1770
+ "~~/**"
1771
+ ],
1772
+ "newlines-between": "always",
1773
+ "order": "asc",
1774
+ "type": "natural"
1775
+ }
1776
+ ],
1777
+ "perfectionist/sort-vue-attributes": [OFF]
1778
+ }
1779
+ }
1780
+ ];
1781
+ }
1782
+
1499
1783
  // src/configs/react.ts
1500
1784
  async function react(options = {}) {
1501
1785
  const {
@@ -1699,211 +1983,101 @@ function sortTsconfig() {
1699
1983
  "composite",
1700
1984
  "tsBuildInfoFile",
1701
1985
  "disableSourceOfProjectReferenceRedirect",
1702
- "disableSolutionSearching",
1703
- "disableReferencedProjectLoad",
1704
- /* Language and Environment */
1705
- "target",
1706
- "jsx",
1707
- "jsxFactory",
1708
- "jsxFragmentFactory",
1709
- "jsxImportSource",
1710
- "lib",
1711
- "moduleDetection",
1712
- "noLib",
1713
- "reactNamespace",
1714
- "useDefineForClassFields",
1715
- "emitDecoratorMetadata",
1716
- "experimentalDecorators",
1717
- /* Modules */
1718
- "baseUrl",
1719
- "rootDir",
1720
- "rootDirs",
1721
- "customConditions",
1722
- "module",
1723
- "moduleResolution",
1724
- "moduleSuffixes",
1725
- "noResolve",
1726
- "paths",
1727
- "resolveJsonModule",
1728
- "resolvePackageJsonExports",
1729
- "resolvePackageJsonImports",
1730
- "typeRoots",
1731
- "types",
1732
- "allowArbitraryExtensions",
1733
- "allowImportingTsExtensions",
1734
- "allowUmdGlobalAccess",
1735
- /* JavaScript Support */
1736
- "allowJs",
1737
- "checkJs",
1738
- "maxNodeModuleJsDepth",
1739
- /* Type Checking */
1740
- "strict",
1741
- "strictBindCallApply",
1742
- "strictFunctionTypes",
1743
- "strictNullChecks",
1744
- "strictPropertyInitialization",
1745
- "allowUnreachableCode",
1746
- "allowUnusedLabels",
1747
- "alwaysStrict",
1748
- "exactOptionalPropertyTypes",
1749
- "noFallthroughCasesInSwitch",
1750
- "noImplicitAny",
1751
- "noImplicitOverride",
1752
- "noImplicitReturns",
1753
- "noImplicitThis",
1754
- "noPropertyAccessFromIndexSignature",
1755
- "noUncheckedIndexedAccess",
1756
- "noUnusedLocals",
1757
- "noUnusedParameters",
1758
- "useUnknownInCatchVariables",
1759
- /* Emit */
1760
- "declaration",
1761
- "declarationDir",
1762
- "declarationMap",
1763
- "downlevelIteration",
1764
- "emitBOM",
1765
- "emitDeclarationOnly",
1766
- "importHelpers",
1767
- "importsNotUsedAsValues",
1768
- "inlineSourceMap",
1769
- "inlineSources",
1770
- "mapRoot",
1771
- "newLine",
1772
- "noEmit",
1773
- "noEmitHelpers",
1774
- "noEmitOnError",
1775
- "outDir",
1776
- "outFile",
1777
- "preserveConstEnums",
1778
- "preserveValueImports",
1779
- "removeComments",
1780
- "sourceMap",
1781
- "sourceRoot",
1782
- "stripInternal",
1783
- /* Interop Constraints */
1784
- "allowSyntheticDefaultImports",
1785
- "esModuleInterop",
1786
- "forceConsistentCasingInFileNames",
1787
- "isolatedModules",
1788
- "preserveSymlinks",
1789
- "verbatimModuleSyntax",
1790
- /* Completeness */
1791
- "skipDefaultLibCheck",
1792
- "skipLibCheck"
1793
- ],
1794
- pathPattern: "^compilerOptions$"
1795
- }
1796
- ]
1797
- }
1798
- }
1799
- ];
1800
- }
1801
-
1802
- // src/configs/stylistic.ts
1803
- var STR_PARENS_NEW_LINE = "parens-new-line";
1804
- var STYLISTIC_CONFIG_DEFAULTS = {
1805
- indent: 2,
1806
- jsx: true,
1807
- quotes: "single",
1808
- semi: true
1809
- };
1810
- async function stylistic(options = {}) {
1811
- const {
1812
- indent,
1813
- jsx,
1814
- overrides = {},
1815
- quotes,
1816
- semi
1817
- } = {
1818
- ...STYLISTIC_CONFIG_DEFAULTS,
1819
- ...options
1820
- };
1821
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1822
- const config = pluginStylistic.configs.customize({
1823
- flat: true,
1824
- indent,
1825
- jsx,
1826
- pluginName: "style",
1827
- quotes,
1828
- semi
1829
- });
1830
- return [
1831
- {
1832
- name: "vinicunca:stylistic",
1833
- plugins: {
1834
- style: pluginStylistic,
1835
- vinicunca: default2
1836
- },
1837
- rules: {
1838
- ...config.rules,
1839
- "curly": [ERROR, "all"],
1840
- "style/array-bracket-newline": [ERROR, CONSISTENT],
1841
- "style/array-bracket-spacing": [ERROR, NEVER],
1842
- "style/array-element-newline": [ERROR, CONSISTENT],
1843
- "style/arrow-parens": [ERROR, ALWAYS],
1844
- "style/brace-style": [ERROR],
1845
- "style/func-call-spacing": [ERROR, NEVER],
1846
- "style/jsx-child-element-spacing": OFF,
1847
- "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
1848
- "style/jsx-closing-tag-location": ERROR,
1849
- "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
1850
- "style/jsx-curly-newline": [ERROR, {
1851
- multiline: "consistent",
1852
- singleline: "consistent"
1853
- }],
1854
- "style/jsx-curly-spacing": [ERROR, {
1855
- children: true,
1856
- spacing: {
1857
- objectLiterals: NEVER
1858
- },
1859
- when: "always"
1860
- }],
1861
- "style/jsx-equals-spacing": [ERROR, NEVER],
1862
- "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
1863
- "style/jsx-indent": [ERROR, 2],
1864
- "style/jsx-indent-props": [ERROR, 2],
1865
- "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
1866
- "style/jsx-newline": ERROR,
1867
- "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
1868
- "style/jsx-props-no-multi-spaces": ERROR,
1869
- // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1870
- "style/jsx-sort-props": [OFF],
1871
- "style/jsx-tag-spacing": [ERROR, {
1872
- afterOpening: NEVER,
1873
- beforeClosing: NEVER,
1874
- beforeSelfClosing: "always",
1875
- closingSlash: NEVER
1876
- }],
1877
- "style/jsx-wrap-multilines": [ERROR, {
1878
- arrow: STR_PARENS_NEW_LINE,
1879
- assignment: STR_PARENS_NEW_LINE,
1880
- condition: STR_PARENS_NEW_LINE,
1881
- declaration: STR_PARENS_NEW_LINE,
1882
- logical: STR_PARENS_NEW_LINE,
1883
- prop: STR_PARENS_NEW_LINE,
1884
- return: STR_PARENS_NEW_LINE
1885
- }],
1886
- "style/member-delimiter-style": [ERROR],
1887
- "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1888
- "style/object-curly-spacing": [ERROR, ALWAYS],
1889
- "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1890
- "style/operator-linebreak": [ERROR, "before"],
1891
- "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
1892
- "style/quote-props": [ERROR, "consistent-as-needed"],
1893
- "style/quotes": [ERROR, quotes],
1894
- "style/rest-spread-spacing": [ERROR, NEVER],
1895
- "style/semi": [ERROR, semi ? ALWAYS : NEVER],
1896
- "style/semi-spacing": [ERROR, { after: true, before: false }],
1897
- "vinicunca/consistent-list-newline": ERROR,
1898
- "vinicunca/if-newline": ERROR,
1899
- "vinicunca/top-level-function": ERROR,
1900
- ...overrides
1901
- }
1902
- },
1903
- {
1904
- files: [GLOB_JSX, GLOB_TSX],
1905
- rules: {
1906
- "vinicunca/consistent-list-newline": OFF
1986
+ "disableSolutionSearching",
1987
+ "disableReferencedProjectLoad",
1988
+ /* Language and Environment */
1989
+ "target",
1990
+ "jsx",
1991
+ "jsxFactory",
1992
+ "jsxFragmentFactory",
1993
+ "jsxImportSource",
1994
+ "lib",
1995
+ "moduleDetection",
1996
+ "noLib",
1997
+ "reactNamespace",
1998
+ "useDefineForClassFields",
1999
+ "emitDecoratorMetadata",
2000
+ "experimentalDecorators",
2001
+ /* Modules */
2002
+ "baseUrl",
2003
+ "rootDir",
2004
+ "rootDirs",
2005
+ "customConditions",
2006
+ "module",
2007
+ "moduleResolution",
2008
+ "moduleSuffixes",
2009
+ "noResolve",
2010
+ "paths",
2011
+ "resolveJsonModule",
2012
+ "resolvePackageJsonExports",
2013
+ "resolvePackageJsonImports",
2014
+ "typeRoots",
2015
+ "types",
2016
+ "allowArbitraryExtensions",
2017
+ "allowImportingTsExtensions",
2018
+ "allowUmdGlobalAccess",
2019
+ /* JavaScript Support */
2020
+ "allowJs",
2021
+ "checkJs",
2022
+ "maxNodeModuleJsDepth",
2023
+ /* Type Checking */
2024
+ "strict",
2025
+ "strictBindCallApply",
2026
+ "strictFunctionTypes",
2027
+ "strictNullChecks",
2028
+ "strictPropertyInitialization",
2029
+ "allowUnreachableCode",
2030
+ "allowUnusedLabels",
2031
+ "alwaysStrict",
2032
+ "exactOptionalPropertyTypes",
2033
+ "noFallthroughCasesInSwitch",
2034
+ "noImplicitAny",
2035
+ "noImplicitOverride",
2036
+ "noImplicitReturns",
2037
+ "noImplicitThis",
2038
+ "noPropertyAccessFromIndexSignature",
2039
+ "noUncheckedIndexedAccess",
2040
+ "noUnusedLocals",
2041
+ "noUnusedParameters",
2042
+ "useUnknownInCatchVariables",
2043
+ /* Emit */
2044
+ "declaration",
2045
+ "declarationDir",
2046
+ "declarationMap",
2047
+ "downlevelIteration",
2048
+ "emitBOM",
2049
+ "emitDeclarationOnly",
2050
+ "importHelpers",
2051
+ "importsNotUsedAsValues",
2052
+ "inlineSourceMap",
2053
+ "inlineSources",
2054
+ "mapRoot",
2055
+ "newLine",
2056
+ "noEmit",
2057
+ "noEmitHelpers",
2058
+ "noEmitOnError",
2059
+ "outDir",
2060
+ "outFile",
2061
+ "preserveConstEnums",
2062
+ "preserveValueImports",
2063
+ "removeComments",
2064
+ "sourceMap",
2065
+ "sourceRoot",
2066
+ "stripInternal",
2067
+ /* Interop Constraints */
2068
+ "allowSyntheticDefaultImports",
2069
+ "esModuleInterop",
2070
+ "forceConsistentCasingInFileNames",
2071
+ "isolatedModules",
2072
+ "preserveSymlinks",
2073
+ "verbatimModuleSyntax",
2074
+ /* Completeness */
2075
+ "skipDefaultLibCheck",
2076
+ "skipLibCheck"
2077
+ ],
2078
+ pathPattern: "^compilerOptions$"
2079
+ }
2080
+ ]
1907
2081
  }
1908
2082
  }
1909
2083
  ];
@@ -1955,7 +2129,7 @@ async function test(options = {}) {
1955
2129
  }
1956
2130
 
1957
2131
  // src/configs/typescript.ts
1958
- import process from "process";
2132
+ import process from "node:process";
1959
2133
  async function typescript(options = {}) {
1960
2134
  const {
1961
2135
  componentExts = [],
@@ -2382,167 +2556,6 @@ async function yaml(options = {}) {
2382
2556
  ];
2383
2557
  }
2384
2558
 
2385
- // src/configs/formatters.ts
2386
- async function formatters(options = {}, stylistic2 = {}) {
2387
- if (options === true) {
2388
- options = {
2389
- css: true,
2390
- graphql: true,
2391
- html: true,
2392
- markdown: true
2393
- };
2394
- }
2395
- const {
2396
- indent,
2397
- quotes,
2398
- semi
2399
- } = {
2400
- ...STYLISTIC_CONFIG_DEFAULTS,
2401
- ...stylistic2
2402
- };
2403
- const prettierOptions = Object.assign(
2404
- {
2405
- endOfLine: "auto",
2406
- semi,
2407
- singleQuote: quotes === "single",
2408
- tabWidth: typeof indent === "number" ? indent : 2,
2409
- trailingComma: "all",
2410
- useTabs: indent === "tab"
2411
- },
2412
- options.prettierOptions || {}
2413
- );
2414
- const dprintOptions = Object.assign(
2415
- {
2416
- indentWidth: typeof indent === "number" ? indent : 2,
2417
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
2418
- useTabs: indent === "tab"
2419
- },
2420
- options.dprintOptions || {}
2421
- );
2422
- const pluginFormat = await interopDefault(import("eslint-plugin-format"));
2423
- const configs = [
2424
- {
2425
- name: "vinicunca:formatters:setup",
2426
- plugins: {
2427
- format: pluginFormat
2428
- }
2429
- }
2430
- ];
2431
- if (options.css) {
2432
- configs.push(
2433
- {
2434
- files: [GLOB_CSS, GLOB_POSTCSS],
2435
- languageOptions: {
2436
- parser: parserPlain
2437
- },
2438
- name: "vinicunca:formatters:css",
2439
- rules: {
2440
- "format/prettier": [
2441
- "error",
2442
- {
2443
- ...prettierOptions,
2444
- parser: "css"
2445
- }
2446
- ]
2447
- }
2448
- },
2449
- {
2450
- files: [GLOB_SCSS],
2451
- languageOptions: {
2452
- parser: parserPlain
2453
- },
2454
- name: "vinicunca:formatters:scss",
2455
- rules: {
2456
- "format/prettier": [
2457
- "error",
2458
- {
2459
- ...prettierOptions,
2460
- parser: "scss"
2461
- }
2462
- ]
2463
- }
2464
- },
2465
- {
2466
- files: [GLOB_LESS],
2467
- languageOptions: {
2468
- parser: parserPlain
2469
- },
2470
- name: "vinicunca:formatters:less",
2471
- rules: {
2472
- "format/prettier": [
2473
- "error",
2474
- {
2475
- ...prettierOptions,
2476
- parser: "less"
2477
- }
2478
- ]
2479
- }
2480
- }
2481
- );
2482
- }
2483
- if (options.html) {
2484
- configs.push({
2485
- files: ["**/*.html"],
2486
- languageOptions: {
2487
- parser: parserPlain
2488
- },
2489
- name: "vinicunca:formatters:html",
2490
- rules: {
2491
- "format/prettier": [
2492
- "error",
2493
- {
2494
- ...prettierOptions,
2495
- parser: "html"
2496
- }
2497
- ]
2498
- }
2499
- });
2500
- }
2501
- if (options.markdown) {
2502
- const formater = options.markdown === true ? "prettier" : options.markdown;
2503
- configs.push({
2504
- files: [GLOB_MARKDOWN],
2505
- languageOptions: {
2506
- parser: parserPlain
2507
- },
2508
- name: "vinicunca:formatters:markdown",
2509
- rules: {
2510
- [`format/${formater}`]: [
2511
- "error",
2512
- formater === "prettier" ? {
2513
- printWidth: 120,
2514
- ...prettierOptions,
2515
- embeddedLanguageFormatting: "off",
2516
- parser: "markdown"
2517
- } : {
2518
- ...dprintOptions,
2519
- language: "markdown"
2520
- }
2521
- ]
2522
- }
2523
- });
2524
- }
2525
- if (options.graphql) {
2526
- configs.push({
2527
- files: ["**/*.graphql"],
2528
- languageOptions: {
2529
- parser: parserPlain
2530
- },
2531
- name: "vinicunca:formatters:graphql",
2532
- rules: {
2533
- "format/prettier": [
2534
- "error",
2535
- {
2536
- ...prettierOptions,
2537
- parser: "graphql"
2538
- }
2539
- ]
2540
- }
2541
- });
2542
- }
2543
- return configs;
2544
- }
2545
-
2546
2559
  // src/base.ts
2547
2560
  var flatConfigProps = [
2548
2561
  "name",
@@ -2611,7 +2624,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2611
2624
  stylistic: stylisticOptions
2612
2625
  }),
2613
2626
  imports(),
2614
- unicorn()
2627
+ unicorn(),
2628
+ perfectionist()
2615
2629
  );
2616
2630
  if (enableVue) {
2617
2631
  componentExts.push("vue");
@@ -2745,6 +2759,7 @@ export {
2745
2759
  combineConfigs,
2746
2760
  comments,
2747
2761
  defaultPluginRenaming,
2762
+ formatters,
2748
2763
  ignores,
2749
2764
  imports,
2750
2765
  interopDefault,
@@ -2754,6 +2769,7 @@ export {
2754
2769
  markdown,
2755
2770
  node,
2756
2771
  parserPlain,
2772
+ perfectionist,
2757
2773
  default3 as pluginComments,
2758
2774
  pluginImport,
2759
2775
  default4 as pluginNode,