@vinicunca/eslint-config 2.3.0 → 2.4.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.cjs CHANGED
@@ -57,6 +57,7 @@ __export(src_exports, {
57
57
  combineConfigs: () => combineConfigs,
58
58
  comments: () => comments,
59
59
  defaultPluginRenaming: () => defaultPluginRenaming,
60
+ formatters: () => formatters,
60
61
  ignores: () => ignores,
61
62
  imports: () => imports,
62
63
  interopDefault: () => interopDefault,
@@ -66,6 +67,7 @@ __export(src_exports, {
66
67
  markdown: () => markdown,
67
68
  node: () => node,
68
69
  parserPlain: () => parserPlain,
70
+ perfectionist: () => perfectionist,
69
71
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
70
72
  pluginImport: () => pluginImport,
71
73
  pluginNode: () => import_eslint_plugin_n.default,
@@ -958,6 +960,341 @@ var GLOB_EXCLUDE = [
958
960
  "**/components.d.ts"
959
961
  ];
960
962
 
963
+ // src/utils.ts
964
+ async function combineConfigs(...configs) {
965
+ const resolved = await Promise.all(configs);
966
+ return resolved.flat();
967
+ }
968
+ function renameRules(rules, map2) {
969
+ return Object.fromEntries(
970
+ Object.entries(rules).map(([key, value]) => {
971
+ for (const [from, to] of Object.entries(map2)) {
972
+ if (key.startsWith(`${from}/`)) {
973
+ return [to + key.slice(from.length), value];
974
+ }
975
+ }
976
+ return [key, value];
977
+ })
978
+ );
979
+ }
980
+ function renamePluginInConfigs(configs, map2) {
981
+ return configs.map((i) => {
982
+ const clone = { ...i };
983
+ if (clone.rules) {
984
+ clone.rules = renameRules(clone.rules, map2);
985
+ }
986
+ if (clone.plugins) {
987
+ clone.plugins = Object.fromEntries(
988
+ Object.entries(clone.plugins).map(([key, value]) => {
989
+ if (key in map2) {
990
+ return [map2[key], value];
991
+ }
992
+ return [key, value];
993
+ })
994
+ );
995
+ }
996
+ return clone;
997
+ });
998
+ }
999
+ async function interopDefault(m) {
1000
+ const resolved = await m;
1001
+ return resolved.default || resolved;
1002
+ }
1003
+ var parserPlain = {
1004
+ meta: {
1005
+ name: "parser-plain"
1006
+ },
1007
+ parseForESLint: (code) => ({
1008
+ ast: {
1009
+ body: [],
1010
+ comments: [],
1011
+ loc: { end: code.length, start: 0 },
1012
+ range: [0, code.length],
1013
+ tokens: [],
1014
+ type: "Program"
1015
+ },
1016
+ scopeManager: null,
1017
+ services: { isPlain: true },
1018
+ visitorKeys: {
1019
+ Program: []
1020
+ }
1021
+ })
1022
+ };
1023
+ function toArray(value) {
1024
+ return Array.isArray(value) ? value : [value];
1025
+ }
1026
+
1027
+ // src/configs/stylistic.ts
1028
+ var STR_PARENS_NEW_LINE = "parens-new-line";
1029
+ var STYLISTIC_CONFIG_DEFAULTS = {
1030
+ indent: 2,
1031
+ jsx: true,
1032
+ quotes: "single",
1033
+ semi: true
1034
+ };
1035
+ async function stylistic(options = {}) {
1036
+ const {
1037
+ indent,
1038
+ jsx,
1039
+ overrides = {},
1040
+ quotes,
1041
+ semi
1042
+ } = {
1043
+ ...STYLISTIC_CONFIG_DEFAULTS,
1044
+ ...options
1045
+ };
1046
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1047
+ const config = pluginStylistic.configs.customize({
1048
+ flat: true,
1049
+ indent,
1050
+ jsx,
1051
+ pluginName: "style",
1052
+ quotes,
1053
+ semi
1054
+ });
1055
+ return [
1056
+ {
1057
+ name: "vinicunca:stylistic",
1058
+ plugins: {
1059
+ style: pluginStylistic,
1060
+ vinicunca: import_eslint_plugin_vinicunca.default
1061
+ },
1062
+ rules: {
1063
+ ...config.rules,
1064
+ "curly": [ERROR, "all"],
1065
+ "style/array-bracket-newline": [ERROR, CONSISTENT],
1066
+ "style/array-bracket-spacing": [ERROR, NEVER],
1067
+ "style/array-element-newline": [ERROR, CONSISTENT],
1068
+ "style/arrow-parens": [ERROR, ALWAYS],
1069
+ "style/brace-style": [ERROR],
1070
+ "style/func-call-spacing": [ERROR, NEVER],
1071
+ "style/jsx-child-element-spacing": OFF,
1072
+ "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
1073
+ "style/jsx-closing-tag-location": ERROR,
1074
+ "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
1075
+ "style/jsx-curly-newline": [ERROR, {
1076
+ multiline: "consistent",
1077
+ singleline: "consistent"
1078
+ }],
1079
+ "style/jsx-curly-spacing": [ERROR, {
1080
+ children: true,
1081
+ spacing: {
1082
+ objectLiterals: NEVER
1083
+ },
1084
+ when: "always"
1085
+ }],
1086
+ "style/jsx-equals-spacing": [ERROR, NEVER],
1087
+ "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
1088
+ "style/jsx-indent": [ERROR, 2],
1089
+ "style/jsx-indent-props": [ERROR, 2],
1090
+ "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
1091
+ "style/jsx-newline": ERROR,
1092
+ "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
1093
+ "style/jsx-props-no-multi-spaces": ERROR,
1094
+ // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1095
+ "style/jsx-sort-props": [OFF],
1096
+ "style/jsx-tag-spacing": [ERROR, {
1097
+ afterOpening: NEVER,
1098
+ beforeClosing: NEVER,
1099
+ beforeSelfClosing: "always",
1100
+ closingSlash: NEVER
1101
+ }],
1102
+ "style/jsx-wrap-multilines": [ERROR, {
1103
+ arrow: STR_PARENS_NEW_LINE,
1104
+ assignment: STR_PARENS_NEW_LINE,
1105
+ condition: STR_PARENS_NEW_LINE,
1106
+ declaration: STR_PARENS_NEW_LINE,
1107
+ logical: STR_PARENS_NEW_LINE,
1108
+ prop: STR_PARENS_NEW_LINE,
1109
+ return: STR_PARENS_NEW_LINE
1110
+ }],
1111
+ "style/member-delimiter-style": [ERROR],
1112
+ "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1113
+ "style/object-curly-spacing": [ERROR, ALWAYS],
1114
+ "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1115
+ "style/operator-linebreak": [ERROR, "before"],
1116
+ "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
1117
+ "style/quote-props": [ERROR, "consistent-as-needed"],
1118
+ "style/quotes": [ERROR, quotes],
1119
+ "style/rest-spread-spacing": [ERROR, NEVER],
1120
+ "style/semi": [ERROR, semi ? ALWAYS : NEVER],
1121
+ "style/semi-spacing": [ERROR, { after: true, before: false }],
1122
+ "vinicunca/consistent-list-newline": ERROR,
1123
+ "vinicunca/if-newline": ERROR,
1124
+ "vinicunca/top-level-function": ERROR,
1125
+ ...overrides
1126
+ }
1127
+ },
1128
+ {
1129
+ files: [GLOB_JSX, GLOB_TSX],
1130
+ rules: {
1131
+ "vinicunca/consistent-list-newline": OFF
1132
+ }
1133
+ }
1134
+ ];
1135
+ }
1136
+
1137
+ // src/configs/formatters.ts
1138
+ async function formatters(options = {}, stylistic2 = {}) {
1139
+ if (options === true) {
1140
+ options = {
1141
+ css: true,
1142
+ graphql: true,
1143
+ html: true,
1144
+ markdown: true
1145
+ };
1146
+ }
1147
+ const {
1148
+ indent,
1149
+ quotes,
1150
+ semi
1151
+ } = {
1152
+ ...STYLISTIC_CONFIG_DEFAULTS,
1153
+ ...stylistic2
1154
+ };
1155
+ const prettierOptions = Object.assign(
1156
+ {
1157
+ endOfLine: "auto",
1158
+ semi,
1159
+ singleQuote: quotes === "single",
1160
+ tabWidth: typeof indent === "number" ? indent : 2,
1161
+ trailingComma: "all",
1162
+ useTabs: indent === "tab"
1163
+ },
1164
+ options.prettierOptions || {}
1165
+ );
1166
+ const dprintOptions = Object.assign(
1167
+ {
1168
+ indentWidth: typeof indent === "number" ? indent : 2,
1169
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
1170
+ useTabs: indent === "tab"
1171
+ },
1172
+ options.dprintOptions || {}
1173
+ );
1174
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
1175
+ const configs = [
1176
+ {
1177
+ name: "vinicunca:formatters:setup",
1178
+ plugins: {
1179
+ format: pluginFormat
1180
+ }
1181
+ }
1182
+ ];
1183
+ if (options.css) {
1184
+ configs.push(
1185
+ {
1186
+ files: [GLOB_CSS, GLOB_POSTCSS],
1187
+ languageOptions: {
1188
+ parser: parserPlain
1189
+ },
1190
+ name: "vinicunca:formatters:css",
1191
+ rules: {
1192
+ "format/prettier": [
1193
+ "error",
1194
+ {
1195
+ ...prettierOptions,
1196
+ parser: "css"
1197
+ }
1198
+ ]
1199
+ }
1200
+ },
1201
+ {
1202
+ files: [GLOB_SCSS],
1203
+ languageOptions: {
1204
+ parser: parserPlain
1205
+ },
1206
+ name: "vinicunca:formatters:scss",
1207
+ rules: {
1208
+ "format/prettier": [
1209
+ "error",
1210
+ {
1211
+ ...prettierOptions,
1212
+ parser: "scss"
1213
+ }
1214
+ ]
1215
+ }
1216
+ },
1217
+ {
1218
+ files: [GLOB_LESS],
1219
+ languageOptions: {
1220
+ parser: parserPlain
1221
+ },
1222
+ name: "vinicunca:formatters:less",
1223
+ rules: {
1224
+ "format/prettier": [
1225
+ "error",
1226
+ {
1227
+ ...prettierOptions,
1228
+ parser: "less"
1229
+ }
1230
+ ]
1231
+ }
1232
+ }
1233
+ );
1234
+ }
1235
+ if (options.html) {
1236
+ configs.push({
1237
+ files: ["**/*.html"],
1238
+ languageOptions: {
1239
+ parser: parserPlain
1240
+ },
1241
+ name: "vinicunca:formatters:html",
1242
+ rules: {
1243
+ "format/prettier": [
1244
+ "error",
1245
+ {
1246
+ ...prettierOptions,
1247
+ parser: "html"
1248
+ }
1249
+ ]
1250
+ }
1251
+ });
1252
+ }
1253
+ if (options.markdown) {
1254
+ const formater = options.markdown === true ? "prettier" : options.markdown;
1255
+ configs.push({
1256
+ files: [GLOB_MARKDOWN],
1257
+ languageOptions: {
1258
+ parser: parserPlain
1259
+ },
1260
+ name: "vinicunca:formatters:markdown",
1261
+ rules: {
1262
+ [`format/${formater}`]: [
1263
+ "error",
1264
+ formater === "prettier" ? {
1265
+ printWidth: 120,
1266
+ ...prettierOptions,
1267
+ embeddedLanguageFormatting: "off",
1268
+ parser: "markdown"
1269
+ } : {
1270
+ ...dprintOptions,
1271
+ language: "markdown"
1272
+ }
1273
+ ]
1274
+ }
1275
+ });
1276
+ }
1277
+ if (options.graphql) {
1278
+ configs.push({
1279
+ files: ["**/*.graphql"],
1280
+ languageOptions: {
1281
+ parser: parserPlain
1282
+ },
1283
+ name: "vinicunca:formatters:graphql",
1284
+ rules: {
1285
+ "format/prettier": [
1286
+ "error",
1287
+ {
1288
+ ...prettierOptions,
1289
+ parser: "graphql"
1290
+ }
1291
+ ]
1292
+ }
1293
+ });
1294
+ }
1295
+ return configs;
1296
+ }
1297
+
961
1298
  // src/configs/ignores.ts
962
1299
  async function ignores() {
963
1300
  return [
@@ -1030,7 +1367,6 @@ async function javascript(options = {}) {
1030
1367
  },
1031
1368
  name: "vinicunca:javascript",
1032
1369
  plugins: {
1033
- "perfectionist": import_eslint_plugin_perfectionist.default,
1034
1370
  "unused-imports": import_eslint_plugin_unused_imports.default,
1035
1371
  "vinicunca": import_eslint_plugin_vinicunca.default
1036
1372
  },
@@ -1252,106 +1588,18 @@ async function javascript(options = {}) {
1252
1588
  }],
1253
1589
  "vars-on-top": ERROR,
1254
1590
  "yoda": [ERROR, NEVER],
1255
- ...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
1256
- ...import_eslint_plugin_perfectionist.default.configs["recommended-natural"].rules,
1257
- "perfectionist/sort-imports": [
1258
- ERROR,
1259
- {
1260
- "groups": [
1261
- "type",
1262
- ["builtin", "external"],
1263
- "internal-type",
1264
- "internal",
1265
- ["parent-type", "sibling-type", "index-type"],
1266
- ["parent", "sibling", "index"],
1267
- "object",
1268
- "unknown"
1269
- ],
1270
- "internal-pattern": [
1271
- "~/**",
1272
- "~~/**"
1273
- ],
1274
- "newlines-between": "always",
1275
- "order": "asc",
1276
- "type": "natural"
1277
- }
1278
- ],
1279
- "perfectionist/sort-vue-attributes": [OFF],
1280
- ...overrides
1281
- }
1282
- },
1283
- {
1284
- files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1285
- name: "vinicunca:javascript:overrides",
1286
- rules: {
1287
- "no-console": OFF
1288
- }
1289
- }
1290
- ];
1291
- }
1292
-
1293
- // src/utils.ts
1294
- async function combineConfigs(...configs) {
1295
- const resolved = await Promise.all(configs);
1296
- return resolved.flat();
1297
- }
1298
- function renameRules(rules, map2) {
1299
- return Object.fromEntries(
1300
- Object.entries(rules).map(([key, value]) => {
1301
- for (const [from, to] of Object.entries(map2)) {
1302
- if (key.startsWith(`${from}/`)) {
1303
- return [to + key.slice(from.length), value];
1304
- }
1305
- }
1306
- return [key, value];
1307
- })
1308
- );
1309
- }
1310
- function renamePluginInConfigs(configs, map2) {
1311
- return configs.map((i) => {
1312
- const clone = { ...i };
1313
- if (clone.rules) {
1314
- clone.rules = renameRules(clone.rules, map2);
1315
- }
1316
- if (clone.plugins) {
1317
- clone.plugins = Object.fromEntries(
1318
- Object.entries(clone.plugins).map(([key, value]) => {
1319
- if (key in map2) {
1320
- return [map2[key], value];
1321
- }
1322
- return [key, value];
1323
- })
1324
- );
1325
- }
1326
- return clone;
1327
- });
1328
- }
1329
- async function interopDefault(m) {
1330
- const resolved = await m;
1331
- return resolved.default || resolved;
1332
- }
1333
- var parserPlain = {
1334
- meta: {
1335
- name: "parser-plain"
1336
- },
1337
- parseForESLint: (code) => ({
1338
- ast: {
1339
- body: [],
1340
- comments: [],
1341
- loc: { end: code.length, start: 0 },
1342
- range: [0, code.length],
1343
- tokens: [],
1344
- type: "Program"
1591
+ ...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
1592
+ ...overrides
1593
+ }
1345
1594
  },
1346
- scopeManager: null,
1347
- services: { isPlain: true },
1348
- visitorKeys: {
1349
- Program: []
1595
+ {
1596
+ files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1597
+ name: "vinicunca:javascript:overrides",
1598
+ rules: {
1599
+ "no-console": OFF
1600
+ }
1350
1601
  }
1351
- })
1352
- };
1353
- function toArray(value) {
1354
- return Array.isArray(value) ? value : [value];
1602
+ ];
1355
1603
  }
1356
1604
 
1357
1605
  // src/configs/jsdoc.ts
@@ -1588,6 +1836,44 @@ async function node() {
1588
1836
  ];
1589
1837
  }
1590
1838
 
1839
+ // src/configs/perfectionist.ts
1840
+ async function perfectionist() {
1841
+ return [
1842
+ {
1843
+ name: "vinicunca:perfectionist",
1844
+ plugins: {
1845
+ perfectionist: import_eslint_plugin_perfectionist.default
1846
+ },
1847
+ rules: {
1848
+ ...import_eslint_plugin_perfectionist.default.configs["recommended-natural"].rules,
1849
+ "perfectionist/sort-imports": [
1850
+ ERROR,
1851
+ {
1852
+ "groups": [
1853
+ "type",
1854
+ ["builtin", "external"],
1855
+ "internal-type",
1856
+ "internal",
1857
+ ["parent-type", "sibling-type", "index-type"],
1858
+ ["parent", "sibling", "index"],
1859
+ "object",
1860
+ "unknown"
1861
+ ],
1862
+ "internal-pattern": [
1863
+ "~/**",
1864
+ "~~/**"
1865
+ ],
1866
+ "newlines-between": "always",
1867
+ "order": "asc",
1868
+ "type": "natural"
1869
+ }
1870
+ ],
1871
+ "perfectionist/sort-vue-attributes": [OFF]
1872
+ }
1873
+ }
1874
+ ];
1875
+ }
1876
+
1591
1877
  // src/configs/react.ts
1592
1878
  async function react(options = {}) {
1593
1879
  const {
@@ -1791,211 +2077,101 @@ function sortTsconfig() {
1791
2077
  "composite",
1792
2078
  "tsBuildInfoFile",
1793
2079
  "disableSourceOfProjectReferenceRedirect",
1794
- "disableSolutionSearching",
1795
- "disableReferencedProjectLoad",
1796
- /* Language and Environment */
1797
- "target",
1798
- "jsx",
1799
- "jsxFactory",
1800
- "jsxFragmentFactory",
1801
- "jsxImportSource",
1802
- "lib",
1803
- "moduleDetection",
1804
- "noLib",
1805
- "reactNamespace",
1806
- "useDefineForClassFields",
1807
- "emitDecoratorMetadata",
1808
- "experimentalDecorators",
1809
- /* Modules */
1810
- "baseUrl",
1811
- "rootDir",
1812
- "rootDirs",
1813
- "customConditions",
1814
- "module",
1815
- "moduleResolution",
1816
- "moduleSuffixes",
1817
- "noResolve",
1818
- "paths",
1819
- "resolveJsonModule",
1820
- "resolvePackageJsonExports",
1821
- "resolvePackageJsonImports",
1822
- "typeRoots",
1823
- "types",
1824
- "allowArbitraryExtensions",
1825
- "allowImportingTsExtensions",
1826
- "allowUmdGlobalAccess",
1827
- /* JavaScript Support */
1828
- "allowJs",
1829
- "checkJs",
1830
- "maxNodeModuleJsDepth",
1831
- /* Type Checking */
1832
- "strict",
1833
- "strictBindCallApply",
1834
- "strictFunctionTypes",
1835
- "strictNullChecks",
1836
- "strictPropertyInitialization",
1837
- "allowUnreachableCode",
1838
- "allowUnusedLabels",
1839
- "alwaysStrict",
1840
- "exactOptionalPropertyTypes",
1841
- "noFallthroughCasesInSwitch",
1842
- "noImplicitAny",
1843
- "noImplicitOverride",
1844
- "noImplicitReturns",
1845
- "noImplicitThis",
1846
- "noPropertyAccessFromIndexSignature",
1847
- "noUncheckedIndexedAccess",
1848
- "noUnusedLocals",
1849
- "noUnusedParameters",
1850
- "useUnknownInCatchVariables",
1851
- /* Emit */
1852
- "declaration",
1853
- "declarationDir",
1854
- "declarationMap",
1855
- "downlevelIteration",
1856
- "emitBOM",
1857
- "emitDeclarationOnly",
1858
- "importHelpers",
1859
- "importsNotUsedAsValues",
1860
- "inlineSourceMap",
1861
- "inlineSources",
1862
- "mapRoot",
1863
- "newLine",
1864
- "noEmit",
1865
- "noEmitHelpers",
1866
- "noEmitOnError",
1867
- "outDir",
1868
- "outFile",
1869
- "preserveConstEnums",
1870
- "preserveValueImports",
1871
- "removeComments",
1872
- "sourceMap",
1873
- "sourceRoot",
1874
- "stripInternal",
1875
- /* Interop Constraints */
1876
- "allowSyntheticDefaultImports",
1877
- "esModuleInterop",
1878
- "forceConsistentCasingInFileNames",
1879
- "isolatedModules",
1880
- "preserveSymlinks",
1881
- "verbatimModuleSyntax",
1882
- /* Completeness */
1883
- "skipDefaultLibCheck",
1884
- "skipLibCheck"
1885
- ],
1886
- pathPattern: "^compilerOptions$"
1887
- }
1888
- ]
1889
- }
1890
- }
1891
- ];
1892
- }
1893
-
1894
- // src/configs/stylistic.ts
1895
- var STR_PARENS_NEW_LINE = "parens-new-line";
1896
- var STYLISTIC_CONFIG_DEFAULTS = {
1897
- indent: 2,
1898
- jsx: true,
1899
- quotes: "single",
1900
- semi: true
1901
- };
1902
- async function stylistic(options = {}) {
1903
- const {
1904
- indent,
1905
- jsx,
1906
- overrides = {},
1907
- quotes,
1908
- semi
1909
- } = {
1910
- ...STYLISTIC_CONFIG_DEFAULTS,
1911
- ...options
1912
- };
1913
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1914
- const config = pluginStylistic.configs.customize({
1915
- flat: true,
1916
- indent,
1917
- jsx,
1918
- pluginName: "style",
1919
- quotes,
1920
- semi
1921
- });
1922
- return [
1923
- {
1924
- name: "vinicunca:stylistic",
1925
- plugins: {
1926
- style: pluginStylistic,
1927
- vinicunca: import_eslint_plugin_vinicunca.default
1928
- },
1929
- rules: {
1930
- ...config.rules,
1931
- "curly": [ERROR, "all"],
1932
- "style/array-bracket-newline": [ERROR, CONSISTENT],
1933
- "style/array-bracket-spacing": [ERROR, NEVER],
1934
- "style/array-element-newline": [ERROR, CONSISTENT],
1935
- "style/arrow-parens": [ERROR, ALWAYS],
1936
- "style/brace-style": [ERROR],
1937
- "style/func-call-spacing": [ERROR, NEVER],
1938
- "style/jsx-child-element-spacing": OFF,
1939
- "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
1940
- "style/jsx-closing-tag-location": ERROR,
1941
- "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
1942
- "style/jsx-curly-newline": [ERROR, {
1943
- multiline: "consistent",
1944
- singleline: "consistent"
1945
- }],
1946
- "style/jsx-curly-spacing": [ERROR, {
1947
- children: true,
1948
- spacing: {
1949
- objectLiterals: NEVER
1950
- },
1951
- when: "always"
1952
- }],
1953
- "style/jsx-equals-spacing": [ERROR, NEVER],
1954
- "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
1955
- "style/jsx-indent": [ERROR, 2],
1956
- "style/jsx-indent-props": [ERROR, 2],
1957
- "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
1958
- "style/jsx-newline": ERROR,
1959
- "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
1960
- "style/jsx-props-no-multi-spaces": ERROR,
1961
- // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1962
- "style/jsx-sort-props": [OFF],
1963
- "style/jsx-tag-spacing": [ERROR, {
1964
- afterOpening: NEVER,
1965
- beforeClosing: NEVER,
1966
- beforeSelfClosing: "always",
1967
- closingSlash: NEVER
1968
- }],
1969
- "style/jsx-wrap-multilines": [ERROR, {
1970
- arrow: STR_PARENS_NEW_LINE,
1971
- assignment: STR_PARENS_NEW_LINE,
1972
- condition: STR_PARENS_NEW_LINE,
1973
- declaration: STR_PARENS_NEW_LINE,
1974
- logical: STR_PARENS_NEW_LINE,
1975
- prop: STR_PARENS_NEW_LINE,
1976
- return: STR_PARENS_NEW_LINE
1977
- }],
1978
- "style/member-delimiter-style": [ERROR],
1979
- "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
1980
- "style/object-curly-spacing": [ERROR, ALWAYS],
1981
- "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1982
- "style/operator-linebreak": [ERROR, "before"],
1983
- "style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
1984
- "style/quote-props": [ERROR, "consistent-as-needed"],
1985
- "style/quotes": [ERROR, quotes],
1986
- "style/rest-spread-spacing": [ERROR, NEVER],
1987
- "style/semi": [ERROR, semi ? ALWAYS : NEVER],
1988
- "style/semi-spacing": [ERROR, { after: true, before: false }],
1989
- "vinicunca/consistent-list-newline": ERROR,
1990
- "vinicunca/if-newline": ERROR,
1991
- "vinicunca/top-level-function": ERROR,
1992
- ...overrides
1993
- }
1994
- },
1995
- {
1996
- files: [GLOB_JSX, GLOB_TSX],
1997
- rules: {
1998
- "vinicunca/consistent-list-newline": OFF
2080
+ "disableSolutionSearching",
2081
+ "disableReferencedProjectLoad",
2082
+ /* Language and Environment */
2083
+ "target",
2084
+ "jsx",
2085
+ "jsxFactory",
2086
+ "jsxFragmentFactory",
2087
+ "jsxImportSource",
2088
+ "lib",
2089
+ "moduleDetection",
2090
+ "noLib",
2091
+ "reactNamespace",
2092
+ "useDefineForClassFields",
2093
+ "emitDecoratorMetadata",
2094
+ "experimentalDecorators",
2095
+ /* Modules */
2096
+ "baseUrl",
2097
+ "rootDir",
2098
+ "rootDirs",
2099
+ "customConditions",
2100
+ "module",
2101
+ "moduleResolution",
2102
+ "moduleSuffixes",
2103
+ "noResolve",
2104
+ "paths",
2105
+ "resolveJsonModule",
2106
+ "resolvePackageJsonExports",
2107
+ "resolvePackageJsonImports",
2108
+ "typeRoots",
2109
+ "types",
2110
+ "allowArbitraryExtensions",
2111
+ "allowImportingTsExtensions",
2112
+ "allowUmdGlobalAccess",
2113
+ /* JavaScript Support */
2114
+ "allowJs",
2115
+ "checkJs",
2116
+ "maxNodeModuleJsDepth",
2117
+ /* Type Checking */
2118
+ "strict",
2119
+ "strictBindCallApply",
2120
+ "strictFunctionTypes",
2121
+ "strictNullChecks",
2122
+ "strictPropertyInitialization",
2123
+ "allowUnreachableCode",
2124
+ "allowUnusedLabels",
2125
+ "alwaysStrict",
2126
+ "exactOptionalPropertyTypes",
2127
+ "noFallthroughCasesInSwitch",
2128
+ "noImplicitAny",
2129
+ "noImplicitOverride",
2130
+ "noImplicitReturns",
2131
+ "noImplicitThis",
2132
+ "noPropertyAccessFromIndexSignature",
2133
+ "noUncheckedIndexedAccess",
2134
+ "noUnusedLocals",
2135
+ "noUnusedParameters",
2136
+ "useUnknownInCatchVariables",
2137
+ /* Emit */
2138
+ "declaration",
2139
+ "declarationDir",
2140
+ "declarationMap",
2141
+ "downlevelIteration",
2142
+ "emitBOM",
2143
+ "emitDeclarationOnly",
2144
+ "importHelpers",
2145
+ "importsNotUsedAsValues",
2146
+ "inlineSourceMap",
2147
+ "inlineSources",
2148
+ "mapRoot",
2149
+ "newLine",
2150
+ "noEmit",
2151
+ "noEmitHelpers",
2152
+ "noEmitOnError",
2153
+ "outDir",
2154
+ "outFile",
2155
+ "preserveConstEnums",
2156
+ "preserveValueImports",
2157
+ "removeComments",
2158
+ "sourceMap",
2159
+ "sourceRoot",
2160
+ "stripInternal",
2161
+ /* Interop Constraints */
2162
+ "allowSyntheticDefaultImports",
2163
+ "esModuleInterop",
2164
+ "forceConsistentCasingInFileNames",
2165
+ "isolatedModules",
2166
+ "preserveSymlinks",
2167
+ "verbatimModuleSyntax",
2168
+ /* Completeness */
2169
+ "skipDefaultLibCheck",
2170
+ "skipLibCheck"
2171
+ ],
2172
+ pathPattern: "^compilerOptions$"
2173
+ }
2174
+ ]
1999
2175
  }
2000
2176
  }
2001
2177
  ];
@@ -2474,167 +2650,6 @@ async function yaml(options = {}) {
2474
2650
  ];
2475
2651
  }
2476
2652
 
2477
- // src/configs/formatters.ts
2478
- async function formatters(options = {}, stylistic2 = {}) {
2479
- if (options === true) {
2480
- options = {
2481
- css: true,
2482
- graphql: true,
2483
- html: true,
2484
- markdown: true
2485
- };
2486
- }
2487
- const {
2488
- indent,
2489
- quotes,
2490
- semi
2491
- } = {
2492
- ...STYLISTIC_CONFIG_DEFAULTS,
2493
- ...stylistic2
2494
- };
2495
- const prettierOptions = Object.assign(
2496
- {
2497
- endOfLine: "auto",
2498
- semi,
2499
- singleQuote: quotes === "single",
2500
- tabWidth: typeof indent === "number" ? indent : 2,
2501
- trailingComma: "all",
2502
- useTabs: indent === "tab"
2503
- },
2504
- options.prettierOptions || {}
2505
- );
2506
- const dprintOptions = Object.assign(
2507
- {
2508
- indentWidth: typeof indent === "number" ? indent : 2,
2509
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
2510
- useTabs: indent === "tab"
2511
- },
2512
- options.dprintOptions || {}
2513
- );
2514
- const pluginFormat = await interopDefault(import("eslint-plugin-format"));
2515
- const configs = [
2516
- {
2517
- name: "vinicunca:formatters:setup",
2518
- plugins: {
2519
- format: pluginFormat
2520
- }
2521
- }
2522
- ];
2523
- if (options.css) {
2524
- configs.push(
2525
- {
2526
- files: [GLOB_CSS, GLOB_POSTCSS],
2527
- languageOptions: {
2528
- parser: parserPlain
2529
- },
2530
- name: "vinicunca:formatters:css",
2531
- rules: {
2532
- "format/prettier": [
2533
- "error",
2534
- {
2535
- ...prettierOptions,
2536
- parser: "css"
2537
- }
2538
- ]
2539
- }
2540
- },
2541
- {
2542
- files: [GLOB_SCSS],
2543
- languageOptions: {
2544
- parser: parserPlain
2545
- },
2546
- name: "vinicunca:formatters:scss",
2547
- rules: {
2548
- "format/prettier": [
2549
- "error",
2550
- {
2551
- ...prettierOptions,
2552
- parser: "scss"
2553
- }
2554
- ]
2555
- }
2556
- },
2557
- {
2558
- files: [GLOB_LESS],
2559
- languageOptions: {
2560
- parser: parserPlain
2561
- },
2562
- name: "vinicunca:formatters:less",
2563
- rules: {
2564
- "format/prettier": [
2565
- "error",
2566
- {
2567
- ...prettierOptions,
2568
- parser: "less"
2569
- }
2570
- ]
2571
- }
2572
- }
2573
- );
2574
- }
2575
- if (options.html) {
2576
- configs.push({
2577
- files: ["**/*.html"],
2578
- languageOptions: {
2579
- parser: parserPlain
2580
- },
2581
- name: "vinicunca:formatters:html",
2582
- rules: {
2583
- "format/prettier": [
2584
- "error",
2585
- {
2586
- ...prettierOptions,
2587
- parser: "html"
2588
- }
2589
- ]
2590
- }
2591
- });
2592
- }
2593
- if (options.markdown) {
2594
- const formater = options.markdown === true ? "prettier" : options.markdown;
2595
- configs.push({
2596
- files: [GLOB_MARKDOWN],
2597
- languageOptions: {
2598
- parser: parserPlain
2599
- },
2600
- name: "vinicunca:formatters:markdown",
2601
- rules: {
2602
- [`format/${formater}`]: [
2603
- "error",
2604
- formater === "prettier" ? {
2605
- printWidth: 120,
2606
- ...prettierOptions,
2607
- embeddedLanguageFormatting: "off",
2608
- parser: "markdown"
2609
- } : {
2610
- ...dprintOptions,
2611
- language: "markdown"
2612
- }
2613
- ]
2614
- }
2615
- });
2616
- }
2617
- if (options.graphql) {
2618
- configs.push({
2619
- files: ["**/*.graphql"],
2620
- languageOptions: {
2621
- parser: parserPlain
2622
- },
2623
- name: "vinicunca:formatters:graphql",
2624
- rules: {
2625
- "format/prettier": [
2626
- "error",
2627
- {
2628
- ...prettierOptions,
2629
- parser: "graphql"
2630
- }
2631
- ]
2632
- }
2633
- });
2634
- }
2635
- return configs;
2636
- }
2637
-
2638
2653
  // src/base.ts
2639
2654
  var flatConfigProps = [
2640
2655
  "name",
@@ -2703,7 +2718,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2703
2718
  stylistic: stylisticOptions
2704
2719
  }),
2705
2720
  imports(),
2706
- unicorn()
2721
+ unicorn(),
2722
+ perfectionist()
2707
2723
  );
2708
2724
  if (enableVue) {
2709
2725
  componentExts.push("vue");
@@ -2838,6 +2854,7 @@ function resolveSubOptions(options, key) {
2838
2854
  combineConfigs,
2839
2855
  comments,
2840
2856
  defaultPluginRenaming,
2857
+ formatters,
2841
2858
  ignores,
2842
2859
  imports,
2843
2860
  interopDefault,
@@ -2847,6 +2864,7 @@ function resolveSubOptions(options, key) {
2847
2864
  markdown,
2848
2865
  node,
2849
2866
  parserPlain,
2867
+ perfectionist,
2850
2868
  pluginComments,
2851
2869
  pluginImport,
2852
2870
  pluginNode,