@2digits/eslint-config 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +416 -2
- package/dist/index.d.ts +416 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -2650,6 +2650,31 @@ Backward pagination arguments
|
|
|
2650
2650
|
* @deprecated
|
|
2651
2651
|
*/
|
|
2652
2652
|
'padding-line-between-statements'?: Linter.RuleEntry<PaddingLineBetweenStatements>
|
|
2653
|
+
/**
|
|
2654
|
+
* Enforce using "catalog:" in `package.json`
|
|
2655
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-enforce-catalog.test.ts
|
|
2656
|
+
*/
|
|
2657
|
+
'pnpm/json-enforce-catalog'?: Linter.RuleEntry<PnpmJsonEnforceCatalog>
|
|
2658
|
+
/**
|
|
2659
|
+
* Prefer having pnpm settings in `pnpm-workspace.yaml` instead of `package.json`. This would requires pnpm v10.6+, see https://github.com/orgs/pnpm/discussions/9037.
|
|
2660
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-prefer-workspace-settings.test.ts
|
|
2661
|
+
*/
|
|
2662
|
+
'pnpm/json-prefer-workspace-settings'?: Linter.RuleEntry<PnpmJsonPreferWorkspaceSettings>
|
|
2663
|
+
/**
|
|
2664
|
+
* Enforce using valid catalog in `package.json`
|
|
2665
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-valid-catalog.test.ts
|
|
2666
|
+
*/
|
|
2667
|
+
'pnpm/json-valid-catalog'?: Linter.RuleEntry<PnpmJsonValidCatalog>
|
|
2668
|
+
/**
|
|
2669
|
+
* Disallow unused catalogs in `pnpm-workspace.yaml`
|
|
2670
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/yaml-no-duplicate-catalog-item.test.ts
|
|
2671
|
+
*/
|
|
2672
|
+
'pnpm/yaml-no-duplicate-catalog-item'?: Linter.RuleEntry<PnpmYamlNoDuplicateCatalogItem>
|
|
2673
|
+
/**
|
|
2674
|
+
* Disallow unused catalogs in `pnpm-workspace.yaml`
|
|
2675
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/yaml-no-unused-catalog-item.test.ts
|
|
2676
|
+
*/
|
|
2677
|
+
'pnpm/yaml-no-unused-catalog-item'?: Linter.RuleEntry<[]>
|
|
2653
2678
|
/**
|
|
2654
2679
|
* Require using arrow functions for callbacks
|
|
2655
2680
|
* @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
@@ -7047,6 +7072,146 @@ Backward pagination arguments
|
|
|
7047
7072
|
* @deprecated
|
|
7048
7073
|
*/
|
|
7049
7074
|
'yield-star-spacing'?: Linter.RuleEntry<YieldStarSpacing>
|
|
7075
|
+
/**
|
|
7076
|
+
* require or disallow block style mappings.
|
|
7077
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping.html
|
|
7078
|
+
*/
|
|
7079
|
+
'yml/block-mapping'?: Linter.RuleEntry<YmlBlockMapping>
|
|
7080
|
+
/**
|
|
7081
|
+
* enforce consistent line breaks after `:` indicator
|
|
7082
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping-colon-indicator-newline.html
|
|
7083
|
+
*/
|
|
7084
|
+
'yml/block-mapping-colon-indicator-newline'?: Linter.RuleEntry<YmlBlockMappingColonIndicatorNewline>
|
|
7085
|
+
/**
|
|
7086
|
+
* enforce consistent line breaks after `?` indicator
|
|
7087
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping-question-indicator-newline.html
|
|
7088
|
+
*/
|
|
7089
|
+
'yml/block-mapping-question-indicator-newline'?: Linter.RuleEntry<YmlBlockMappingQuestionIndicatorNewline>
|
|
7090
|
+
/**
|
|
7091
|
+
* require or disallow block style sequences.
|
|
7092
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/block-sequence.html
|
|
7093
|
+
*/
|
|
7094
|
+
'yml/block-sequence'?: Linter.RuleEntry<YmlBlockSequence>
|
|
7095
|
+
/**
|
|
7096
|
+
* enforce consistent line breaks after `-` indicator
|
|
7097
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/block-sequence-hyphen-indicator-newline.html
|
|
7098
|
+
*/
|
|
7099
|
+
'yml/block-sequence-hyphen-indicator-newline'?: Linter.RuleEntry<YmlBlockSequenceHyphenIndicatorNewline>
|
|
7100
|
+
/**
|
|
7101
|
+
* enforce YAML file extension
|
|
7102
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/file-extension.html
|
|
7103
|
+
*/
|
|
7104
|
+
'yml/file-extension'?: Linter.RuleEntry<YmlFileExtension>
|
|
7105
|
+
/**
|
|
7106
|
+
* enforce consistent line breaks inside braces
|
|
7107
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/flow-mapping-curly-newline.html
|
|
7108
|
+
*/
|
|
7109
|
+
'yml/flow-mapping-curly-newline'?: Linter.RuleEntry<YmlFlowMappingCurlyNewline>
|
|
7110
|
+
/**
|
|
7111
|
+
* enforce consistent spacing inside braces
|
|
7112
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/flow-mapping-curly-spacing.html
|
|
7113
|
+
*/
|
|
7114
|
+
'yml/flow-mapping-curly-spacing'?: Linter.RuleEntry<YmlFlowMappingCurlySpacing>
|
|
7115
|
+
/**
|
|
7116
|
+
* enforce linebreaks after opening and before closing flow sequence brackets
|
|
7117
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/flow-sequence-bracket-newline.html
|
|
7118
|
+
*/
|
|
7119
|
+
'yml/flow-sequence-bracket-newline'?: Linter.RuleEntry<YmlFlowSequenceBracketNewline>
|
|
7120
|
+
/**
|
|
7121
|
+
* enforce consistent spacing inside flow sequence brackets
|
|
7122
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/flow-sequence-bracket-spacing.html
|
|
7123
|
+
*/
|
|
7124
|
+
'yml/flow-sequence-bracket-spacing'?: Linter.RuleEntry<YmlFlowSequenceBracketSpacing>
|
|
7125
|
+
/**
|
|
7126
|
+
* enforce consistent indentation
|
|
7127
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/indent.html
|
|
7128
|
+
*/
|
|
7129
|
+
'yml/indent'?: Linter.RuleEntry<YmlIndent>
|
|
7130
|
+
/**
|
|
7131
|
+
* enforce naming convention to key names
|
|
7132
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/key-name-casing.html
|
|
7133
|
+
*/
|
|
7134
|
+
'yml/key-name-casing'?: Linter.RuleEntry<YmlKeyNameCasing>
|
|
7135
|
+
/**
|
|
7136
|
+
* enforce consistent spacing between keys and values in mapping pairs
|
|
7137
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/key-spacing.html
|
|
7138
|
+
*/
|
|
7139
|
+
'yml/key-spacing'?: Linter.RuleEntry<YmlKeySpacing>
|
|
7140
|
+
/**
|
|
7141
|
+
* disallow empty document
|
|
7142
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-document.html
|
|
7143
|
+
*/
|
|
7144
|
+
'yml/no-empty-document'?: Linter.RuleEntry<[]>
|
|
7145
|
+
/**
|
|
7146
|
+
* disallow empty mapping keys
|
|
7147
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-key.html
|
|
7148
|
+
*/
|
|
7149
|
+
'yml/no-empty-key'?: Linter.RuleEntry<[]>
|
|
7150
|
+
/**
|
|
7151
|
+
* disallow empty mapping values
|
|
7152
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-mapping-value.html
|
|
7153
|
+
*/
|
|
7154
|
+
'yml/no-empty-mapping-value'?: Linter.RuleEntry<[]>
|
|
7155
|
+
/**
|
|
7156
|
+
* disallow empty sequence entries
|
|
7157
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-sequence-entry.html
|
|
7158
|
+
*/
|
|
7159
|
+
'yml/no-empty-sequence-entry'?: Linter.RuleEntry<[]>
|
|
7160
|
+
/**
|
|
7161
|
+
* disallow irregular whitespace
|
|
7162
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-irregular-whitespace.html
|
|
7163
|
+
*/
|
|
7164
|
+
'yml/no-irregular-whitespace'?: Linter.RuleEntry<YmlNoIrregularWhitespace>
|
|
7165
|
+
/**
|
|
7166
|
+
* disallow multiple empty lines
|
|
7167
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-multiple-empty-lines.html
|
|
7168
|
+
*/
|
|
7169
|
+
'yml/no-multiple-empty-lines'?: Linter.RuleEntry<YmlNoMultipleEmptyLines>
|
|
7170
|
+
/**
|
|
7171
|
+
* disallow tabs for indentation.
|
|
7172
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-tab-indent.html
|
|
7173
|
+
*/
|
|
7174
|
+
'yml/no-tab-indent'?: Linter.RuleEntry<[]>
|
|
7175
|
+
/**
|
|
7176
|
+
* disallow trailing zeros for floats
|
|
7177
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/no-trailing-zeros.html
|
|
7178
|
+
*/
|
|
7179
|
+
'yml/no-trailing-zeros'?: Linter.RuleEntry<[]>
|
|
7180
|
+
/**
|
|
7181
|
+
* require or disallow plain style scalar.
|
|
7182
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/plain-scalar.html
|
|
7183
|
+
*/
|
|
7184
|
+
'yml/plain-scalar'?: Linter.RuleEntry<YmlPlainScalar>
|
|
7185
|
+
/**
|
|
7186
|
+
* enforce the consistent use of either double, or single quotes
|
|
7187
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/quotes.html
|
|
7188
|
+
*/
|
|
7189
|
+
'yml/quotes'?: Linter.RuleEntry<YmlQuotes>
|
|
7190
|
+
/**
|
|
7191
|
+
* disallow mapping keys other than strings
|
|
7192
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/require-string-key.html
|
|
7193
|
+
*/
|
|
7194
|
+
'yml/require-string-key'?: Linter.RuleEntry<[]>
|
|
7195
|
+
/**
|
|
7196
|
+
* require mapping keys to be sorted
|
|
7197
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/sort-keys.html
|
|
7198
|
+
*/
|
|
7199
|
+
'yml/sort-keys'?: Linter.RuleEntry<YmlSortKeys>
|
|
7200
|
+
/**
|
|
7201
|
+
* require sequence values to be sorted
|
|
7202
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/sort-sequence-values.html
|
|
7203
|
+
*/
|
|
7204
|
+
'yml/sort-sequence-values'?: Linter.RuleEntry<YmlSortSequenceValues>
|
|
7205
|
+
/**
|
|
7206
|
+
* enforce consistent spacing after the `#` in a comment
|
|
7207
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/spaced-comment.html
|
|
7208
|
+
*/
|
|
7209
|
+
'yml/spaced-comment'?: Linter.RuleEntry<YmlSpacedComment>
|
|
7210
|
+
/**
|
|
7211
|
+
* disallow parsing errors in Vue custom blocks
|
|
7212
|
+
* @see https://ota-meshi.github.io/eslint-plugin-yml/rules/vue-custom-block/no-parsing-error.html
|
|
7213
|
+
*/
|
|
7214
|
+
'yml/vue-custom-block/no-parsing-error'?: Linter.RuleEntry<[]>
|
|
7050
7215
|
/**
|
|
7051
7216
|
* Require or disallow "Yoda" conditions
|
|
7052
7217
|
* @see https://eslint.org/docs/latest/rules/yoda
|
|
@@ -9593,6 +9758,43 @@ type PaddingLineBetweenStatements = {
|
|
|
9593
9758
|
prev: _PaddingLineBetweenStatementsStatementType
|
|
9594
9759
|
next: _PaddingLineBetweenStatementsStatementType
|
|
9595
9760
|
}[]
|
|
9761
|
+
// ----- pnpm/json-enforce-catalog -----
|
|
9762
|
+
type PnpmJsonEnforceCatalog = []|[{
|
|
9763
|
+
|
|
9764
|
+
allowedProtocols?: string[]
|
|
9765
|
+
|
|
9766
|
+
autofix?: boolean
|
|
9767
|
+
|
|
9768
|
+
defaultCatalog?: string
|
|
9769
|
+
|
|
9770
|
+
reuseExistingCatalog?: boolean
|
|
9771
|
+
|
|
9772
|
+
conflicts?: ("new-catalog" | "overrides" | "error")
|
|
9773
|
+
|
|
9774
|
+
fields?: string[]
|
|
9775
|
+
}]
|
|
9776
|
+
// ----- pnpm/json-prefer-workspace-settings -----
|
|
9777
|
+
type PnpmJsonPreferWorkspaceSettings = []|[{
|
|
9778
|
+
|
|
9779
|
+
autofix?: boolean
|
|
9780
|
+
}]
|
|
9781
|
+
// ----- pnpm/json-valid-catalog -----
|
|
9782
|
+
type PnpmJsonValidCatalog = []|[{
|
|
9783
|
+
|
|
9784
|
+
autoInsert?: boolean
|
|
9785
|
+
|
|
9786
|
+
autoInsertDefaultSpecifier?: string
|
|
9787
|
+
|
|
9788
|
+
autofix?: boolean
|
|
9789
|
+
|
|
9790
|
+
enforceNoConflict?: boolean
|
|
9791
|
+
|
|
9792
|
+
fields?: unknown[]
|
|
9793
|
+
}]
|
|
9794
|
+
// ----- pnpm/yaml-no-duplicate-catalog-item -----
|
|
9795
|
+
type PnpmYamlNoDuplicateCatalogItem = []|[{
|
|
9796
|
+
allow?: string[]
|
|
9797
|
+
}]
|
|
9596
9798
|
// ----- prefer-arrow-callback -----
|
|
9597
9799
|
type PreferArrowCallback = []|[{
|
|
9598
9800
|
allowNamedFunctions?: boolean
|
|
@@ -12810,13 +13012,220 @@ type YieldStarSpacing = []|[(("before" | "after" | "both" | "neither") | {
|
|
|
12810
13012
|
before?: boolean
|
|
12811
13013
|
after?: boolean
|
|
12812
13014
|
})]
|
|
13015
|
+
// ----- yml/block-mapping -----
|
|
13016
|
+
type YmlBlockMapping = []|[(("always" | "never") | {
|
|
13017
|
+
singleline?: ("always" | "never" | "ignore")
|
|
13018
|
+
multiline?: ("always" | "never" | "ignore")
|
|
13019
|
+
})]
|
|
13020
|
+
// ----- yml/block-mapping-colon-indicator-newline -----
|
|
13021
|
+
type YmlBlockMappingColonIndicatorNewline = []|[("always" | "never")]
|
|
13022
|
+
// ----- yml/block-mapping-question-indicator-newline -----
|
|
13023
|
+
type YmlBlockMappingQuestionIndicatorNewline = []|[("always" | "never")]
|
|
13024
|
+
// ----- yml/block-sequence -----
|
|
13025
|
+
type YmlBlockSequence = []|[(("always" | "never") | {
|
|
13026
|
+
singleline?: ("always" | "never" | "ignore")
|
|
13027
|
+
multiline?: ("always" | "never" | "ignore")
|
|
13028
|
+
})]
|
|
13029
|
+
// ----- yml/block-sequence-hyphen-indicator-newline -----
|
|
13030
|
+
type YmlBlockSequenceHyphenIndicatorNewline = []|[("always" | "never")]|[("always" | "never"), {
|
|
13031
|
+
nestedHyphen?: ("always" | "never")
|
|
13032
|
+
blockMapping?: ("always" | "never")
|
|
13033
|
+
}]
|
|
13034
|
+
// ----- yml/file-extension -----
|
|
13035
|
+
type YmlFileExtension = []|[{
|
|
13036
|
+
extension?: ("yaml" | "yml")
|
|
13037
|
+
caseSensitive?: boolean
|
|
13038
|
+
}]
|
|
13039
|
+
// ----- yml/flow-mapping-curly-newline -----
|
|
13040
|
+
type YmlFlowMappingCurlyNewline = []|[(("always" | "never") | {
|
|
13041
|
+
multiline?: boolean
|
|
13042
|
+
minProperties?: number
|
|
13043
|
+
consistent?: boolean
|
|
13044
|
+
})]
|
|
13045
|
+
// ----- yml/flow-mapping-curly-spacing -----
|
|
13046
|
+
type YmlFlowMappingCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
13047
|
+
arraysInObjects?: boolean
|
|
13048
|
+
objectsInObjects?: boolean
|
|
13049
|
+
}]
|
|
13050
|
+
// ----- yml/flow-sequence-bracket-newline -----
|
|
13051
|
+
type YmlFlowSequenceBracketNewline = []|[(("always" | "never" | "consistent") | {
|
|
13052
|
+
multiline?: boolean
|
|
13053
|
+
minItems?: (number | null)
|
|
13054
|
+
})]
|
|
13055
|
+
// ----- yml/flow-sequence-bracket-spacing -----
|
|
13056
|
+
type YmlFlowSequenceBracketSpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
13057
|
+
singleValue?: boolean
|
|
13058
|
+
objectsInArrays?: boolean
|
|
13059
|
+
arraysInArrays?: boolean
|
|
13060
|
+
}]
|
|
13061
|
+
// ----- yml/indent -----
|
|
13062
|
+
type YmlIndent = []|[number]|[number, {
|
|
13063
|
+
indentBlockSequences?: boolean
|
|
13064
|
+
indicatorValueIndent?: number
|
|
13065
|
+
}]
|
|
13066
|
+
// ----- yml/key-name-casing -----
|
|
13067
|
+
type YmlKeyNameCasing = []|[{
|
|
13068
|
+
camelCase?: boolean
|
|
13069
|
+
PascalCase?: boolean
|
|
13070
|
+
SCREAMING_SNAKE_CASE?: boolean
|
|
13071
|
+
"kebab-case"?: boolean
|
|
13072
|
+
snake_case?: boolean
|
|
13073
|
+
ignores?: string[]
|
|
13074
|
+
}]
|
|
13075
|
+
// ----- yml/key-spacing -----
|
|
13076
|
+
type YmlKeySpacing = []|[({
|
|
13077
|
+
align?: (("colon" | "value") | {
|
|
13078
|
+
on?: ("colon" | "value")
|
|
13079
|
+
mode?: ("strict" | "minimum")
|
|
13080
|
+
beforeColon?: boolean
|
|
13081
|
+
afterColon?: boolean
|
|
13082
|
+
})
|
|
13083
|
+
mode?: ("strict" | "minimum")
|
|
13084
|
+
beforeColon?: boolean
|
|
13085
|
+
afterColon?: boolean
|
|
13086
|
+
} | {
|
|
13087
|
+
singleLine?: {
|
|
13088
|
+
mode?: ("strict" | "minimum")
|
|
13089
|
+
beforeColon?: boolean
|
|
13090
|
+
afterColon?: boolean
|
|
13091
|
+
}
|
|
13092
|
+
multiLine?: {
|
|
13093
|
+
align?: (("colon" | "value") | {
|
|
13094
|
+
on?: ("colon" | "value")
|
|
13095
|
+
mode?: ("strict" | "minimum")
|
|
13096
|
+
beforeColon?: boolean
|
|
13097
|
+
afterColon?: boolean
|
|
13098
|
+
})
|
|
13099
|
+
mode?: ("strict" | "minimum")
|
|
13100
|
+
beforeColon?: boolean
|
|
13101
|
+
afterColon?: boolean
|
|
13102
|
+
}
|
|
13103
|
+
} | {
|
|
13104
|
+
singleLine?: {
|
|
13105
|
+
mode?: ("strict" | "minimum")
|
|
13106
|
+
beforeColon?: boolean
|
|
13107
|
+
afterColon?: boolean
|
|
13108
|
+
}
|
|
13109
|
+
multiLine?: {
|
|
13110
|
+
mode?: ("strict" | "minimum")
|
|
13111
|
+
beforeColon?: boolean
|
|
13112
|
+
afterColon?: boolean
|
|
13113
|
+
}
|
|
13114
|
+
align?: {
|
|
13115
|
+
on?: ("colon" | "value")
|
|
13116
|
+
mode?: ("strict" | "minimum")
|
|
13117
|
+
beforeColon?: boolean
|
|
13118
|
+
afterColon?: boolean
|
|
13119
|
+
}
|
|
13120
|
+
})]
|
|
13121
|
+
// ----- yml/no-irregular-whitespace -----
|
|
13122
|
+
type YmlNoIrregularWhitespace = []|[{
|
|
13123
|
+
skipComments?: boolean
|
|
13124
|
+
skipQuotedScalars?: boolean
|
|
13125
|
+
}]
|
|
13126
|
+
// ----- yml/no-multiple-empty-lines -----
|
|
13127
|
+
type YmlNoMultipleEmptyLines = []|[{
|
|
13128
|
+
max: number
|
|
13129
|
+
maxEOF?: number
|
|
13130
|
+
maxBOF?: number
|
|
13131
|
+
}]
|
|
13132
|
+
// ----- yml/plain-scalar -----
|
|
13133
|
+
type YmlPlainScalar = []|[("always" | "never")]|[("always" | "never"), {
|
|
13134
|
+
ignorePatterns?: string[]
|
|
13135
|
+
overrides?: {
|
|
13136
|
+
mappingKey?: ("always" | "never" | null)
|
|
13137
|
+
}
|
|
13138
|
+
}]
|
|
13139
|
+
// ----- yml/quotes -----
|
|
13140
|
+
type YmlQuotes = []|[{
|
|
13141
|
+
prefer?: ("double" | "single")
|
|
13142
|
+
avoidEscape?: boolean
|
|
13143
|
+
}]
|
|
13144
|
+
// ----- yml/sort-keys -----
|
|
13145
|
+
type YmlSortKeys = ([{
|
|
13146
|
+
pathPattern: string
|
|
13147
|
+
hasProperties?: string[]
|
|
13148
|
+
order: ((string | {
|
|
13149
|
+
keyPattern?: string
|
|
13150
|
+
order?: {
|
|
13151
|
+
type?: ("asc" | "desc")
|
|
13152
|
+
caseSensitive?: boolean
|
|
13153
|
+
natural?: boolean
|
|
13154
|
+
}
|
|
13155
|
+
})[] | {
|
|
13156
|
+
type?: ("asc" | "desc")
|
|
13157
|
+
caseSensitive?: boolean
|
|
13158
|
+
natural?: boolean
|
|
13159
|
+
})
|
|
13160
|
+
minKeys?: number
|
|
13161
|
+
allowLineSeparatedGroups?: boolean
|
|
13162
|
+
}, ...({
|
|
13163
|
+
pathPattern: string
|
|
13164
|
+
hasProperties?: string[]
|
|
13165
|
+
order: ((string | {
|
|
13166
|
+
keyPattern?: string
|
|
13167
|
+
order?: {
|
|
13168
|
+
type?: ("asc" | "desc")
|
|
13169
|
+
caseSensitive?: boolean
|
|
13170
|
+
natural?: boolean
|
|
13171
|
+
}
|
|
13172
|
+
})[] | {
|
|
13173
|
+
type?: ("asc" | "desc")
|
|
13174
|
+
caseSensitive?: boolean
|
|
13175
|
+
natural?: boolean
|
|
13176
|
+
})
|
|
13177
|
+
minKeys?: number
|
|
13178
|
+
allowLineSeparatedGroups?: boolean
|
|
13179
|
+
})[]] | []|[("asc" | "desc")]|[("asc" | "desc"), {
|
|
13180
|
+
caseSensitive?: boolean
|
|
13181
|
+
natural?: boolean
|
|
13182
|
+
minKeys?: number
|
|
13183
|
+
allowLineSeparatedGroups?: boolean
|
|
13184
|
+
}])
|
|
13185
|
+
// ----- yml/sort-sequence-values -----
|
|
13186
|
+
type YmlSortSequenceValues = [{
|
|
13187
|
+
pathPattern: string
|
|
13188
|
+
order: ((string | {
|
|
13189
|
+
valuePattern?: string
|
|
13190
|
+
order?: {
|
|
13191
|
+
type?: ("asc" | "desc")
|
|
13192
|
+
caseSensitive?: boolean
|
|
13193
|
+
natural?: boolean
|
|
13194
|
+
}
|
|
13195
|
+
})[] | {
|
|
13196
|
+
type?: ("asc" | "desc")
|
|
13197
|
+
caseSensitive?: boolean
|
|
13198
|
+
natural?: boolean
|
|
13199
|
+
})
|
|
13200
|
+
minValues?: number
|
|
13201
|
+
}, ...({
|
|
13202
|
+
pathPattern: string
|
|
13203
|
+
order: ((string | {
|
|
13204
|
+
valuePattern?: string
|
|
13205
|
+
order?: {
|
|
13206
|
+
type?: ("asc" | "desc")
|
|
13207
|
+
caseSensitive?: boolean
|
|
13208
|
+
natural?: boolean
|
|
13209
|
+
}
|
|
13210
|
+
})[] | {
|
|
13211
|
+
type?: ("asc" | "desc")
|
|
13212
|
+
caseSensitive?: boolean
|
|
13213
|
+
natural?: boolean
|
|
13214
|
+
})
|
|
13215
|
+
minValues?: number
|
|
13216
|
+
})[]]
|
|
13217
|
+
// ----- yml/spaced-comment -----
|
|
13218
|
+
type YmlSpacedComment = []|[("always" | "never")]|[("always" | "never"), {
|
|
13219
|
+
exceptions?: string[]
|
|
13220
|
+
markers?: string[]
|
|
13221
|
+
}]
|
|
12813
13222
|
// ----- yoda -----
|
|
12814
13223
|
type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
12815
13224
|
exceptRange?: boolean
|
|
12816
13225
|
onlyEquality?: boolean
|
|
12817
13226
|
}]
|
|
12818
13227
|
// Names of all the configs
|
|
12819
|
-
type ConfigNames = '2digits:antfu' | '2digits:boolean' | '2digits:comments' | '2digits:css' | '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'
|
|
13228
|
+
type ConfigNames = '2digits:antfu' | '2digits:boolean' | '2digits:comments' | '2digits:css' | '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:pnpm/package-json' | '2digits:pnpm/pnpm-workspace-yaml' | '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' | '2digits:yaml/setup' | '2digits:yaml/base' | '2digits:yaml/recommended' | '2digits:yaml/standard' | '2digits:yaml/pnpm-workspace' | '2digits:yaml/prettier'
|
|
12820
13229
|
|
|
12821
13230
|
type Rules = RuleOptions;
|
|
12822
13231
|
interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
|
|
@@ -12901,6 +13310,8 @@ declare function next(options?: OptionsWithFiles & OptionsTypeScriptWithTypes):
|
|
|
12901
13310
|
|
|
12902
13311
|
declare function node(): TypedFlatConfigItem[];
|
|
12903
13312
|
|
|
13313
|
+
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
13314
|
+
|
|
12904
13315
|
declare function prettier(): Promise<TypedFlatConfigItem[]>;
|
|
12905
13316
|
|
|
12906
13317
|
declare function react(options?: OptionsWithReact & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
@@ -12921,6 +13332,8 @@ declare function typescript(options?: OptionsTypeScriptWithTypes): Promise<Typed
|
|
|
12921
13332
|
|
|
12922
13333
|
declare function unicorn(): TypedFlatConfigItem[];
|
|
12923
13334
|
|
|
13335
|
+
declare function yaml(): TypedFlatConfigItem[];
|
|
13336
|
+
|
|
12924
13337
|
type SharedOptions<T = unknown> = T & {
|
|
12925
13338
|
enable?: boolean;
|
|
12926
13339
|
};
|
|
@@ -12929,6 +13342,7 @@ interface ESLint2DigitsOptions {
|
|
|
12929
13342
|
turbo?: SharedOptions<OptionsOverrides> | boolean;
|
|
12930
13343
|
js?: OptionsOverrides;
|
|
12931
13344
|
ts?: SharedOptions<OptionsTypeScriptWithTypes> | boolean;
|
|
13345
|
+
pnpm?: SharedOptions | boolean;
|
|
12932
13346
|
graphql?: SharedOptions<OptionsWithFiles> | boolean;
|
|
12933
13347
|
react?: SharedOptions<OptionsWithReact> | boolean;
|
|
12934
13348
|
next?: SharedOptions<OptionsWithFiles> | boolean;
|
|
@@ -12939,4 +13353,4 @@ interface ESLint2DigitsOptions {
|
|
|
12939
13353
|
}
|
|
12940
13354
|
declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
|
|
12941
13355
|
|
|
12942
|
-
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, boolean, comments, css, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, jsonc, next, node, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn };
|
|
13356
|
+
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, boolean, comments, css, twoDigits as default, drizzle, graphql, ignores, javascript, jsdoc, jsonc, next, node, pnpm, prettier, react, regexp, sonar, storybook, tailwind, tanstack, turbo, twoDigits, typescript, unicorn, yaml };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import ie from'eslint-plugin-antfu';import D from'eslint-plugin-de-morgan';import ae from'@eslint-community/eslint-plugin-eslint-comments';import pe from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import G from'@eslint/css';import {tailwindSyntax}from'@eslint/css/syntax';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import ye from'@eslint/js';import be from'@stylistic/eslint-plugin';import v from'globals';import he,{configs}from'eslint-plugin-jsonc';import Oe from'jsonc-eslint-parser';import j from'eslint-plugin-unicorn';import J from'eslint-plugin-n';import $ from'eslint-plugin-sonarjs';import K from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';var n="**/*.?([cm])[jt]s?(x)",k="**/*.?([cm])ts",w="**/*.?([cm])tsx",C="**/*.stories.tsx",S="**/*.json",I="**/*.json5",F="**/*.jsonc",P="**/*.css",_=["**/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"];function L(){return [{files:[n],name:"2digits:antfu",plugins:{antfu:ie},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}function R(){return [{files:[n],name:"2digits:boolean",plugins:{boolean:D},rules:{...D.configs.recommended.rules}}]}var l={"@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","@stylistic/eslint-plugin":"stylistic","@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","de-morgan":"boolean"};var ce=renamePluginsInRules(pe.recommended.rules,l);function z(){return [{files:[n],name:"2digits:comments",plugins:{comments:ae},rules:{...ce,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:true}]}}]}function q(){return [{name:"2digits:css",files:[P],language:"css/css",plugins:{css:G},languageOptions:{tolerant:true,customSyntax:tailwindSyntax},rules:{...G.configs.recommended.rules}}]}async function t(e){let o=await e;return o.default||o}async function B(e={}){let{overrides:o={},drizzleObjectName:r=["drizzle","db"]}=e,a=await t(import('eslint-plugin-drizzle'));return [{files:[n],name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(a)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:r}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:r}],...o}}]}async function W(e={}){let{overrides:o={},files:r=["**/*.graphql","**/*.gql"]}=e,[a,p]=await Promise.all([t(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:false,throwOnMissing:false}).then(g=>g?.getDefault().schema)]),c=a.configs["flat/operations-recommended"].rules,m={};if(p)m=c;else for(let g of Object.keys(c)){let b=g.replace("@graphql-eslint/","");b in a.rules&&(a.rules[b].meta.docs?.requiresSchema||a.rules[b].meta.docs?.requiresSiblings)||(m[g]=c[g]);}let f=renamePluginsInRules(m,l);return [{name:"2digits:graphql",plugins:{gql:a},languageOptions:{parser:a.parser},files:r,rules:{...f,"gql/naming-convention":["error",{allowLeadingUnderscore:true}],...o}}]}async function N(e={}){let{gitIgnore:o,ignores:r=[]}=e;return composer({ignores:[_,r].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(a=>a({strict:false,...o,name:"2digits:gitignore"})))}function E(e={}){let{overrides:o={}}=e;return [{files:[n],name:"2digits:javascript",plugins:{stylistic:be},languageOptions:{ecmaVersion:2022,globals:{...v.browser,...v.es2021,...v.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:true},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:true},rules:{...ye.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:true,setWithoutGet:true}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:true}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:false,newIsCap:true,properties:true}],"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:true}],"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:false,allowSwitch:false}],"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:false}],"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:true}],"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:false}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:true,allowTaggedTemplates:true,allowTernary:true}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:true,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:true,ignoreConstructors:false}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:true,allowUnboundThis:true}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:true}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:true}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:true,enforceForSwitchCase:true}],"valid-typeof":["error",{requireStringLiterals:true}],"vars-on-top":"error",yoda:["error","never"],"stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:["const","let"],next:"*"},{blankLine:"any",prev:["const","let"],next:["const","let"]},{blankLine:"always",prev:"*",next:"return"}],...o}}]}async function U(){return [{files:[n],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 M(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[S],...x,rules:{...T(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[F],...x,rules:{...T(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[I],...x,rules:{...T(configs["flat/recommended-with-json5"])}},{name:"2digits:jsonc/package.json",...x,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",...x,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 x={languageOptions:{parser:Oe},plugins:{jsonc:he}};function T(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}async function A(e={}){let{files:o=[k,w],overrides:r={},parserOptions:a}=e,[p,c]=await Promise.all([t(import('@next/eslint-plugin-next')),t(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...p.configs.recommended.rules,...p.configs["core-web-vitals"].rules},l);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(p)}},{name:"2digits:next/rules",files:o,languageOptions:{parser:c,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...a},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...r}}]}function V(){return [{files:[n],name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:J},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:true}],"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 H(){let[e,o]=await Promise.all([t(import('eslint-config-prettier')),t(import('@stylistic/eslint-plugin'))]);return [{name:"2digits:prettier",plugins:{stylistic:o},rules:{...e.rules,"tailwindcss/classnames-order":"off","stylistic/jsx-newline":["error",{prevent:false}]}}]}async function X(e={}){let{files:o=[k,w],overrides:r={},parserOptions:a,tsconfigRootDir:p,reactCompiler:c=true}=e,[m,f,g,b]=await Promise.all([t(import('@eslint-react/eslint-plugin')),t(import('eslint-plugin-react-hooks')),t(import('@typescript-eslint/parser')),c?t(import('eslint-plugin-react-compiler')):void 0]),h=m.configs.all.plugins,se=renamePluginsInRules({...f.configs["recommended-latest"].rules,...m.configs["recommended-type-checked"].rules},l);return [{name:"2digits:react/setup",plugins:{stylistic:be,"react-dom":h["@eslint-react/dom"],"react-web-api":h["@eslint-react/web-api"],"react-extra":h["@eslint-react"],"react-hooks":f,"react-hooks-extra":h["@eslint-react/hooks-extra"],"react-naming-convention":h["@eslint-react/naming-convention"],...c?{"react-compiler":b}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:o,languageOptions:{parser:g,parserOptions:{ecmaFeatures:{jsx:true},tsconfigRootDir:p,projectService:true,...a},sourceType:"module"},rules:{...se,...c?{"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-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","stylistic/jsx-curly-newline":"off","stylistic/jsx-newline":["error",{prevent:false}],"stylistic/jsx-self-closing-comp":"error",...r}}]}function Q(){return [{files:[n],name:"2digits:regexp",plugins:{regexp:K},rules:{...K.configs["flat/recommended"].rules}}]}function Y(){return [{files:[n],name:"2digits:sonar",plugins:{sonar:$},rules:{"sonar/code-eval":"error","sonar/cognitive-complexity":"error","sonar/comma-or-logical-or-case":"error","sonar/concise-regex":"error","sonar/confidential-information-logging":"error","sonar/constructor-for-side-effects":"error","sonar/content-length":"error","sonar/content-security-policy":"error","sonar/cookie-no-httponly":"error","sonar/cors":"error","sonar/csrf":"error","sonar/max-switch-cases":"error","sonar/no-all-duplicated-branches":"error","sonar/no-collapsible-if":"error","sonar/no-collection-size-mischeck":"error","sonar/no-duplicate-string":["error",{threshold:5}],"sonar/no-duplicated-branches":"error","sonar/no-element-overwrite":"error","sonar/no-empty-collection":"error","sonar/no-extra-arguments":"error","sonar/no-for-in-iterable":"error","sonar/no-gratuitous-expressions":"error","sonar/no-identical-conditions":"error","sonar/no-identical-expressions":"error","sonar/no-identical-functions":"error","sonar/no-ignored-return":"error","sonar/no-inverted-boolean-check":"error","sonar/no-nested-switch":"error","sonar/no-nested-template-literals":"error","sonar/no-one-iteration-loop":"error","sonar/no-redundant-boolean":"error","sonar/no-same-line-conditional":"error","sonar/no-small-switch":"error","sonar/no-unused-collection":"error","sonar/no-use-of-empty-return-value":"error","sonar/no-useless-catch":"error","sonar/non-existent-operator":"error","sonar/prefer-immediate-return":"error","sonar/prefer-object-literal":"error","sonar/prefer-single-boolean-return":"error","sonar/prefer-while":"error","sonar/elseif-without-else":"off","sonar/no-redundant-jump":"off"}}]}async function Z(e={}){let{files:o=[C],overrides:r={},parserOptions:a,storybookDirectory:p=".storybook"}=e,[c,m]=await Promise.all([t(import('eslint-plugin-storybook')),t(import('@typescript-eslint/parser'))]),f={parser:m,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...a},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(c)}},{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:[`${p}/main.@(js|cjs|mjs|ts)`],languageOptions:f,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function ee(e={}){let{overrides:o={}}=e,[r,{tailwindFunctions:a},p]=await Promise.all([t(import('eslint-plugin-tailwindcss')),t(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{files:[n],name:"2digits:tailwind",plugins:{tailwindcss:r},settings:{tailwindcss:{callees:a,config:p}},rules:{...r.configs.recommended.rules,...o}}]}async function re(e={}){let{overrides:o={}}=e,r=await t(import('@tanstack/eslint-plugin-query')),a=renamePluginsInRules(r.configs["flat/recommended"].at(0)?.rules??{},l);return [{files:[n],name:"2digits:tanstack",plugins:{tanstack:r},rules:{...a,...o}}]}async function oe(e={}){let{overrides:o={}}=e,r=await t(import('eslint-plugin-turbo'));return [{files:[n],name:"2digits:turbo",plugins:{turbo:r},rules:{"turbo/no-undeclared-env-vars":"error",...o}}]}async function te(e={}){let{overrides:o={},parserOptions:r={}}=e,[{plugin:a,configs:p,parser:c},m]=await Promise.all([t(import('typescript-eslint')),t(import('@2digits/eslint-plugin'))]),f=renamePluginsInConfigs(p.strictTypeChecked,l),g=Object.fromEntries(f.flatMap(({rules:b})=>Object.entries(b??{})));return [{name:"2digits:typescript/setup",plugins:{ts:a,"@2digits":m}},{name:"2digits:typescript/rules",files:[n],languageOptions:{parser:c,parserOptions:{tsconfigRootDir:process.cwd(),projectService:true,warnOnUnsupportedTypeScriptVersion:false,...r},sourceType:"module"},rules:{...g,"ts/restrict-template-expressions":["error",{allowNumber:true}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:false,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:true,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.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 ne(){return [{files:[n],name:"2digits:unicorn",plugins:{unicorn:j},rules:{...j.configs.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:false,checkArrowFunctionBody:false}],"unicorn/prefer-top-level-await":["off"]}}]}function y(e,o){return typeof e=="boolean"?e:e?.enable??o??false}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...r}=e;return r}function Fe(e={},...o){let r=new FlatConfigComposer(N(e.ignores),E(e.js),R(),V(),z(),U(),ne(),Y(),Q(),L(),M(),q());y(e.turbo,isPackageExists("turbo"))&&(r=r.append(oe(u(e.turbo))));let{overrides:a,...p}=u(e.ts);return y(e.ts,isPackageExists("typescript"))&&(r=r.append(te(u(e.ts)))),y(e.react,isPackageExists("react"))&&(r=r.append(X({...u(e.react),...p}))),y(e.next,isPackageExists("next"))&&(r=r.append(A({...u(e.next),...p}))),y(e.storybook,isPackageExists("storybook"))&&(r=r.append(Z({...u(e.storybook),...p}))),y(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(ee(u(e.tailwind)))),y(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(re(u(e.tanstack)))),y(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(B(u(e.drizzle)))),y(e.graphql,isPackageExists("graphql"))&&(r=r.append(W(u(e.graphql)))),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(H())),r.renamePlugins(l).toConfigs()}export{L as antfu,R as boolean,z as comments,q as css,Fe as default,B as drizzle,W as graphql,N as ignores,E as javascript,U as jsdoc,M as jsonc,A as next,V as node,H as prettier,X as react,Q as regexp,Y as sonar,Z as storybook,ee as tailwind,re as tanstack,oe as turbo,Fe as twoDigits,te as typescript,ne as unicorn};//# sourceMappingURL=index.js.map
|
|
1
|
+
import ce from'eslint-plugin-antfu';import z from'eslint-plugin-de-morgan';import me from'@eslint-community/eslint-plugin-eslint-comments';import de from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import G from'@eslint/css';import {tailwindSyntax}from'@eslint/css/syntax';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import xe from'@eslint/js';import ke from'@stylistic/eslint-plugin';import T from'globals';import we,{configs}from'eslint-plugin-jsonc';import ve from'jsonc-eslint-parser';import C from'eslint-plugin-unicorn';import V from'eslint-plugin-n';import H from'eslint-plugin-sonarjs';import Se from'yaml-eslint-parser';import Z from'eslint-plugin-regexp';import {findUp}from'find-up';import Re from'eslint-plugin-yml';import {isPackageExists}from'local-pkg';var i="**/*.?([cm])[jt]s?(x)",w="**/*.?([cm])ts",v="**/*.?([cm])tsx",S="**/*.stories.tsx",I="**/*.json",F="**/*.json5",P="**/*.jsonc",D="**/*.css",_="**/*.ya?ml",L=["**/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"];function R(){return [{files:[i],name:"2digits:antfu",plugins:{antfu:ce},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}function q(){return [{files:[i],name:"2digits:boolean",plugins:{boolean:z},rules:{...z.configs.recommended.rules}}]}var c={"@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","@stylistic/eslint-plugin":"stylistic","@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","de-morgan":"boolean"};var fe=renamePluginsInRules(de.recommended.rules,c);function B(){return [{files:[i],name:"2digits:comments",plugins:{comments:me},rules:{...fe,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:true}]}}]}function W(){return [{name:"2digits:css",files:[D],language:"css/css",plugins:{css:G},languageOptions:{tolerant:true,customSyntax:tailwindSyntax},rules:{...G.configs.recommended.rules}}]}async function t(e){let o=await e;return o.default||o}async function N(e={}){let{overrides:o={},drizzleObjectName:a=["drizzle","db"]}=e,r=await t(import('eslint-plugin-drizzle'));return [{files:[i],name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(r)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:a}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:a}],...o}}]}async function E(e={}){let{overrides:o={},files:a=["**/*.graphql","**/*.gql"]}=e,[r,l]=await Promise.all([t(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:false,throwOnMissing:false}).then(y=>y?.getDefault().schema)]),p=r.configs["flat/operations-recommended"].rules,m={};if(l)m=p;else for(let y of Object.keys(p)){let b=y.replace("@graphql-eslint/","");b in r.rules&&(r.rules[b].meta.docs?.requiresSchema||r.rules[b].meta.docs?.requiresSiblings)||(m[y]=p[y]);}let g=renamePluginsInRules(m,c);return [{name:"2digits:graphql",plugins:{gql:r},languageOptions:{parser:r.parser},files:a,rules:{...g,"gql/naming-convention":["error",{allowLeadingUnderscore:true}],...o}}]}async function M(e={}){let{gitIgnore:o,ignores:a=[]}=e;return composer({ignores:[L,a].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(r=>r({strict:false,...o,name:"2digits:gitignore"})))}function U(e={}){let{overrides:o={}}=e;return [{files:[i],name:"2digits:javascript",plugins:{stylistic:ke},languageOptions:{ecmaVersion:2022,globals:{...T.browser,...T.es2021,...T.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:true},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:true},rules:{...xe.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:true,setWithoutGet:true}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:true}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:false,newIsCap:true,properties:true}],"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:true}],"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:false,allowSwitch:false}],"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:false}],"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:true}],"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:false}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:true,allowTaggedTemplates:true,allowTernary:true}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:true,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:true,ignoreConstructors:false}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:true,allowUnboundThis:true}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:true}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:true}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:true,enforceForSwitchCase:true}],"valid-typeof":["error",{requireStringLiterals:true}],"vars-on-top":"error",yoda:["error","never"],"stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:["const","let"],next:"*"},{blankLine:"any",prev:["const","let"],next:["const","let"]},{blankLine:"always",prev:"*",next:"return"}],...o}}]}async function A(){return [{files:[i],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 J(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[I],...x,rules:{...j(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[P],...x,rules:{...j(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[F],...x,rules:{...j(configs["flat/recommended-with-json5"])}},{name:"2digits:jsonc/package.json",...x,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",...x,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 x={languageOptions:{parser:ve},plugins:{jsonc:we}};function j(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}async function $(e={}){let{files:o=[w,v],overrides:a={},parserOptions:r}=e,[l,p]=await Promise.all([t(import('@next/eslint-plugin-next')),t(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...l.configs.recommended.rules,...l.configs["core-web-vitals"].rules},c);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(l)}},{name:"2digits:next/rules",files:o,languageOptions:{parser:p,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...a}}]}function X(){return [{files:[i],name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:V},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:true}],"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 Y(){let e=await t(import('eslint-plugin-pnpm'));return [{name:"2digits:pnpm/package-json",files:["**/package.json"],languageOptions:{parser:ve},plugins:{pnpm:e},rules:{"pnpm/json-enforce-catalog":"error","pnpm/json-prefer-workspace-settings":"error","pnpm/json-valid-catalog":"error"}},{name:"2digits:pnpm/pnpm-workspace-yaml",files:["pnpm-workspace.yaml"],languageOptions:{parser:Se},plugins:{pnpm:e},rules:{"pnpm/yaml-no-duplicate-catalog-item":"error","pnpm/yaml-no-unused-catalog-item":"error"}}]}async function K(){let[e,o]=await Promise.all([t(import('eslint-config-prettier')),t(import('@stylistic/eslint-plugin'))]);return [{name:"2digits:prettier",plugins:{stylistic:o},rules:{...e.rules,"tailwindcss/classnames-order":"off","stylistic/jsx-newline":["error",{prevent:false}]}}]}async function Q(e={}){let{files:o=[w,v],overrides:a={},parserOptions:r,tsconfigRootDir:l,reactCompiler:p=true}=e,[m,g,y,b]=await Promise.all([t(import('@eslint-react/eslint-plugin')),t(import('eslint-plugin-react-hooks')),t(import('@typescript-eslint/parser')),p?t(import('eslint-plugin-react-compiler')):void 0]),h=m.configs.all.plugins,le=renamePluginsInRules({...g.configs["recommended-latest"].rules,...m.configs["recommended-type-checked"].rules},c);return [{name:"2digits:react/setup",plugins:{stylistic:ke,"react-dom":h["@eslint-react/dom"],"react-web-api":h["@eslint-react/web-api"],"react-extra":h["@eslint-react"],"react-hooks":g,"react-hooks-extra":h["@eslint-react/hooks-extra"],"react-naming-convention":h["@eslint-react/naming-convention"],...p?{"react-compiler":b}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:o,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:true},tsconfigRootDir:l,projectService:true,...r},sourceType:"module"},rules:{...le,...p?{"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-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","stylistic/jsx-curly-newline":"off","stylistic/jsx-newline":["error",{prevent:false}],"stylistic/jsx-self-closing-comp":"error",...a}}]}function ee(){return [{files:[i],name:"2digits:regexp",plugins:{regexp:Z},rules:{...Z.configs["flat/recommended"].rules}}]}function re(){return [{files:[i],name:"2digits:sonar",plugins:{sonar:H},rules:{"sonar/code-eval":"error","sonar/cognitive-complexity":"error","sonar/comma-or-logical-or-case":"error","sonar/concise-regex":"error","sonar/confidential-information-logging":"error","sonar/constructor-for-side-effects":"error","sonar/content-length":"error","sonar/content-security-policy":"error","sonar/cookie-no-httponly":"error","sonar/cors":"error","sonar/csrf":"error","sonar/max-switch-cases":"error","sonar/no-all-duplicated-branches":"error","sonar/no-collapsible-if":"error","sonar/no-collection-size-mischeck":"error","sonar/no-duplicate-string":["error",{threshold:5}],"sonar/no-duplicated-branches":"error","sonar/no-element-overwrite":"error","sonar/no-empty-collection":"error","sonar/no-extra-arguments":"error","sonar/no-for-in-iterable":"error","sonar/no-gratuitous-expressions":"error","sonar/no-identical-conditions":"error","sonar/no-identical-expressions":"error","sonar/no-identical-functions":"error","sonar/no-ignored-return":"error","sonar/no-inverted-boolean-check":"error","sonar/no-nested-switch":"error","sonar/no-nested-template-literals":"error","sonar/no-one-iteration-loop":"error","sonar/no-redundant-boolean":"error","sonar/no-same-line-conditional":"error","sonar/no-small-switch":"error","sonar/no-unused-collection":"error","sonar/no-use-of-empty-return-value":"error","sonar/no-useless-catch":"error","sonar/non-existent-operator":"error","sonar/prefer-immediate-return":"error","sonar/prefer-object-literal":"error","sonar/prefer-single-boolean-return":"error","sonar/prefer-while":"error","sonar/elseif-without-else":"off","sonar/no-redundant-jump":"off"}}]}async function oe(e={}){let{files:o=[S],overrides:a={},parserOptions:r,storybookDirectory:l=".storybook"}=e,[p,m]=await Promise.all([t(import('eslint-plugin-storybook')),t(import('@typescript-eslint/parser'))]),g={parser:m,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(p)}},{name:"2digits:storybook/rules",files:o,languageOptions:g,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",...a}},{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:[`${l}/main.@(js|cjs|mjs|ts)`],languageOptions:g,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function te(e={}){let{overrides:o={}}=e,[a,{tailwindFunctions:r},l]=await Promise.all([t(import('eslint-plugin-tailwindcss')),t(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{files:[i],name:"2digits:tailwind",plugins:{tailwindcss:a},settings:{tailwindcss:{callees:r,config:l}},rules:{...a.configs.recommended.rules,...o}}]}async function ne(e={}){let{overrides:o={}}=e,a=await t(import('@tanstack/eslint-plugin-query')),r=renamePluginsInRules(a.configs["flat/recommended"].at(0)?.rules??{},c);return [{files:[i],name:"2digits:tanstack",plugins:{tanstack:a},rules:{...r,...o}}]}async function se(e={}){let{overrides:o={}}=e,a=await t(import('eslint-plugin-turbo'));return [{files:[i],name:"2digits:turbo",plugins:{turbo:a},rules:{"turbo/no-undeclared-env-vars":"error",...o}}]}async function ie(e={}){let{overrides:o={},parserOptions:a={}}=e,[{plugin:r,configs:l,parser:p},m]=await Promise.all([t(import('typescript-eslint')),t(import('@2digits/eslint-plugin'))]),g=renamePluginsInConfigs(l.strictTypeChecked,c),y=Object.fromEntries(g.flatMap(({rules:b})=>Object.entries(b??{})));return [{name:"2digits:typescript/setup",plugins:{ts:r,"@2digits":m}},{name:"2digits:typescript/rules",files:[i],languageOptions:{parser:p,parserOptions:{tsconfigRootDir:process.cwd(),projectService:true,warnOnUnsupportedTypeScriptVersion:false,...a},sourceType:"module"},rules:{...y,"ts/restrict-template-expressions":["error",{allowNumber:true}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:false,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:true,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.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 ae(){return [{files:[i],name:"2digits:unicorn",plugins:{unicorn:C},rules:{...C.configs.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:false,checkArrowFunctionBody:false}],"unicorn/prefer-top-level-await":["off"]}}]}function pe(){return [{name:"2digits:yaml/setup",plugins:{yml:Re}},{name:"2digits:yaml/base",...k,rules:{"no-irregular-whitespace":"off","no-unused-vars":"off","spaced-comment":"off"}},{name:"2digits:yaml/recommended",...k,rules:{"yml/no-empty-document":"error","yml/no-empty-key":"error","yml/no-empty-mapping-value":"error","yml/no-empty-sequence-entry":"error","yml/no-irregular-whitespace":"error","yml/no-tab-indent":"error","yml/vue-custom-block/no-parsing-error":"error"}},{name:"2digits:yaml/standard",...k,rules:{"yml/block-mapping":"error","yml/block-sequence":"error","yml/plain-scalar":"error","yml/spaced-comment":"error"}},{name:"2digits:yaml/pnpm-workspace",...k,files:["pnpm-workspace.yaml"],rules:{"yml/sort-keys":["error",{order:["packages","overrides","patchedDependencies","hoistPattern","catalog","catalogs","allowedDeprecatedVersions","allowNonAppliedPatches","configDependencies","ignoredBuiltDependencies","ignoredOptionalDependencies","neverBuiltDependencies","onlyBuiltDependencies","onlyBuiltDependenciesFile","packageExtensions","peerDependencyRules","supportedArchitectures"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:".*"}]}},{name:"2digits:yaml/prettier",...k,rules:{"yml/block-mapping-colon-indicator-newline":"off","yml/block-mapping-question-indicator-newline":"off","yml/block-sequence-hyphen-indicator-newline":"off","yml/flow-mapping-curly-newline":"off","yml/flow-mapping-curly-spacing":"off","yml/flow-sequence-bracket-newline":"off","yml/flow-sequence-bracket-spacing":"off","yml/indent":"off","yml/key-spacing":"off","yml/no-multiple-empty-lines":"off","yml/no-trailing-zeros":"off","yml/quotes":"off"}}]}var k={files:[_],languageOptions:{parser:Se}};function u(e,o){return typeof e=="boolean"?e:e?.enable??o??false}function f(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...a}=e;return a}async function Ge(e={},...o){let a;e.pnpm===void 0&&(a=findUp("pnpm-workspace.yaml"));let r=new FlatConfigComposer(M(e.ignores),U(e.js),q(),X(),B(),A(),ae(),re(),ee(),R(),J(),W(),pe());u(e.turbo,isPackageExists("turbo"))&&(r=r.append(se(f(e.turbo))));let{overrides:l,...p}=f(e.ts);return u(e.ts,isPackageExists("typescript"))&&(r=r.append(ie(f(e.ts)))),u(e.react,isPackageExists("react"))&&(r=r.append(Q({...f(e.react),...p}))),u(e.next,isPackageExists("next"))&&(r=r.append($({...f(e.next),...p}))),u(e.storybook,isPackageExists("storybook"))&&(r=r.append(oe({...f(e.storybook),...p}))),u(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(te(f(e.tailwind)))),u(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(ne(f(e.tanstack)))),u(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(N(f(e.drizzle)))),u(e.graphql,isPackageExists("graphql"))&&(r=r.append(E(f(e.graphql)))),u(e.pnpm,!!await a)&&(r=r.append(Y())),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(K())),r.renamePlugins(c).toConfigs()}export{R as antfu,q as boolean,B as comments,W as css,Ge as default,N as drizzle,E as graphql,M as ignores,U as javascript,A as jsdoc,J as jsonc,$ as next,X as node,Y as pnpm,K as prettier,Q as react,ee as regexp,re as sonar,oe as storybook,te as tailwind,ne as tanstack,se as turbo,Ge as twoDigits,ie as typescript,ae as unicorn,pe as yaml};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|