@2digits/eslint-config 2.14.10 → 2.15.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 +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.d.cts
CHANGED
|
@@ -124,6 +124,16 @@ interface RuleOptions {
|
|
|
124
124
|
* @deprecated
|
|
125
125
|
*/
|
|
126
126
|
'block-spacing'?: Linter.RuleEntry<BlockSpacing>
|
|
127
|
+
/**
|
|
128
|
+
* Transforms the negation of a conjunction !(A && B) into the equivalent !A || !B according to De Morgan’s law
|
|
129
|
+
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-conjunction.md
|
|
130
|
+
*/
|
|
131
|
+
'boolean/no-negated-conjunction'?: Linter.RuleEntry<[]>
|
|
132
|
+
/**
|
|
133
|
+
* Transforms the negation of a disjunction !(A || B) into the equivalent !A && !B according to De Morgan’s law
|
|
134
|
+
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
|
|
135
|
+
*/
|
|
136
|
+
'boolean/no-negated-disjunction'?: Linter.RuleEntry<[]>
|
|
127
137
|
/**
|
|
128
138
|
* Enforce consistent brace style for blocks
|
|
129
139
|
* @see https://eslint.org/docs/latest/rules/brace-style
|
|
@@ -4263,6 +4273,7 @@ Backward pagination arguments
|
|
|
4263
4273
|
/**
|
|
4264
4274
|
* Disabling Certificate Transparency monitoring is security-sensitive
|
|
4265
4275
|
* @see https://sonarsource.github.io/rspec/#/rspec/S5742/javascript
|
|
4276
|
+
* @deprecated
|
|
4266
4277
|
*/
|
|
4267
4278
|
'sonar/certificate-transparency'?: Linter.RuleEntry<SonarCertificateTransparency>
|
|
4268
4279
|
/**
|
|
@@ -10346,7 +10357,7 @@ type SonarClassName = []|[{
|
|
|
10346
10357
|
format?: string
|
|
10347
10358
|
}]
|
|
10348
10359
|
// ----- sonar/cognitive-complexity -----
|
|
10349
|
-
type SonarCognitiveComplexity = []|[number]|[number
|
|
10360
|
+
type SonarCognitiveComplexity = []|[(number | string)]|[(number | string), string]
|
|
10350
10361
|
// ----- sonar/comment-regex -----
|
|
10351
10362
|
type SonarCommentRegex = []|[{
|
|
10352
10363
|
regularExpression?: string
|
|
@@ -12136,7 +12147,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
12136
12147
|
onlyEquality?: boolean
|
|
12137
12148
|
}]
|
|
12138
12149
|
// Names of all the configs
|
|
12139
|
-
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'
|
|
12150
|
+
type ConfigNames = '2digits:antfu' | '2digits:boolean' | '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'
|
|
12140
12151
|
|
|
12141
12152
|
type Rules = RuleOptions;
|
|
12142
12153
|
interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
|
|
@@ -12199,6 +12210,8 @@ interface OptionsWithIgnores {
|
|
|
12199
12210
|
|
|
12200
12211
|
declare function antfu(): TypedFlatConfigItem[];
|
|
12201
12212
|
|
|
12213
|
+
declare function boolean(): TypedFlatConfigItem[];
|
|
12214
|
+
|
|
12202
12215
|
declare function comments(): TypedFlatConfigItem[];
|
|
12203
12216
|
|
|
12204
12217
|
declare function drizzle(options?: OptionsWithDrizzle): Promise<TypedFlatConfigItem[]>;
|
|
@@ -12255,4 +12268,4 @@ interface ESLint2DigitsOptions {
|
|
|
12255
12268
|
}
|
|
12256
12269
|
declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
|
|
12257
12270
|
|
|
12258
|
-
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 };
|
|
12271
|
+
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, boolean, 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.d.ts
CHANGED
|
@@ -124,6 +124,16 @@ interface RuleOptions {
|
|
|
124
124
|
* @deprecated
|
|
125
125
|
*/
|
|
126
126
|
'block-spacing'?: Linter.RuleEntry<BlockSpacing>
|
|
127
|
+
/**
|
|
128
|
+
* Transforms the negation of a conjunction !(A && B) into the equivalent !A || !B according to De Morgan’s law
|
|
129
|
+
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-conjunction.md
|
|
130
|
+
*/
|
|
131
|
+
'boolean/no-negated-conjunction'?: Linter.RuleEntry<[]>
|
|
132
|
+
/**
|
|
133
|
+
* Transforms the negation of a disjunction !(A || B) into the equivalent !A && !B according to De Morgan’s law
|
|
134
|
+
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
|
|
135
|
+
*/
|
|
136
|
+
'boolean/no-negated-disjunction'?: Linter.RuleEntry<[]>
|
|
127
137
|
/**
|
|
128
138
|
* Enforce consistent brace style for blocks
|
|
129
139
|
* @see https://eslint.org/docs/latest/rules/brace-style
|
|
@@ -4263,6 +4273,7 @@ Backward pagination arguments
|
|
|
4263
4273
|
/**
|
|
4264
4274
|
* Disabling Certificate Transparency monitoring is security-sensitive
|
|
4265
4275
|
* @see https://sonarsource.github.io/rspec/#/rspec/S5742/javascript
|
|
4276
|
+
* @deprecated
|
|
4266
4277
|
*/
|
|
4267
4278
|
'sonar/certificate-transparency'?: Linter.RuleEntry<SonarCertificateTransparency>
|
|
4268
4279
|
/**
|
|
@@ -10346,7 +10357,7 @@ type SonarClassName = []|[{
|
|
|
10346
10357
|
format?: string
|
|
10347
10358
|
}]
|
|
10348
10359
|
// ----- sonar/cognitive-complexity -----
|
|
10349
|
-
type SonarCognitiveComplexity = []|[number]|[number
|
|
10360
|
+
type SonarCognitiveComplexity = []|[(number | string)]|[(number | string), string]
|
|
10350
10361
|
// ----- sonar/comment-regex -----
|
|
10351
10362
|
type SonarCommentRegex = []|[{
|
|
10352
10363
|
regularExpression?: string
|
|
@@ -12136,7 +12147,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
12136
12147
|
onlyEquality?: boolean
|
|
12137
12148
|
}]
|
|
12138
12149
|
// Names of all the configs
|
|
12139
|
-
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'
|
|
12150
|
+
type ConfigNames = '2digits:antfu' | '2digits:boolean' | '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'
|
|
12140
12151
|
|
|
12141
12152
|
type Rules = RuleOptions;
|
|
12142
12153
|
interface TypedFlatConfigItem extends Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'languageOptions'> {
|
|
@@ -12199,6 +12210,8 @@ interface OptionsWithIgnores {
|
|
|
12199
12210
|
|
|
12200
12211
|
declare function antfu(): TypedFlatConfigItem[];
|
|
12201
12212
|
|
|
12213
|
+
declare function boolean(): TypedFlatConfigItem[];
|
|
12214
|
+
|
|
12202
12215
|
declare function comments(): TypedFlatConfigItem[];
|
|
12203
12216
|
|
|
12204
12217
|
declare function drizzle(options?: OptionsWithDrizzle): Promise<TypedFlatConfigItem[]>;
|
|
@@ -12255,4 +12268,4 @@ interface ESLint2DigitsOptions {
|
|
|
12255
12268
|
}
|
|
12256
12269
|
declare function twoDigits(options?: ESLint2DigitsOptions, ...userConfig: TypedFlatConfigItem[]): Promise<TypedFlatConfigItem[]>;
|
|
12257
12270
|
|
|
12258
|
-
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 };
|
|
12271
|
+
export { type ConfigNames, type OptionsOverrides, type OptionsTypeScriptWithTypes, type OptionsWithDrizzle, type OptionsWithFiles, type OptionsWithIgnores, type OptionsWithReact, type OptionsWithStorybook, type Rules, type TypedFlatConfigItem, antfu, boolean, 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 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 de,{configs}from'eslint-plugin-jsonc';import ue from'jsonc-eslint-parser';import T from'eslint-plugin-unicorn';import U from'eslint-plugin-n';import G from'eslint-plugin-sonarjs';import J from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function j(){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 C(){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 I(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(d=>d?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let d of Object.keys(l)){let y=d.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[d]=l[d]);}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 F="**/*.?([cm])[jt]s?(x)",x="**/*.?([cm])ts",k="**/*.?([cm])tsx",P="**/*.stories.tsx",D="**/*.json",z="**/*.json5",_="**/*.jsonc",R=["**/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 q(e={}){let{gitIgnore:o,ignores:r=[]}=e;return composer({ignores:[R,r].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(i=>i({strict:!1,...o,name:"2digits:gitignore"})))}function W(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 L(){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 N(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[D],...O,rules:{...v(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[_],...O,rules:{...v(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[z],...O,rules:{...v(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:ue},plugins:{jsonc:de}};function v(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}async function E(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 M(){return [{name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:U},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,d,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({...d.configs.recommended.rules,...d.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:d,"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-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","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}}]}function V(){return [{name:"2digits:sonar",plugins:{sonar:G},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 H(e={}){let{files:o=[P],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),d=Object.fromEntries(f.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c}},{name:"2digits:typescript/rules",files:[F],languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"},rules:{...d,"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: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,o){return typeof e=="boolean"?e:e?.enable??o??!1}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...r}=e;return r}function ve(e={},...o){let r=new FlatConfigComposer(q(e.ignores),W(e.js),M(),C(),L(),Z(),V(),$(),j(),N());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(Q(u(e.turbo))));let{overrides:i,...a}=u(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(Y(u(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append(A({...u(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(E({...u(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(H({...u(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(X(u(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(K(u(e.tanstack)))),g(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(S(u(e.drizzle)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(I(u(e.graphql)))),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(B())),r.renamePlugins(p).toConfigs()}export{j as antfu,C as comments,ve as default,S as drizzle,I as graphql,q as ignores,W as javascript,L as jsdoc,N as jsonc,E as next,M 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,ve as twoDigits,Y as typescript,Z as unicorn};//# sourceMappingURL=index.js.map
|
|
1
|
+
import ne from'eslint-plugin-antfu';import C from'eslint-plugin-de-morgan';import se from'@eslint-community/eslint-plugin-eslint-comments';import ie 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 ue from'@eslint/js';import w from'globals';import fe,{configs}from'eslint-plugin-jsonc';import ge from'jsonc-eslint-parser';import T from'eslint-plugin-unicorn';import G from'eslint-plugin-n';import B from'eslint-plugin-sonarjs';import V from'eslint-plugin-regexp';import {findUp}from'find-up';import {isPackageExists}from'local-pkg';function j(){return [{name:"2digits:antfu",plugins:{antfu:ne},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}function I(){return [{name:"2digits:boolean",plugins:{boolean:C},rules:{...C.configs.recommended.rules}}]}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","de-morgan":"boolean"};var pe=renamePluginsInRules(ie.recommended.rules,p);function S(){return [{name:"2digits:comments",plugins:{comments:se},rules:{...pe,"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 F(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 P(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(d=>d?.getDefault().schema)]),l=i.configs["flat/operations-recommended"].rules,c={};if(a)c=l;else for(let d of Object.keys(l)){let y=d.replace("@graphql-eslint/","");y in i.rules&&(i.rules[y].meta.docs?.requiresSchema||i.rules[y].meta.docs?.requiresSiblings)||(c[d]=l[d]);}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 D="**/*.?([cm])[jt]s?(x)",O="**/*.?([cm])ts",k="**/*.?([cm])tsx",z="**/*.stories.tsx",_="**/*.json",R="**/*.json5",q="**/*.jsonc",W=["**/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 L(e={}){let{gitIgnore:o,ignores:r=[]}=e;return composer({ignores:[W,r].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(i=>i({strict:!1,...o,name:"2digits:gitignore"})))}function N(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:{...ue.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 E(){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 U(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[_],...x,rules:{...v(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[q],...x,rules:{...v(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[R],...x,rules:{...v(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:ge},plugins:{jsonc:fe}};function v(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}async function M(e={}){let{files:o=[O,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 A(){return [{name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:G},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 J(){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 $(e={}){let{files:o=[O,k],overrides:r={},parserOptions:i,tsconfigRootDir:a,reactCompiler:l=!0}=e,[c,f,d,y,oe]=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,te=renamePluginsInRules({...d.configs.recommended.rules,...d.configs["jsx-runtime"].rules,...f.configs.recommended.rules,...c.configs["recommended-type-checked"].rules},p);return [{name:"2digits:react/setup",plugins:{react:d,"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":oe}:{}},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:{...te,...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-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","react/jsx-curly-newline":"off","react/jsx-newline":["error",{prevent:!1}],"react/prop-types":"off",...r}}]}function H(){return [{name:"2digits:regexp",plugins:{regexp:V},rules:{...V.configs["flat/recommended"].rules}}]}function X(){return [{name:"2digits:sonar",plugins:{sonar:B},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 K(e={}){let{files:o=[z],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 Q(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 Y(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 Z(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 ee(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),d=Object.fromEntries(f.flatMap(({rules:y})=>Object.entries(y??{})));return [{name:"2digits:typescript/setup",plugins:{ts:i,"@2digits":c}},{name:"2digits:typescript/rules",files:[D],languageOptions:{parser:l,parserOptions:{tsconfigRootDir:process.cwd(),projectService:!0,warnOnUnsupportedTypeScriptVersion:!1,...r},sourceType:"module"},rules:{...d,"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 re(){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,o){return typeof e=="boolean"?e:e?.enable??o??!1}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...r}=e;return r}function je(e={},...o){let r=new FlatConfigComposer(L(e.ignores),N(e.js),I(),A(),S(),E(),re(),X(),H(),j(),U());g(e.turbo,isPackageExists("turbo"))&&(r=r.append(Z(u(e.turbo))));let{overrides:i,...a}=u(e.ts);return g(e.ts,isPackageExists("typescript"))&&(r=r.append(ee(u(e.ts)))),g(e.react,isPackageExists("react"))&&(r=r.append($({...u(e.react),...a}))),g(e.next,isPackageExists("next"))&&(r=r.append(M({...u(e.next),...a}))),g(e.storybook,isPackageExists("storybook"))&&(r=r.append(K({...u(e.storybook),...a}))),g(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(Q(u(e.tailwind)))),g(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(Y(u(e.tanstack)))),g(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(F(u(e.drizzle)))),g(e.graphql,isPackageExists("graphql"))&&(r=r.append(P(u(e.graphql)))),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(J())),r.renamePlugins(p).toConfigs()}export{j as antfu,I as boolean,S as comments,je as default,F as drizzle,P as graphql,L as ignores,N as javascript,E as jsdoc,U as jsonc,M as next,A as node,J as prettier,$ as react,H as regexp,X as sonar,K as storybook,Q as tailwind,Y as tanstack,Z as turbo,je as twoDigits,ee as typescript,re as unicorn};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|