@2digits/eslint-config 2.12.3 → 2.13.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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +486 -3
- package/dist/index.d.ts +486 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +30 -24
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
|
10
10
|
interface RuleOptions {
|
|
11
11
|
/**
|
|
12
12
|
* Enforce giving proper names to type parameters when there are two or more
|
|
13
|
-
* @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.3.
|
|
13
|
+
* @see https://github.com/2digits-agency/configs/blob/@2digits/eslint-plugin@2.3.22/packages/eslint/src/rules/type-param-names.ts
|
|
14
14
|
*/
|
|
15
15
|
'@2digits/type-param-names'?: Linter.RuleEntry<[]>
|
|
16
16
|
/**
|
|
@@ -1075,6 +1075,226 @@ Backward pagination arguments
|
|
|
1075
1075
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/valid-types.md#repos-sticky-header
|
|
1076
1076
|
*/
|
|
1077
1077
|
'jsdoc/valid-types'?: Linter.RuleEntry<JsdocValidTypes>
|
|
1078
|
+
/**
|
|
1079
|
+
* enforce line breaks after opening and before closing array brackets
|
|
1080
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-newline.html
|
|
1081
|
+
*/
|
|
1082
|
+
'jsonc/array-bracket-newline'?: Linter.RuleEntry<JsoncArrayBracketNewline>
|
|
1083
|
+
/**
|
|
1084
|
+
* disallow or enforce spaces inside of brackets
|
|
1085
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-spacing.html
|
|
1086
|
+
*/
|
|
1087
|
+
'jsonc/array-bracket-spacing'?: Linter.RuleEntry<JsoncArrayBracketSpacing>
|
|
1088
|
+
/**
|
|
1089
|
+
* enforce line breaks between array elements
|
|
1090
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-element-newline.html
|
|
1091
|
+
*/
|
|
1092
|
+
'jsonc/array-element-newline'?: Linter.RuleEntry<JsoncArrayElementNewline>
|
|
1093
|
+
/**
|
|
1094
|
+
* apply jsonc rules similar to your configured ESLint core rules
|
|
1095
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html
|
|
1096
|
+
*/
|
|
1097
|
+
'jsonc/auto'?: Linter.RuleEntry<[]>
|
|
1098
|
+
/**
|
|
1099
|
+
* require or disallow trailing commas
|
|
1100
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html
|
|
1101
|
+
*/
|
|
1102
|
+
'jsonc/comma-dangle'?: Linter.RuleEntry<JsoncCommaDangle>
|
|
1103
|
+
/**
|
|
1104
|
+
* enforce consistent comma style
|
|
1105
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-style.html
|
|
1106
|
+
*/
|
|
1107
|
+
'jsonc/comma-style'?: Linter.RuleEntry<JsoncCommaStyle>
|
|
1108
|
+
/**
|
|
1109
|
+
* enforce consistent indentation
|
|
1110
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html
|
|
1111
|
+
*/
|
|
1112
|
+
'jsonc/indent'?: Linter.RuleEntry<JsoncIndent>
|
|
1113
|
+
/**
|
|
1114
|
+
* enforce naming convention to property key names
|
|
1115
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/key-name-casing.html
|
|
1116
|
+
*/
|
|
1117
|
+
'jsonc/key-name-casing'?: Linter.RuleEntry<JsoncKeyNameCasing>
|
|
1118
|
+
/**
|
|
1119
|
+
* enforce consistent spacing between keys and values in object literal properties
|
|
1120
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/key-spacing.html
|
|
1121
|
+
*/
|
|
1122
|
+
'jsonc/key-spacing'?: Linter.RuleEntry<JsoncKeySpacing>
|
|
1123
|
+
/**
|
|
1124
|
+
* disallow BigInt literals
|
|
1125
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-bigint-literals.html
|
|
1126
|
+
*/
|
|
1127
|
+
'jsonc/no-bigint-literals'?: Linter.RuleEntry<[]>
|
|
1128
|
+
/**
|
|
1129
|
+
* disallow binary expression
|
|
1130
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-expression.html
|
|
1131
|
+
*/
|
|
1132
|
+
'jsonc/no-binary-expression'?: Linter.RuleEntry<[]>
|
|
1133
|
+
/**
|
|
1134
|
+
* disallow binary numeric literals
|
|
1135
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-numeric-literals.html
|
|
1136
|
+
*/
|
|
1137
|
+
'jsonc/no-binary-numeric-literals'?: Linter.RuleEntry<[]>
|
|
1138
|
+
/**
|
|
1139
|
+
* disallow comments
|
|
1140
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-comments.html
|
|
1141
|
+
*/
|
|
1142
|
+
'jsonc/no-comments'?: Linter.RuleEntry<[]>
|
|
1143
|
+
/**
|
|
1144
|
+
* disallow duplicate keys in object literals
|
|
1145
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-dupe-keys.html
|
|
1146
|
+
*/
|
|
1147
|
+
'jsonc/no-dupe-keys'?: Linter.RuleEntry<[]>
|
|
1148
|
+
/**
|
|
1149
|
+
* disallow escape sequences in identifiers.
|
|
1150
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-escape-sequence-in-identifier.html
|
|
1151
|
+
*/
|
|
1152
|
+
'jsonc/no-escape-sequence-in-identifier'?: Linter.RuleEntry<[]>
|
|
1153
|
+
/**
|
|
1154
|
+
* disallow leading or trailing decimal points in numeric literals
|
|
1155
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-floating-decimal.html
|
|
1156
|
+
*/
|
|
1157
|
+
'jsonc/no-floating-decimal'?: Linter.RuleEntry<[]>
|
|
1158
|
+
/**
|
|
1159
|
+
* disallow hexadecimal numeric literals
|
|
1160
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-hexadecimal-numeric-literals.html
|
|
1161
|
+
*/
|
|
1162
|
+
'jsonc/no-hexadecimal-numeric-literals'?: Linter.RuleEntry<[]>
|
|
1163
|
+
/**
|
|
1164
|
+
* disallow Infinity
|
|
1165
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-infinity.html
|
|
1166
|
+
*/
|
|
1167
|
+
'jsonc/no-infinity'?: Linter.RuleEntry<[]>
|
|
1168
|
+
/**
|
|
1169
|
+
* disallow irregular whitespace
|
|
1170
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html
|
|
1171
|
+
*/
|
|
1172
|
+
'jsonc/no-irregular-whitespace'?: Linter.RuleEntry<JsoncNoIrregularWhitespace>
|
|
1173
|
+
/**
|
|
1174
|
+
* disallow multiline strings
|
|
1175
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-multi-str.html
|
|
1176
|
+
*/
|
|
1177
|
+
'jsonc/no-multi-str'?: Linter.RuleEntry<[]>
|
|
1178
|
+
/**
|
|
1179
|
+
* disallow NaN
|
|
1180
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-nan.html
|
|
1181
|
+
*/
|
|
1182
|
+
'jsonc/no-nan'?: Linter.RuleEntry<[]>
|
|
1183
|
+
/**
|
|
1184
|
+
* disallow number property keys
|
|
1185
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-number-props.html
|
|
1186
|
+
*/
|
|
1187
|
+
'jsonc/no-number-props'?: Linter.RuleEntry<[]>
|
|
1188
|
+
/**
|
|
1189
|
+
* disallow numeric separators
|
|
1190
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-numeric-separators.html
|
|
1191
|
+
*/
|
|
1192
|
+
'jsonc/no-numeric-separators'?: Linter.RuleEntry<[]>
|
|
1193
|
+
/**
|
|
1194
|
+
* disallow legacy octal literals
|
|
1195
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal.html
|
|
1196
|
+
*/
|
|
1197
|
+
'jsonc/no-octal'?: Linter.RuleEntry<[]>
|
|
1198
|
+
/**
|
|
1199
|
+
* disallow octal escape sequences in string literals
|
|
1200
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal-escape.html
|
|
1201
|
+
*/
|
|
1202
|
+
'jsonc/no-octal-escape'?: Linter.RuleEntry<[]>
|
|
1203
|
+
/**
|
|
1204
|
+
* disallow octal numeric literals
|
|
1205
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal-numeric-literals.html
|
|
1206
|
+
*/
|
|
1207
|
+
'jsonc/no-octal-numeric-literals'?: Linter.RuleEntry<[]>
|
|
1208
|
+
/**
|
|
1209
|
+
* disallow parentheses around the expression
|
|
1210
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-parenthesized.html
|
|
1211
|
+
*/
|
|
1212
|
+
'jsonc/no-parenthesized'?: Linter.RuleEntry<[]>
|
|
1213
|
+
/**
|
|
1214
|
+
* disallow plus sign
|
|
1215
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-plus-sign.html
|
|
1216
|
+
*/
|
|
1217
|
+
'jsonc/no-plus-sign'?: Linter.RuleEntry<[]>
|
|
1218
|
+
/**
|
|
1219
|
+
* disallow RegExp literals
|
|
1220
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-regexp-literals.html
|
|
1221
|
+
*/
|
|
1222
|
+
'jsonc/no-regexp-literals'?: Linter.RuleEntry<[]>
|
|
1223
|
+
/**
|
|
1224
|
+
* disallow sparse arrays
|
|
1225
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-sparse-arrays.html
|
|
1226
|
+
*/
|
|
1227
|
+
'jsonc/no-sparse-arrays'?: Linter.RuleEntry<[]>
|
|
1228
|
+
/**
|
|
1229
|
+
* disallow template literals
|
|
1230
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-template-literals.html
|
|
1231
|
+
*/
|
|
1232
|
+
'jsonc/no-template-literals'?: Linter.RuleEntry<[]>
|
|
1233
|
+
/**
|
|
1234
|
+
* disallow `undefined`
|
|
1235
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-undefined-value.html
|
|
1236
|
+
*/
|
|
1237
|
+
'jsonc/no-undefined-value'?: Linter.RuleEntry<[]>
|
|
1238
|
+
/**
|
|
1239
|
+
* disallow Unicode code point escape sequences.
|
|
1240
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-unicode-codepoint-escapes.html
|
|
1241
|
+
*/
|
|
1242
|
+
'jsonc/no-unicode-codepoint-escapes'?: Linter.RuleEntry<[]>
|
|
1243
|
+
/**
|
|
1244
|
+
* disallow unnecessary escape usage
|
|
1245
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-useless-escape.html
|
|
1246
|
+
*/
|
|
1247
|
+
'jsonc/no-useless-escape'?: Linter.RuleEntry<[]>
|
|
1248
|
+
/**
|
|
1249
|
+
* enforce consistent line breaks inside braces
|
|
1250
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-newline.html
|
|
1251
|
+
*/
|
|
1252
|
+
'jsonc/object-curly-newline'?: Linter.RuleEntry<JsoncObjectCurlyNewline>
|
|
1253
|
+
/**
|
|
1254
|
+
* enforce consistent spacing inside braces
|
|
1255
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-spacing.html
|
|
1256
|
+
*/
|
|
1257
|
+
'jsonc/object-curly-spacing'?: Linter.RuleEntry<JsoncObjectCurlySpacing>
|
|
1258
|
+
/**
|
|
1259
|
+
* enforce placing object properties on separate lines
|
|
1260
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-property-newline.html
|
|
1261
|
+
*/
|
|
1262
|
+
'jsonc/object-property-newline'?: Linter.RuleEntry<JsoncObjectPropertyNewline>
|
|
1263
|
+
/**
|
|
1264
|
+
* require quotes around object literal property names
|
|
1265
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quote-props.html
|
|
1266
|
+
*/
|
|
1267
|
+
'jsonc/quote-props'?: Linter.RuleEntry<JsoncQuoteProps>
|
|
1268
|
+
/**
|
|
1269
|
+
* enforce use of double or single quotes
|
|
1270
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quotes.html
|
|
1271
|
+
*/
|
|
1272
|
+
'jsonc/quotes'?: Linter.RuleEntry<JsoncQuotes>
|
|
1273
|
+
/**
|
|
1274
|
+
* require array values to be sorted
|
|
1275
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-array-values.html
|
|
1276
|
+
*/
|
|
1277
|
+
'jsonc/sort-array-values'?: Linter.RuleEntry<JsoncSortArrayValues>
|
|
1278
|
+
/**
|
|
1279
|
+
* require object keys to be sorted
|
|
1280
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-keys.html
|
|
1281
|
+
*/
|
|
1282
|
+
'jsonc/sort-keys'?: Linter.RuleEntry<JsoncSortKeys>
|
|
1283
|
+
/**
|
|
1284
|
+
* disallow spaces after unary operators
|
|
1285
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/space-unary-ops.html
|
|
1286
|
+
*/
|
|
1287
|
+
'jsonc/space-unary-ops'?: Linter.RuleEntry<JsoncSpaceUnaryOps>
|
|
1288
|
+
/**
|
|
1289
|
+
* disallow invalid number for JSON
|
|
1290
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/valid-json-number.html
|
|
1291
|
+
*/
|
|
1292
|
+
'jsonc/valid-json-number'?: Linter.RuleEntry<[]>
|
|
1293
|
+
/**
|
|
1294
|
+
* disallow parsing errors in Vue custom blocks
|
|
1295
|
+
* @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/vue-custom-block/no-parsing-error.html
|
|
1296
|
+
*/
|
|
1297
|
+
'jsonc/vue-custom-block/no-parsing-error'?: Linter.RuleEntry<[]>
|
|
1078
1298
|
/**
|
|
1079
1299
|
* Enforce the consistent use of either double or single quotes in JSX attributes
|
|
1080
1300
|
* @see https://eslint.org/docs/latest/rules/jsx-quotes
|
|
@@ -6656,6 +6876,267 @@ type JsdocTextEscaping = []|[{
|
|
|
6656
6876
|
type JsdocValidTypes = []|[{
|
|
6657
6877
|
allowEmptyNamepaths?: boolean
|
|
6658
6878
|
}]
|
|
6879
|
+
// ----- jsonc/array-bracket-newline -----
|
|
6880
|
+
type JsoncArrayBracketNewline = []|[(("always" | "never" | "consistent") | {
|
|
6881
|
+
multiline?: boolean
|
|
6882
|
+
minItems?: (number | null)
|
|
6883
|
+
})]
|
|
6884
|
+
// ----- jsonc/array-bracket-spacing -----
|
|
6885
|
+
type JsoncArrayBracketSpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
6886
|
+
singleValue?: boolean
|
|
6887
|
+
objectsInArrays?: boolean
|
|
6888
|
+
arraysInArrays?: boolean
|
|
6889
|
+
}]
|
|
6890
|
+
// ----- jsonc/array-element-newline -----
|
|
6891
|
+
type JsoncArrayElementNewline = []|[(_JsoncArrayElementNewlineBasicConfig | {
|
|
6892
|
+
ArrayExpression?: _JsoncArrayElementNewlineBasicConfig
|
|
6893
|
+
JSONArrayExpression?: _JsoncArrayElementNewlineBasicConfig
|
|
6894
|
+
ArrayPattern?: _JsoncArrayElementNewlineBasicConfig
|
|
6895
|
+
})]
|
|
6896
|
+
type _JsoncArrayElementNewlineBasicConfig = (("always" | "never" | "consistent") | {
|
|
6897
|
+
multiline?: boolean
|
|
6898
|
+
minItems?: (number | null)
|
|
6899
|
+
})
|
|
6900
|
+
// ----- jsonc/comma-dangle -----
|
|
6901
|
+
type JsoncCommaDangle = []|[(_JsoncCommaDangleValue | {
|
|
6902
|
+
arrays?: _JsoncCommaDangleValueWithIgnore
|
|
6903
|
+
objects?: _JsoncCommaDangleValueWithIgnore
|
|
6904
|
+
imports?: _JsoncCommaDangleValueWithIgnore
|
|
6905
|
+
exports?: _JsoncCommaDangleValueWithIgnore
|
|
6906
|
+
functions?: _JsoncCommaDangleValueWithIgnore
|
|
6907
|
+
})]
|
|
6908
|
+
type _JsoncCommaDangleValue = ("always-multiline" | "always" | "never" | "only-multiline")
|
|
6909
|
+
type _JsoncCommaDangleValueWithIgnore = ("always-multiline" | "always" | "ignore" | "never" | "only-multiline")
|
|
6910
|
+
// ----- jsonc/comma-style -----
|
|
6911
|
+
type JsoncCommaStyle = []|[("first" | "last")]|[("first" | "last"), {
|
|
6912
|
+
exceptions?: {
|
|
6913
|
+
[k: string]: boolean | undefined
|
|
6914
|
+
}
|
|
6915
|
+
}]
|
|
6916
|
+
// ----- jsonc/indent -----
|
|
6917
|
+
type JsoncIndent = []|[("tab" | number)]|[("tab" | number), {
|
|
6918
|
+
SwitchCase?: number
|
|
6919
|
+
VariableDeclarator?: ((number | ("first" | "off")) | {
|
|
6920
|
+
var?: (number | ("first" | "off"))
|
|
6921
|
+
let?: (number | ("first" | "off"))
|
|
6922
|
+
const?: (number | ("first" | "off"))
|
|
6923
|
+
})
|
|
6924
|
+
outerIIFEBody?: (number | "off")
|
|
6925
|
+
MemberExpression?: (number | "off")
|
|
6926
|
+
FunctionDeclaration?: {
|
|
6927
|
+
parameters?: (number | ("first" | "off"))
|
|
6928
|
+
body?: number
|
|
6929
|
+
}
|
|
6930
|
+
FunctionExpression?: {
|
|
6931
|
+
parameters?: (number | ("first" | "off"))
|
|
6932
|
+
body?: number
|
|
6933
|
+
}
|
|
6934
|
+
StaticBlock?: {
|
|
6935
|
+
body?: number
|
|
6936
|
+
}
|
|
6937
|
+
CallExpression?: {
|
|
6938
|
+
arguments?: (number | ("first" | "off"))
|
|
6939
|
+
}
|
|
6940
|
+
ArrayExpression?: (number | ("first" | "off"))
|
|
6941
|
+
ObjectExpression?: (number | ("first" | "off"))
|
|
6942
|
+
ImportDeclaration?: (number | ("first" | "off"))
|
|
6943
|
+
flatTernaryExpressions?: boolean
|
|
6944
|
+
offsetTernaryExpressions?: boolean
|
|
6945
|
+
ignoredNodes?: string[]
|
|
6946
|
+
ignoreComments?: boolean
|
|
6947
|
+
}]
|
|
6948
|
+
// ----- jsonc/key-name-casing -----
|
|
6949
|
+
type JsoncKeyNameCasing = []|[{
|
|
6950
|
+
camelCase?: boolean
|
|
6951
|
+
PascalCase?: boolean
|
|
6952
|
+
SCREAMING_SNAKE_CASE?: boolean
|
|
6953
|
+
"kebab-case"?: boolean
|
|
6954
|
+
snake_case?: boolean
|
|
6955
|
+
ignores?: string[]
|
|
6956
|
+
}]
|
|
6957
|
+
// ----- jsonc/key-spacing -----
|
|
6958
|
+
type JsoncKeySpacing = []|[({
|
|
6959
|
+
align?: (("colon" | "value") | {
|
|
6960
|
+
mode?: ("strict" | "minimum")
|
|
6961
|
+
on?: ("colon" | "value")
|
|
6962
|
+
beforeColon?: boolean
|
|
6963
|
+
afterColon?: boolean
|
|
6964
|
+
})
|
|
6965
|
+
mode?: ("strict" | "minimum")
|
|
6966
|
+
beforeColon?: boolean
|
|
6967
|
+
afterColon?: boolean
|
|
6968
|
+
} | {
|
|
6969
|
+
singleLine?: {
|
|
6970
|
+
mode?: ("strict" | "minimum")
|
|
6971
|
+
beforeColon?: boolean
|
|
6972
|
+
afterColon?: boolean
|
|
6973
|
+
}
|
|
6974
|
+
multiLine?: {
|
|
6975
|
+
align?: (("colon" | "value") | {
|
|
6976
|
+
mode?: ("strict" | "minimum")
|
|
6977
|
+
on?: ("colon" | "value")
|
|
6978
|
+
beforeColon?: boolean
|
|
6979
|
+
afterColon?: boolean
|
|
6980
|
+
})
|
|
6981
|
+
mode?: ("strict" | "minimum")
|
|
6982
|
+
beforeColon?: boolean
|
|
6983
|
+
afterColon?: boolean
|
|
6984
|
+
}
|
|
6985
|
+
} | {
|
|
6986
|
+
singleLine?: {
|
|
6987
|
+
mode?: ("strict" | "minimum")
|
|
6988
|
+
beforeColon?: boolean
|
|
6989
|
+
afterColon?: boolean
|
|
6990
|
+
}
|
|
6991
|
+
multiLine?: {
|
|
6992
|
+
mode?: ("strict" | "minimum")
|
|
6993
|
+
beforeColon?: boolean
|
|
6994
|
+
afterColon?: boolean
|
|
6995
|
+
}
|
|
6996
|
+
align?: {
|
|
6997
|
+
mode?: ("strict" | "minimum")
|
|
6998
|
+
on?: ("colon" | "value")
|
|
6999
|
+
beforeColon?: boolean
|
|
7000
|
+
afterColon?: boolean
|
|
7001
|
+
}
|
|
7002
|
+
})]
|
|
7003
|
+
// ----- jsonc/no-irregular-whitespace -----
|
|
7004
|
+
type JsoncNoIrregularWhitespace = []|[{
|
|
7005
|
+
skipComments?: boolean
|
|
7006
|
+
skipStrings?: boolean
|
|
7007
|
+
skipTemplates?: boolean
|
|
7008
|
+
skipRegExps?: boolean
|
|
7009
|
+
skipJSXText?: boolean
|
|
7010
|
+
}]
|
|
7011
|
+
// ----- jsonc/object-curly-newline -----
|
|
7012
|
+
type JsoncObjectCurlyNewline = []|[((("always" | "never") | {
|
|
7013
|
+
multiline?: boolean
|
|
7014
|
+
minProperties?: number
|
|
7015
|
+
consistent?: boolean
|
|
7016
|
+
}) | {
|
|
7017
|
+
ObjectExpression?: (("always" | "never") | {
|
|
7018
|
+
multiline?: boolean
|
|
7019
|
+
minProperties?: number
|
|
7020
|
+
consistent?: boolean
|
|
7021
|
+
})
|
|
7022
|
+
ObjectPattern?: (("always" | "never") | {
|
|
7023
|
+
multiline?: boolean
|
|
7024
|
+
minProperties?: number
|
|
7025
|
+
consistent?: boolean
|
|
7026
|
+
})
|
|
7027
|
+
ImportDeclaration?: (("always" | "never") | {
|
|
7028
|
+
multiline?: boolean
|
|
7029
|
+
minProperties?: number
|
|
7030
|
+
consistent?: boolean
|
|
7031
|
+
})
|
|
7032
|
+
ExportDeclaration?: (("always" | "never") | {
|
|
7033
|
+
multiline?: boolean
|
|
7034
|
+
minProperties?: number
|
|
7035
|
+
consistent?: boolean
|
|
7036
|
+
})
|
|
7037
|
+
})]
|
|
7038
|
+
// ----- jsonc/object-curly-spacing -----
|
|
7039
|
+
type JsoncObjectCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
7040
|
+
arraysInObjects?: boolean
|
|
7041
|
+
objectsInObjects?: boolean
|
|
7042
|
+
}]
|
|
7043
|
+
// ----- jsonc/object-property-newline -----
|
|
7044
|
+
type JsoncObjectPropertyNewline = []|[{
|
|
7045
|
+
allowAllPropertiesOnSameLine?: boolean
|
|
7046
|
+
allowMultiplePropertiesPerLine?: boolean
|
|
7047
|
+
}]
|
|
7048
|
+
// ----- jsonc/quote-props -----
|
|
7049
|
+
type JsoncQuoteProps = ([]|[("always" | "as-needed" | "consistent" | "consistent-as-needed")] | []|[("always" | "as-needed" | "consistent" | "consistent-as-needed")]|[("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
|
|
7050
|
+
keywords?: boolean
|
|
7051
|
+
unnecessary?: boolean
|
|
7052
|
+
numbers?: boolean
|
|
7053
|
+
}])
|
|
7054
|
+
// ----- jsonc/quotes -----
|
|
7055
|
+
type JsoncQuotes = []|[("single" | "double" | "backtick")]|[("single" | "double" | "backtick"), ("avoid-escape" | {
|
|
7056
|
+
avoidEscape?: boolean
|
|
7057
|
+
allowTemplateLiterals?: boolean
|
|
7058
|
+
})]
|
|
7059
|
+
// ----- jsonc/sort-array-values -----
|
|
7060
|
+
type JsoncSortArrayValues = [{
|
|
7061
|
+
pathPattern: string
|
|
7062
|
+
order: ((string | {
|
|
7063
|
+
valuePattern?: string
|
|
7064
|
+
order?: {
|
|
7065
|
+
type?: ("asc" | "desc")
|
|
7066
|
+
caseSensitive?: boolean
|
|
7067
|
+
natural?: boolean
|
|
7068
|
+
}
|
|
7069
|
+
})[] | {
|
|
7070
|
+
type?: ("asc" | "desc")
|
|
7071
|
+
caseSensitive?: boolean
|
|
7072
|
+
natural?: boolean
|
|
7073
|
+
})
|
|
7074
|
+
minValues?: number
|
|
7075
|
+
}, ...({
|
|
7076
|
+
pathPattern: string
|
|
7077
|
+
order: ((string | {
|
|
7078
|
+
valuePattern?: string
|
|
7079
|
+
order?: {
|
|
7080
|
+
type?: ("asc" | "desc")
|
|
7081
|
+
caseSensitive?: boolean
|
|
7082
|
+
natural?: boolean
|
|
7083
|
+
}
|
|
7084
|
+
})[] | {
|
|
7085
|
+
type?: ("asc" | "desc")
|
|
7086
|
+
caseSensitive?: boolean
|
|
7087
|
+
natural?: boolean
|
|
7088
|
+
})
|
|
7089
|
+
minValues?: number
|
|
7090
|
+
})[]]
|
|
7091
|
+
// ----- jsonc/sort-keys -----
|
|
7092
|
+
type JsoncSortKeys = ([{
|
|
7093
|
+
pathPattern: string
|
|
7094
|
+
hasProperties?: string[]
|
|
7095
|
+
order: ((string | {
|
|
7096
|
+
keyPattern?: string
|
|
7097
|
+
order?: {
|
|
7098
|
+
type?: ("asc" | "desc")
|
|
7099
|
+
caseSensitive?: boolean
|
|
7100
|
+
natural?: boolean
|
|
7101
|
+
}
|
|
7102
|
+
})[] | {
|
|
7103
|
+
type?: ("asc" | "desc")
|
|
7104
|
+
caseSensitive?: boolean
|
|
7105
|
+
natural?: boolean
|
|
7106
|
+
})
|
|
7107
|
+
minKeys?: number
|
|
7108
|
+
allowLineSeparatedGroups?: boolean
|
|
7109
|
+
}, ...({
|
|
7110
|
+
pathPattern: string
|
|
7111
|
+
hasProperties?: string[]
|
|
7112
|
+
order: ((string | {
|
|
7113
|
+
keyPattern?: string
|
|
7114
|
+
order?: {
|
|
7115
|
+
type?: ("asc" | "desc")
|
|
7116
|
+
caseSensitive?: boolean
|
|
7117
|
+
natural?: boolean
|
|
7118
|
+
}
|
|
7119
|
+
})[] | {
|
|
7120
|
+
type?: ("asc" | "desc")
|
|
7121
|
+
caseSensitive?: boolean
|
|
7122
|
+
natural?: boolean
|
|
7123
|
+
})
|
|
7124
|
+
minKeys?: number
|
|
7125
|
+
allowLineSeparatedGroups?: boolean
|
|
7126
|
+
})[]] | []|[("asc" | "desc")]|[("asc" | "desc"), {
|
|
7127
|
+
caseSensitive?: boolean
|
|
7128
|
+
natural?: boolean
|
|
7129
|
+
minKeys?: number
|
|
7130
|
+
allowLineSeparatedGroups?: boolean
|
|
7131
|
+
}])
|
|
7132
|
+
// ----- jsonc/space-unary-ops -----
|
|
7133
|
+
type JsoncSpaceUnaryOps = []|[{
|
|
7134
|
+
words?: boolean
|
|
7135
|
+
nonwords?: boolean
|
|
7136
|
+
overrides?: {
|
|
7137
|
+
[k: string]: boolean | undefined
|
|
7138
|
+
}
|
|
7139
|
+
}]
|
|
6659
7140
|
// ----- jsx-quotes -----
|
|
6660
7141
|
type JsxQuotes = []|[("prefer-single" | "prefer-double")]
|
|
6661
7142
|
// ----- key-spacing -----
|
|
@@ -10181,7 +10662,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
10181
10662
|
onlyEquality?: boolean
|
|
10182
10663
|
}]
|
|
10183
10664
|
// Names of all the configs
|
|
10184
|
-
type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:drizzle' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
|
|
10665
|
+
type ConfigNames = '2digits:antfu' | '2digits:comments' | '2digits:drizzle' | '2digits:graphql' | '2digits:ignores' | '2digits:gitignore' | '2digits:javascript' | '2digits:jsdoc' | '2digits:jsonc/base' | '2digits:jsonc/base' | '2digits:jsonc/json' | '2digits:jsonc/jsonc' | '2digits:jsonc/json5' | '2digits:jsonc/package.json' | '2digits:jsonc/tsconfig.json' | '2digits:jsonc/prettier' | '2digits:jsonc/prettier' | '2digits:jsonc/prettier' | '2digits:next/setup' | '2digits:next/rules' | '2digits:node' | '2digits:prettier' | '2digits:react/setup' | '2digits:react/rules' | '2digits:regexp' | '2digits:sonar' | '2digits:storybook/setup' | '2digits:storybook/rules' | '2digits:storybook/disables' | '2digits:storybook/config' | '2digits:tailwind' | '2digits:tanstack' | '2digits:turbo' | '2digits:typescript/setup' | '2digits:typescript/rules' | '2digits:typescript/disables/dts' | '2digits:typescript/disables/test' | '2digits:typescript/disables/cjs' | '2digits:unicorn'
|
|
10185
10666
|
|
|
10186
10667
|
type Rules = RuleOptions;
|
|
10187
10668
|
interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
|
|
@@ -10256,6 +10737,8 @@ declare function javascript(options?: OptionsOverrides): TypedFlatConfigItem[];
|
|
|
10256
10737
|
|
|
10257
10738
|
declare function jsdoc(): Promise<TypedFlatConfigItem[]>;
|
|
10258
10739
|
|
|
10740
|
+
declare function jsonc(): TypedFlatConfigItem[];
|
|
10741
|
+
|
|
10259
10742
|
declare function next(options?: OptionsWithFiles & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
10260
10743
|
|
|
10261
10744
|
declare function node(): TypedFlatConfigItem[];
|
|
@@ -10298,4 +10781,4 @@ interface ESLint2DigitsOptions {
|
|
|
10298
10781
|
}
|
|
10299
10782
|
declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
|
|
10300
10783
|
|
|
10301
|
-
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
|
|
10784
|
+
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, comments, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, jsonc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import K from'eslint-plugin-antfu';import Q from'@eslint-community/eslint-plugin-eslint-comments';import J from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import ne from'@eslint/js';import x from'globals';import T from'eslint-plugin-unicorn';import W from'eslint-plugin-n';import k from'eslint-plugin-sonarjs';import E from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function w(){return [{name:"2digits:antfu",plugins:{antfu:K},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}var p={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler",react:"react","@typescript-eslint":"ts",node:"node","@eslint-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar",drizzle:"drizzle"};var Z=renamePluginsInRules(J.recommended.rules,p);function v(){return [{name:"2digits:comments",plugins:{comments:Q},rules:{...Z,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:!0}]}}]}async function o(e){let t=await e;return t.default||t}async function C(e={}){let{overrides:t={},drizzleObjectName:r=["drizzle","db"]}=e,i=await o(import('eslint-plugin-drizzle'));return [{name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(i)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:r}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:r}],...t}}]}async function S(e={}){let{overrides:t={},files:r=["**/*.graphql","**/*.gql"]}=e,[i,a]=await Promise.all([o(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:!1,throwOnMissing:!1}).then(u=>u?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let u of Object.keys(l)){let y=u.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[u]=l[u]);}let f=renamePluginsInRules(c,p);return [{name:"2digits:graphql",plugins:{gql:i},languageOptions:{parser:i.parser},files:r,rules:{...f,"gql/naming-convention":["error",{allowLeadingUnderscore:!0}],...t}}]}var j="**/*.?([cm])[jt]s?(x)",h="**/*.?([cm])ts",O="**/*.?([cm])tsx",F="**/*.stories.tsx",I=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function P(e={}){let{gitIgnore:t,ignores:r=[]}=e;return composer({ignores:[I,r].flat(),name:"2digits:ignores"},o(import('eslint-config-flat-gitignore')).then(i=>i({strict:!1,...t,name:"2digits:gitignore"})))}function z(e={}){let{overrides:t={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...x.browser,...x.es2021,...x.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...ne.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:!0}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:!1}],"no-regex-spaces":"error","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!0,allowUnboundThis:!0}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...t}}]}async function _(){return [{name:"2digits:jsdoc",plugins:{jsdoc:await o(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}async function q(e={}){let{files:t=[h,O],overrides:r={},parserOptions:i}=e,[a,l]=await Promise.all([o(import('@next/eslint-plugin-next')),o(import('@typescript-eslint/parser'))]),c=renamePluginsInRules({...a.configs.recommended.rules,...a.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(a)}},{name:"2digits:next/rules",files:t,languageOptions:{parser:l,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"},rules:{...c,"next/no-html-link-for-pages":"off",...r}}]}function D(){return [{name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:W},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:!0}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function R(){let[e,t]=await Promise.all([o(import('eslint-config-prettier')),o(import('eslint-plugin-react'))]);return [{name:"2digits:prettier",plugins:{react:t},rules:{...e.rules,"tailwindcss/classnames-order":"off","react/jsx-newline":["error",{prevent:!1}]}}]}async function L(e={}){let{files:t=[h,O],overrides:r={},parserOptions:i,tsconfigRootDir:a,reactCompiler:l=!0}=e,[c,f,u,y,H]=await Promise.all([o(import('@eslint-react/eslint-plugin')),o(import('eslint-plugin-react-hooks')),o(import('eslint-plugin-react')),o(import('@typescript-eslint/parser')),l?o(import('eslint-plugin-react-compiler')):void 0]),b=c.configs.all.plugins,$=renamePluginsInRules({...u.configs.recommended.rules,...u.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:u,"react-dom":b["@eslint-react/dom"],"react-web-api":b["@eslint-react/web-api"],"react-extra":b["@eslint-react"],"react-hooks":fixupPluginRules(f),"react-hooks-extra":b["@eslint-react/hooks-extra"],"react-naming-convention":b["@eslint-react/naming-convention"],...l?{"react-compiler":H}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:t,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:a,projectService:!0,...i},sourceType:"module"},rules:{...$,...l?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/no-unnecessary-use-callback":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/no-redundant-custom-hook":"error","react-hooks-extra/no-unnecessary-use-memo":"error","react-extra/prefer-read-only-props":"off","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}function N(){return [{name:"2digits:regexp",plugins:{regexp:E},rules:{...E.configs["flat/recommended"].rules}}]}var ce=renamePluginsInRules(k.configs.recommended.rules,p);function G(){return [{name:"2digits:sonar",plugins:{sonar:k},rules:{...ce,"sonar/no-redundant-jump":"off"}}]}async function U(e={}){let{files:t=[F],overrides:r={},parserOptions:i,storybookDirectory:a=".storybook"}=e,[l,c]=await Promise.all([o(import('eslint-plugin-storybook')),o(import('@typescript-eslint/parser'))]),f={parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(l)}},{name:"2digits:storybook/rules",files:t,languageOptions:f,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...r}},{name:"2digits:storybook/disables",files:t,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${a}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function B(e={}){let{overrides:t={}}=e,[r,{tailwindFunctions:i},a]=await Promise.all([o(import('eslint-plugin-tailwindcss')),o(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{name:"2digits:tailwind",plugins:{tailwindcss:r},settings:{tailwindcss:{callees:i,config:a}},rules:{...r.configs.recommended.rules,...t}}]}async function M(e={}){let{overrides:t={}}=e,r=await o(import('@tanstack/eslint-plugin-query')),i=renamePluginsInRules(r.configs["flat/recommended"].at(0)?.rules??{},p);return [{name:"2digits:tanstack",plugins:{tanstack:r},rules:{...i,...t}}]}async function A(e={}){let{overrides:t={}}=e;return [{name:"2digits:turbo",plugins:{turbo:await o(import('eslint-plugin-turbo'))},rules:{"turbo/no-undeclared-env-vars":"error",...t}}]}async function X(e={}){let{overrides:t={},parserOptions:r={}}=e,[{plugin:i,configs:a,parser:l},c]=await Promise.all([o(import('typescript-eslint')),o(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(a.strictTypeChecked,p),u=Object.fromEntries(f.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c},languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"}},{name:"2digits:typescript/rules",files:[j],rules:{...u,"ts/restrict-template-expressions":["error",{allowNumber:!0}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"ts/no-empty-interface":["error",{allowSingleExtends:!0}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:!0,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...c.configs.recommended.rules,...t}},{files:["**/*.d.ts"],name:"2digits:typescript/disables/dts",rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{files:["**/*.{test,spec}.ts?(x)"],name:"2digits:typescript/disables/test",rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs","**/*.cts"],name:"2digits:typescript/disables/cjs",rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function V(){return [{name:"2digits:unicorn",plugins:{unicorn:T},rules:{...T.configs["flat/recommended"].rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-top-level-await":["off"]}}]}function g(e,t){return typeof e=="boolean"?e:e?.enable??t??!1}function d(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:t,...r}=e;return r}function ye(e={},...t){let r=new FlatConfigComposer(P(e.ignores),z(e.js),D(),v(),_(),V(),G(),N(),w());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(A(d(e.turbo))));let{overrides:i,...a}=d(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(X(d(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append(L({...d(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(q({...d(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(U({...d(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(B(d(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(M(d(e.tanstack)))),g(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(C(d(e.drizzle)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(S(d(e.graphql)))),r=r.append(...t),isPackageExists("prettier")&&(r=r.append(R())),r.renamePlugins(p).toConfigs()}export{w as antfu,v as comments,ye as default,C as drizzle,S as graphql,P as ignores,z as javascript,_ as jsdoc,q as next,D as node,R as prettier,L as react,N as regexp,G as sonar,U as storybook,B as tailwind,M as tanstack,A as turbo,ye as twoDigits,X as typescript,V as unicorn};//# sourceMappingURL=index.js.map
|
|
1
|
+
import oe from'eslint-plugin-antfu';import te from'@eslint-community/eslint-plugin-eslint-comments';import ne from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import me from'@eslint/js';import w from'globals';import ue,{configs}from'eslint-plugin-jsonc';import de from'jsonc-eslint-parser';import v from'eslint-plugin-unicorn';import M from'eslint-plugin-n';import j from'eslint-plugin-sonarjs';import J from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function C(){return [{name:"2digits:antfu",plugins:{antfu:oe},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}var p={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler",react:"react","@typescript-eslint":"ts",node:"node","@eslint-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar",drizzle:"drizzle"};var ie=renamePluginsInRules(ne.recommended.rules,p);function I(){return [{name:"2digits:comments",plugins:{comments:te},rules:{...ie,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:!0}]}}]}async function t(e){let o=await e;return o.default||o}async function S(e={}){let{overrides:o={},drizzleObjectName:r=["drizzle","db"]}=e,i=await t(import('eslint-plugin-drizzle'));return [{name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(i)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:r}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:r}],...o}}]}async function F(e={}){let{overrides:o={},files:r=["**/*.graphql","**/*.gql"]}=e,[i,a]=await Promise.all([t(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:!1,throwOnMissing:!1}).then(u=>u?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let u of Object.keys(l)){let y=u.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[u]=l[u]);}let f=renamePluginsInRules(c,p);return [{name:"2digits:graphql",plugins:{gql:i},languageOptions:{parser:i.parser},files:r,rules:{...f,"gql/naming-convention":["error",{allowLeadingUnderscore:!0}],...o}}]}var P="**/*.?([cm])[jt]s?(x)",x="**/*.?([cm])ts",k="**/*.?([cm])tsx",D="**/*.stories.tsx",_="**/*.json",z="**/*.json5",R="**/*.jsonc",q=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function W(e={}){let{gitIgnore:o,ignores:r=[]}=e;return composer({ignores:[q,r].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(i=>i({strict:!1,...o,name:"2digits:gitignore"})))}function L(e={}){let{overrides:o={}}=e;return [{name:"2digits:javascript",languageOptions:{ecmaVersion:2022,globals:{...w.browser,...w.es2021,...w.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...me.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:!0}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:!1}],"no-regex-spaces":"error","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!0,allowUnboundThis:!0}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...o}}]}async function N(){return [{name:"2digits:jsdoc",plugins:{jsdoc:await t(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}function E(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[_],...O,rules:{...T(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[R],...O,rules:{...T(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[z],...O,rules:{...T(configs["flat/recommended-with-json5"])}},{name:"2digits:jsonc/package.json",...O,files:["**/package.json"],rules:{"jsonc/sort-array-values":["error",{order:{type:"asc"},pathPattern:"^files$"}],"jsonc/sort-keys":["error",{order:["$schema","publisher","name","displayName","version","private","description","funding","homepage","repository","bugs","categories","type","main","module","types","typesVersions","bin","files","exports","icon","unpkg","jsdelivr","sideEffects","activationEvents","contributes","scripts","keywords","author","license","workspaces","dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","packageManager","engines","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig","prettier"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"},{order:["types","import","module","require","default"],pathPattern:"^exports.*$"}]}},{name:"2digits:jsonc/tsconfig.json",...O,files:["**/tsconfig.json","**/tsconfig.*.json","**/tsconfig-*.json","**/jsconfig.json","**/jsconfig.*.json","**/jsconfig-*.json"],rules:{"jsonc/sort-keys":["error",{order:["$schema","extends","compilerOptions","references","files","include","exclude"],pathPattern:"^$"},{order:["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","lib","jsx","experimentalDecorators","emitDecoratorMetadata","jsxFactory","jsxFragmentFactory","jsxImportSource","reactNamespace","noLib","useDefineForClassFields","moduleDetection","module","rootDir","moduleResolution","baseUrl","paths","rootDirs","typeRoots","types","allowUmdGlobalAccess","moduleSuffixes","allowImportingTsExtensions","resolvePackageJsonExports","resolvePackageJsonImports","customConditions","resolveJsonModule","allowArbitraryExtensions","noResolve","allowJs","checkJs","maxNodeModuleJsDepth","declaration","declarationMap","emitDeclarationOnly","sourceMap","inlineSourceMap","outFile","outDir","removeComments","noEmit","importHelpers","importsNotUsedAsValues","downlevelIteration","sourceRoot","mapRoot","inlineSources","emitBOM","newLine","stripInternal","noEmitHelpers","noEmitOnError","preserveConstEnums","declarationDir","preserveValueImports","isolatedModules","verbatimModuleSyntax","allowSyntheticDefaultImports","esModuleInterop","preserveSymlinks","forceConsistentCasingInFileNames","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","skipDefaultLibCheck","skipLibCheck"],pathPattern:"^compilerOptions$"}]}},...configs["flat/prettier"].map(e=>({...e,name:"2digits:jsonc/prettier"}))]}var O={languageOptions:{parser:de},plugins:{jsonc:ue}};function T(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}async function U(e={}){let{files:o=[x,k],overrides:r={},parserOptions:i}=e,[a,l]=await Promise.all([t(import('@next/eslint-plugin-next')),t(import('@typescript-eslint/parser'))]),c=renamePluginsInRules({...a.configs.recommended.rules,...a.configs["core-web-vitals"].rules},p);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(a)}},{name:"2digits:next/rules",files:o,languageOptions:{parser:l,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"},rules:{...c,"next/no-html-link-for-pages":"off",...r}}]}function G(){return [{name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:M},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:!0}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function B(){let[e,o]=await Promise.all([t(import('eslint-config-prettier')),t(import('eslint-plugin-react'))]);return [{name:"2digits:prettier",plugins:{react:o},rules:{...e.rules,"tailwindcss/classnames-order":"off","react/jsx-newline":["error",{prevent:!1}]}}]}async function A(e={}){let{files:o=[x,k],overrides:r={},parserOptions:i,tsconfigRootDir:a,reactCompiler:l=!0}=e,[c,f,u,y,ee]=await Promise.all([t(import('@eslint-react/eslint-plugin')),t(import('eslint-plugin-react-hooks')),t(import('eslint-plugin-react')),t(import('@typescript-eslint/parser')),l?t(import('eslint-plugin-react-compiler')):void 0]),b=c.configs.all.plugins,re=renamePluginsInRules({...u.configs.recommended.rules,...u.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:u,"react-dom":b["@eslint-react/dom"],"react-web-api":b["@eslint-react/web-api"],"react-extra":b["@eslint-react"],"react-hooks":fixupPluginRules(f),"react-hooks-extra":b["@eslint-react/hooks-extra"],"react-naming-convention":b["@eslint-react/naming-convention"],...l?{"react-compiler":ee}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:o,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:!0},tsconfigRootDir:a,projectService:!0,...i},sourceType:"module"},rules:{...re,...l?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/no-unnecessary-use-callback":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/no-redundant-custom-hook":"error","react-hooks-extra/no-unnecessary-use-memo":"error","react-extra/prefer-read-only-props":"off","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}function $(){return [{name:"2digits:regexp",plugins:{regexp:J},rules:{...J.configs["flat/recommended"].rules}}]}var Oe=renamePluginsInRules(j.configs.recommended.rules,p);function V(){return [{name:"2digits:sonar",plugins:{sonar:j},rules:{...Oe,"sonar/no-redundant-jump":"off"}}]}async function H(e={}){let{files:o=[D],overrides:r={},parserOptions:i,storybookDirectory:a=".storybook"}=e,[l,c]=await Promise.all([t(import('eslint-plugin-storybook')),t(import('@typescript-eslint/parser'))]),f={parser:c,parserOptions:{ecmaFeatures:{jsx:!0},projectService:!0,...i},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(l)}},{name:"2digits:storybook/rules",files:o,languageOptions:f,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...r}},{name:"2digits:storybook/disables",files:o,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${a}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function X(e={}){let{overrides:o={}}=e,[r,{tailwindFunctions:i},a]=await Promise.all([t(import('eslint-plugin-tailwindcss')),t(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{name:"2digits:tailwind",plugins:{tailwindcss:r},settings:{tailwindcss:{callees:i,config:a}},rules:{...r.configs.recommended.rules,...o}}]}async function K(e={}){let{overrides:o={}}=e,r=await t(import('@tanstack/eslint-plugin-query')),i=renamePluginsInRules(r.configs["flat/recommended"].at(0)?.rules??{},p);return [{name:"2digits:tanstack",plugins:{tanstack:r},rules:{...i,...o}}]}async function Q(e={}){let{overrides:o={}}=e;return [{name:"2digits:turbo",plugins:{turbo:await t(import('eslint-plugin-turbo'))},rules:{"turbo/no-undeclared-env-vars":"error",...o}}]}async function Y(e={}){let{overrides:o={},parserOptions:r={}}=e,[{plugin:i,configs:a,parser:l},c]=await Promise.all([t(import('typescript-eslint')),t(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(a.strictTypeChecked,p),u=Object.fromEntries(f.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c}},{name:"2digits:typescript/rules",files:[P],languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"},rules:{...u,"ts/restrict-template-expressions":["error",{allowNumber:!0}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"ts/no-empty-object-type":["error",{allowInterfaces:"with-single-extends",allowObjectTypes:"never"}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:!0,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...c.configs.recommended.rules,...o}},{files:["**/*.d.ts"],name:"2digits:typescript/disables/dts",rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{files:["**/*.{test,spec}.ts?(x)"],name:"2digits:typescript/disables/test",rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs","**/*.cts"],name:"2digits:typescript/disables/cjs",rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function Z(){return [{name:"2digits:unicorn",plugins:{unicorn:v},rules:{...v.configs["flat/recommended"].rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-top-level-await":["off"]}}]}function g(e,o){return typeof e=="boolean"?e:e?.enable??o??!1}function d(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...r}=e;return r}function je(e={},...o){let r=new FlatConfigComposer(W(e.ignores),L(e.js),G(),I(),N(),Z(),V(),$(),C(),E());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(Q(d(e.turbo))));let{overrides:i,...a}=d(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(Y(d(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append(A({...d(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(U({...d(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(H({...d(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(X(d(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(K(d(e.tanstack)))),g(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(S(d(e.drizzle)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(F(d(e.graphql)))),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(B())),r.renamePlugins(p).toConfigs()}export{C as antfu,I as comments,je as default,S as drizzle,F as graphql,W as ignores,L as javascript,N as jsdoc,E as jsonc,U as next,G as node,B as prettier,A as react,$ as regexp,V as sonar,H as storybook,X as tailwind,K as tanstack,Q as turbo,je as twoDigits,Y as typescript,Z as unicorn};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|