js-style-kit 0.1.2 → 0.1.3
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/chunk-3JDYGS77.js +23 -0
- package/dist/chunk-3JDYGS77.js.map +1 -0
- package/dist/{chunk-3QISP36C.js → chunk-IZXVPZVW.js} +2 -2
- package/dist/{chunk-AHLHRIAC.js → chunk-LITSWCYQ.js} +2 -4
- package/dist/chunk-LITSWCYQ.js.map +1 -0
- package/dist/{chunk-EBXXF3BN.js → chunk-VF7D6J7C.js} +3 -3
- package/dist/chunk-VF7D6J7C.js.map +1 -0
- package/dist/{chunk-F6JAHALQ.js → chunk-VWKQSLJR.js} +14 -11
- package/dist/chunk-VWKQSLJR.js.map +1 -0
- package/dist/{chunk-6WWZTVUE.js → chunk-ZOCL6XIB.js} +8 -3
- package/dist/chunk-ZOCL6XIB.js.map +1 -0
- package/dist/eslint/{javascript → base}/config.js +2 -2
- package/dist/eslint/{javascript → base}/rules.d.ts +2 -9
- package/dist/eslint/{javascript → base}/rules.js +1 -1
- package/dist/eslint/base/types.d.ts +21 -0
- package/dist/eslint/base/types.js +1 -0
- package/dist/eslint/base/types.js.map +1 -0
- package/dist/eslint/ignores.d.ts +7 -2
- package/dist/eslint/ignores.js +1 -1
- package/dist/eslint/index.d.ts +16 -16
- package/dist/eslint/index.js +6 -6
- package/dist/eslint/index.test.js +12 -7
- package/dist/eslint/index.test.js.map +1 -1
- package/dist/eslint/typescript/config.js +2 -2
- package/dist/eslint/typescript/rules.d.ts +5 -2
- package/dist/eslint/typescript/rules.js +1 -1
- package/dist/eslint/typescript/types.d.ts +7 -0
- package/dist/eslint/typescript/types.js +1 -0
- package/dist/eslint/typescript/types.js.map +1 -0
- package/dist/index.js +6 -6
- package/dist/prettier/index.test.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-6WWZTVUE.js.map +0 -1
- package/dist/chunk-AHLHRIAC.js.map +0 -1
- package/dist/chunk-EBXXF3BN.js.map +0 -1
- package/dist/chunk-F6JAHALQ.js.map +0 -1
- package/dist/chunk-M4HZ67BH.js +0 -14
- package/dist/chunk-M4HZ67BH.js.map +0 -1
- /package/dist/{chunk-3QISP36C.js.map → chunk-IZXVPZVW.js.map} +0 -0
- /package/dist/eslint/{javascript → base}/config.d.ts +0 -0
- /package/dist/eslint/{javascript → base}/config.js.map +0 -0
- /package/dist/eslint/{javascript → base}/rules.js.map +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configNames
|
|
3
|
+
} from "./chunk-XXWXCIGZ.js";
|
|
4
|
+
|
|
5
|
+
// src/eslint/ignores.ts
|
|
6
|
+
var ignoresConfig = ({
|
|
7
|
+
next = false,
|
|
8
|
+
userIgnores = []
|
|
9
|
+
} = {}) => ({
|
|
10
|
+
ignores: [
|
|
11
|
+
"**/node_modules/",
|
|
12
|
+
"**/dist/",
|
|
13
|
+
".git/",
|
|
14
|
+
...next ? [".next"] : [],
|
|
15
|
+
...userIgnores
|
|
16
|
+
],
|
|
17
|
+
name: configNames.ignores
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
ignoresConfig
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-3JDYGS77.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eslint/ignores.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { configNames } from \"./constants.js\";\n\n/**\n * Creates an ESLint configuration for file and directory ignores.\n * By default, ignores node_modules, dist directories, and .git directories.\n *\n * @param options - Object with options to control the ignores configuration\n * @param options.userIgnores - Additional glob patterns to ignore in ESLint checks\n * @param options.next - Whether to include .next directory in ignores\n * @returns ESLint configuration object with ignore patterns\n */\nexport const ignoresConfig = ({\n next = false,\n userIgnores = [],\n}: {\n next?: boolean;\n userIgnores?: string[];\n} = {}): Linter.Config => ({\n ignores: [\n \"**/node_modules/\",\n \"**/dist/\",\n \".git/\",\n ...(next ? [\".next\"] : []),\n ...userIgnores,\n ],\n name: configNames.ignores,\n});\n"],"mappings":";;;;;AAaO,IAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAO;AAAA,EACP,cAAc,CAAC;AACjB,IAGI,CAAC,OAAsB;AAAA,EACzB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,OAAO,CAAC,OAAO,IAAI,CAAC;AAAA,IACxB,GAAG;AAAA,EACL;AAAA,EACA,MAAM,YAAY;AACpB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tseslintRules
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LITSWCYQ.js";
|
|
4
4
|
import {
|
|
5
5
|
configNames
|
|
6
6
|
} from "./chunk-XXWXCIGZ.js";
|
|
@@ -35,4 +35,4 @@ var tseslintConfig = (tsconfigPath) => {
|
|
|
35
35
|
export {
|
|
36
36
|
tseslintConfig
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-IZXVPZVW.js.map
|
|
@@ -126,12 +126,10 @@ var tseslintRules = {
|
|
|
126
126
|
"@typescript-eslint/triple-slash-reference": "warn",
|
|
127
127
|
"@typescript-eslint/unbound-method": "warn",
|
|
128
128
|
"@typescript-eslint/unified-signatures": "warn",
|
|
129
|
-
"@typescript-eslint/use-unknown-in-catch-callback-variable": "warn"
|
|
130
|
-
"dot-notation": "off",
|
|
131
|
-
"no-empty-function": "off"
|
|
129
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "warn"
|
|
132
130
|
};
|
|
133
131
|
|
|
134
132
|
export {
|
|
135
133
|
tseslintRules
|
|
136
134
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-LITSWCYQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eslint/typescript/rules.ts"],"sourcesContent":["import type { TypescriptRules } from \"./types.js\";\n\nexport const tseslintRules: TypescriptRules = {\n \"@typescript-eslint/adjacent-overload-signatures\": \"warn\",\n \"@typescript-eslint/array-type\": \"warn\",\n \"@typescript-eslint/await-thenable\": \"warn\",\n \"@typescript-eslint/ban-ts-comment\": [\n \"warn\",\n { minimumDescriptionLength: 10 },\n ],\n \"@typescript-eslint/ban-tslint-comment\": \"warn\",\n \"@typescript-eslint/class-literal-property-style\": \"warn\",\n \"@typescript-eslint/consistent-generic-constructors\": \"warn\",\n \"@typescript-eslint/consistent-indexed-object-style\": \"warn\",\n \"@typescript-eslint/consistent-type-assertions\": \"warn\",\n \"@typescript-eslint/consistent-type-definitions\": \"warn\",\n \"@typescript-eslint/consistent-type-exports\": [\n \"warn\",\n { fixMixedExportsWithInlineTypeSpecifier: true },\n ],\n \"@typescript-eslint/consistent-type-imports\": [\n \"warn\",\n {\n fixStyle: \"inline-type-imports\",\n prefer: \"type-imports\",\n },\n ],\n \"@typescript-eslint/dot-notation\": \"warn\",\n \"@typescript-eslint/no-array-constructor\": \"warn\",\n \"@typescript-eslint/no-array-delete\": \"warn\",\n \"@typescript-eslint/no-base-to-string\": \"warn\",\n \"@typescript-eslint/no-confusing-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-confusing-void-expression\": \"warn\",\n \"@typescript-eslint/no-deprecated\": \"warn\",\n \"@typescript-eslint/no-duplicate-enum-values\": \"warn\",\n \"@typescript-eslint/no-duplicate-type-constituents\": \"warn\",\n \"@typescript-eslint/no-dynamic-delete\": \"warn\",\n \"@typescript-eslint/no-empty-function\": \"warn\",\n \"@typescript-eslint/no-empty-object-type\": \"warn\",\n \"@typescript-eslint/no-explicit-any\": \"warn\",\n \"@typescript-eslint/no-extra-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-extraneous-class\": \"warn\",\n \"@typescript-eslint/no-floating-promises\": \"warn\",\n \"@typescript-eslint/no-for-in-array\": \"warn\",\n \"@typescript-eslint/no-implied-eval\": \"warn\",\n \"@typescript-eslint/no-import-type-side-effects\": \"warn\",\n \"@typescript-eslint/no-inferrable-types\": \"warn\",\n \"@typescript-eslint/no-invalid-void-type\": \"warn\",\n \"@typescript-eslint/no-meaningless-void-operator\": \"warn\",\n \"@typescript-eslint/no-misused-new\": \"warn\",\n \"@typescript-eslint/no-misused-promises\": \"warn\",\n \"@typescript-eslint/no-mixed-enums\": \"warn\",\n \"@typescript-eslint/no-namespace\": \"warn\",\n \"@typescript-eslint/no-non-null-asserted-nullish-coalescing\": \"warn\",\n \"@typescript-eslint/no-non-null-asserted-optional-chain\": \"warn\",\n \"@typescript-eslint/no-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-redundant-type-constituents\": \"warn\",\n \"@typescript-eslint/no-require-imports\": \"warn\",\n \"@typescript-eslint/no-this-alias\": \"warn\",\n \"@typescript-eslint/no-unnecessary-boolean-literal-compare\": \"warn\",\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n \"@typescript-eslint/no-unnecessary-template-expression\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-arguments\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-assertion\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-constraint\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-parameters\": \"warn\",\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"warn\",\n \"@typescript-eslint/no-unsafe-enum-comparison\": \"warn\",\n \"@typescript-eslint/no-unsafe-function-type\": \"warn\",\n \"@typescript-eslint/no-unsafe-unary-minus\": \"warn\",\n \"@typescript-eslint/no-unused-expressions\": \"warn\",\n \"@typescript-eslint/no-unused-vars\": [\n \"warn\",\n {\n args: \"after-used\",\n argsIgnorePattern: \"^_\",\n ignoreRestSiblings: false,\n vars: \"all\",\n varsIgnorePattern: \"^_\",\n },\n ],\n \"@typescript-eslint/no-useless-constructor\": \"warn\",\n \"@typescript-eslint/no-wrapper-object-types\": \"warn\",\n \"@typescript-eslint/non-nullable-type-assertion-style\": \"warn\",\n \"@typescript-eslint/only-throw-error\": \"warn\",\n \"@typescript-eslint/prefer-as-const\": \"warn\",\n \"@typescript-eslint/prefer-find\": \"warn\",\n \"@typescript-eslint/prefer-for-of\": \"warn\",\n \"@typescript-eslint/prefer-function-type\": \"warn\",\n \"@typescript-eslint/prefer-includes\": \"warn\",\n \"@typescript-eslint/prefer-literal-enum-member\": \"warn\",\n \"@typescript-eslint/prefer-namespace-keyword\": \"warn\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"warn\",\n \"@typescript-eslint/prefer-optional-chain\": \"warn\",\n \"@typescript-eslint/prefer-promise-reject-errors\": \"warn\",\n \"@typescript-eslint/prefer-reduce-type-parameter\": \"warn\",\n \"@typescript-eslint/prefer-regexp-exec\": \"warn\",\n \"@typescript-eslint/prefer-return-this-type\": \"warn\",\n \"@typescript-eslint/prefer-string-starts-ends-with\": \"warn\",\n \"@typescript-eslint/related-getter-setter-pairs\": \"warn\",\n \"@typescript-eslint/require-await\": \"warn\",\n \"@typescript-eslint/restrict-plus-operands\": [\n \"warn\",\n {\n allowAny: false,\n allowBoolean: false,\n allowNullish: false,\n allowNumberAndString: false,\n allowRegExp: false,\n },\n ],\n \"@typescript-eslint/restrict-template-expressions\": [\n \"warn\",\n {\n allow: [{ from: \"lib\", name: [\"Error\", \"URL\", \"URLSearchParams\"] }],\n allowAny: true,\n allowBoolean: true,\n allowNullish: true,\n allowNumber: true,\n allowRegExp: true,\n },\n ],\n \"@typescript-eslint/return-await\": [\n \"warn\",\n \"error-handling-correctness-only\",\n ],\n \"@typescript-eslint/triple-slash-reference\": \"warn\",\n \"@typescript-eslint/unbound-method\": \"warn\",\n \"@typescript-eslint/unified-signatures\": \"warn\",\n \"@typescript-eslint/use-unknown-in-catch-callback-variable\": \"warn\",\n};\n"],"mappings":";AAEO,IAAM,gBAAiC;AAAA,EAC5C,mDAAmD;AAAA,EACnD,iCAAiC;AAAA,EACjC,qCAAqC;AAAA,EACrC,q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|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZOCL6XIB.js";
|
|
4
4
|
import {
|
|
5
5
|
configNames
|
|
6
6
|
} from "./chunk-XXWXCIGZ.js";
|
|
7
7
|
|
|
8
|
-
// src/eslint/
|
|
8
|
+
// src/eslint/base/config.ts
|
|
9
9
|
var baseEslintConfig = (functionStyle) => ({
|
|
10
10
|
languageOptions: {
|
|
11
11
|
ecmaVersion: 2022
|
|
@@ -18,4 +18,4 @@ var baseEslintConfig = (functionStyle) => ({
|
|
|
18
18
|
export {
|
|
19
19
|
baseEslintConfig
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-VF7D6J7C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eslint/base/config.ts"],"sourcesContent":["import type { EslintConfigObject, FunctionStyle } from \"../types.js\";\n\nimport { configNames } from \"../constants.js\";\nimport { baseEslintRules } from \"./rules.js\";\n\n/**\n * Creates a base ESLint configuration object with specified function style rules.\n *\n * @param functionStyle - Controls how functions should be written. Can be:\n * - \"off\": Disables function style enforcement\n * - \"arrow\": Enforces arrow function expressions\n * - \"declaration\": Enforces function declarations\n * - \"expression\": Enforces function expressions\n * @returns ESLint configuration object\n */\nexport const baseEslintConfig = (\n functionStyle: \"off\" | FunctionStyle,\n): EslintConfigObject => ({\n languageOptions: {\n ecmaVersion: 2022,\n },\n linterOptions: { reportUnusedDisableDirectives: true },\n name: configNames.base,\n rules: baseEslintRules(functionStyle),\n});\n"],"mappings":";;;;;;;;AAeO,IAAM,mBAAmB,CAC9B,mBACwB;AAAA,EACxB,iBAAiB;AAAA,IACf,aAAa;AAAA,EACf;AAAA,EACA,eAAe,EAAE,+BAA+B,KAAK;AAAA,EACrD,MAAM,YAAY;AAAA,EAClB,OAAO,gBAAgB,aAAa;AACtC;","names":[]}
|
|
@@ -9,33 +9,35 @@ import {
|
|
|
9
9
|
} from "./chunk-GBJI557O.js";
|
|
10
10
|
import {
|
|
11
11
|
tseslintConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IZXVPZVW.js";
|
|
13
|
+
import {
|
|
14
|
+
baseEslintConfig
|
|
15
|
+
} from "./chunk-VF7D6J7C.js";
|
|
13
16
|
import {
|
|
14
17
|
jsdocConfig
|
|
15
18
|
} from "./chunk-LGB33CUY.js";
|
|
16
19
|
import {
|
|
17
20
|
perfectionistConfig
|
|
18
21
|
} from "./chunk-HLX2OWWB.js";
|
|
19
|
-
import {
|
|
20
|
-
baseEslintConfig
|
|
21
|
-
} from "./chunk-EBXXF3BN.js";
|
|
22
22
|
import {
|
|
23
23
|
ignoresConfig
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3JDYGS77.js";
|
|
25
25
|
|
|
26
26
|
// src/eslint/index.ts
|
|
27
|
-
import { isString } from "is-type-of";
|
|
27
|
+
import { isObject, isString } from "is-type-of";
|
|
28
28
|
var eslintConfig = ({
|
|
29
29
|
functionStyle = "arrow",
|
|
30
30
|
ignores = [],
|
|
31
31
|
jsdoc = { requireJsdoc: false },
|
|
32
32
|
react = false,
|
|
33
33
|
sorting = true,
|
|
34
|
-
typescript = true
|
|
35
|
-
...options
|
|
34
|
+
typescript = true
|
|
36
35
|
} = {}, ...additionalConfigs) => {
|
|
37
36
|
const configs = [
|
|
38
|
-
ignoresConfig(
|
|
37
|
+
ignoresConfig({
|
|
38
|
+
next: isObject(react) && react.next,
|
|
39
|
+
userIgnores: ignores
|
|
40
|
+
}),
|
|
39
41
|
baseEslintConfig(functionStyle)
|
|
40
42
|
];
|
|
41
43
|
if (jsdoc !== false) {
|
|
@@ -50,7 +52,8 @@ var eslintConfig = ({
|
|
|
50
52
|
}
|
|
51
53
|
if (react) {
|
|
52
54
|
configs.push(reactEslintConfig(functionStyle, Boolean(typescript)));
|
|
53
|
-
|
|
55
|
+
const shouldUseReactCompiler = react === true || isObject(react) && react.reactCompiler !== false;
|
|
56
|
+
if (shouldUseReactCompiler) {
|
|
54
57
|
configs.push(reactCompilerEslintConfig);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
@@ -69,4 +72,4 @@ var eslintConfig = ({
|
|
|
69
72
|
export {
|
|
70
73
|
eslintConfig
|
|
71
74
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-VWKQSLJR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eslint/index.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { isObject, isString } from \"is-type-of\";\n\nimport type { FunctionStyle } from \"./types.js\";\n\nimport { baseEslintConfig } from \"./base/config.js\";\nimport { ignoresConfig } from \"./ignores.js\";\nimport { jsdocConfig } from \"./jsdoc/config.js\";\nimport { perfectionistConfig } from \"./perfectionist/config.js\";\nimport { preferArrowFunctionConfig } from \"./prefer-arrow-function/config.js\";\nimport { reactCompilerEslintConfig } from \"./react-compiler/config.js\";\nimport { reactEslintConfig } from \"./react/config.js\";\nimport { tseslintConfig } from \"./typescript/config.js\";\n\nexport interface EslintConfigOptions {\n functionStyle?: \"off\" | FunctionStyle;\n ignores?: string[];\n jsdoc?:\n | false\n | {\n requireJsdoc?: boolean;\n };\n react?:\n | boolean\n | {\n next?: boolean | undefined;\n reactCompiler?: boolean | undefined;\n };\n sorting?: boolean;\n typescript?: boolean | string;\n}\n\n/**\n * Configures ESLint based on provided options.\n *\n * @param options - The optional configuration object.\n * @param options.functionStyle - The function style to enforce. Defaults to \"arrow\".\n * @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `dist`.\n * @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.\n * @param options.react - Whether to include React rules. When true, reactCompiler is enabled by default.\n * Can be configured with an object to control next.js support and reactCompiler.\n * @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.\n * @param options.typescript - Whether to include TypeScript rules. Can be a boolean or a string with path to tsconfig.\n * @param additionalConfigs - Additional ESLint config objects to be merged into the final configuration.\n * @returns An array of ESLint configuration objects.\n */\nexport const eslintConfig = (\n {\n functionStyle = \"arrow\",\n ignores = [],\n jsdoc = { requireJsdoc: false },\n react = false,\n sorting = true,\n typescript = true,\n }: EslintConfigOptions = {},\n ...additionalConfigs: Linter.Config[]\n): Linter.Config[] => {\n const configs: Linter.Config[] = [\n ignoresConfig({\n next: isObject(react) && react.next,\n userIgnores: ignores,\n }),\n baseEslintConfig(functionStyle),\n ];\n\n if (jsdoc !== false) {\n configs.push(jsdocConfig(jsdoc.requireJsdoc ?? false));\n }\n\n if (typescript) {\n configs.push(\n ...(tseslintConfig(\n isString(typescript) ? typescript : undefined,\n ) as Linter.Config[]),\n );\n }\n\n if (react) {\n configs.push(reactEslintConfig(functionStyle, Boolean(typescript)));\n\n // Apply reactCompiler by default if react is true or if react.reactCompiler isn't explicitly false\n const shouldUseReactCompiler =\n react === true || (isObject(react) && react.reactCompiler !== false);\n\n if (shouldUseReactCompiler) {\n configs.push(reactCompilerEslintConfig);\n }\n }\n\n if (sorting) {\n configs.push(perfectionistConfig);\n }\n\n if (functionStyle === \"arrow\") {\n configs.push(preferArrowFunctionConfig());\n }\n\n // Add any additional config objects provided by the user\n if (additionalConfigs.length > 0) {\n configs.push(...additionalConfigs);\n }\n\n return configs;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,UAAU,gBAAgB;AA6C5B,IAAM,eAAe,CAC1B;AAAA,EACE,gBAAgB;AAAA,EAChB,UAAU,CAAC;AAAA,EACX,QAAQ,EAAE,cAAc,MAAM;AAAA,EAC9B,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AACf,IAAyB,CAAC,MACvB,sBACiB;AACpB,QAAM,UAA2B;AAAA,IAC/B,cAAc;AAAA,MACZ,MAAM,SAAS,KAAK,KAAK,MAAM;AAAA,MAC/B,aAAa;AAAA,IACf,CAAC;AAAA,IACD,iBAAiB,aAAa;AAAA,EAChC;AAEA,MAAI,UAAU,OAAO;AACnB,YAAQ,KAAK,YAAY,MAAM,gBAAgB,KAAK,CAAC;AAAA,EACvD;AAEA,MAAI,YAAY;AACd,YAAQ;AAAA,MACN,GAAI;AAAA,QACF,SAAS,UAAU,IAAI,aAAa;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO;AACT,YAAQ,KAAK,kBAAkB,eAAe,QAAQ,UAAU,CAAC,CAAC;AAGlE,UAAM,yBACJ,UAAU,QAAS,SAAS,KAAK,KAAK,MAAM,kBAAkB;AAEhE,QAAI,wBAAwB;AAC1B,cAAQ,KAAK,yBAAyB;AAAA,IACxC;AAAA,EACF;AAEA,MAAI,SAAS;AACX,YAAQ,KAAK,mBAAmB;AAAA,EAClC;AAEA,MAAI,kBAAkB,SAAS;AAC7B,YAAQ,KAAK,0BAA0B,CAAC;AAAA,EAC1C;AAGA,MAAI,kBAAkB,SAAS,GAAG;AAChC,YAAQ,KAAK,GAAG,iBAAiB;AAAA,EACnC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/eslint/
|
|
1
|
+
// src/eslint/base/rules.ts
|
|
2
2
|
var baseEslintRules = (functionStyle) => ({
|
|
3
3
|
/**
|
|
4
4
|
* Require return statements in array methods callbacks.
|
|
@@ -22,7 +22,12 @@ var baseEslintRules = (functionStyle) => ({
|
|
|
22
22
|
*/
|
|
23
23
|
camelcase: [
|
|
24
24
|
"warn",
|
|
25
|
-
{
|
|
25
|
+
{
|
|
26
|
+
allow: ["^UNSAFE_"],
|
|
27
|
+
ignoreDestructuring: false,
|
|
28
|
+
ignoreImports: true,
|
|
29
|
+
properties: "never"
|
|
30
|
+
}
|
|
26
31
|
],
|
|
27
32
|
/**
|
|
28
33
|
* Require curly braces for multiline blocks.
|
|
@@ -424,4 +429,4 @@ var baseEslintRules = (functionStyle) => ({
|
|
|
424
429
|
export {
|
|
425
430
|
baseEslintRules
|
|
426
431
|
};
|
|
427
|
-
//# sourceMappingURL=chunk-
|
|
432
|
+
//# sourceMappingURL=chunk-ZOCL6XIB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eslint/base/rules.ts"],"sourcesContent":["import type { FunctionStyle } from \"../types.js\";\nimport type { BaseRules } from \"./types.js\";\n\n/**\n * Generates the base set of ESLint rules with configurable function style enforcement.\n *\n * @param functionStyle - Controls how functions should be written. Can be:\n * - \"off\": Disables function style enforcement\n * - \"arrow\": Enforces arrow function expressions\n * - \"declaration\": Enforces function declarations\n * - \"expression\": Enforces function expressions\n * @returns An object containing ESLint rule configurations\n */\nexport const baseEslintRules = (\n functionStyle: \"off\" | FunctionStyle,\n): BaseRules => ({\n /**\n * Require return statements in array methods callbacks.\n *\n * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return\n */\n \"array-callback-return\": [\n \"warn\",\n { allowImplicit: true, checkForEach: true },\n ],\n /**\n * Treat `var` statements as if they were block scoped.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var\n */\n \"block-scoped-var\": \"warn\",\n /**\n * Require camel case names.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/camelcase\n */\n camelcase: [\n \"warn\",\n {\n allow: [\"^UNSAFE_\"],\n ignoreDestructuring: false,\n ignoreImports: true,\n properties: \"never\",\n },\n ],\n /**\n * Require curly braces for multiline blocks.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/curly\n */\n curly: [\"warn\", \"multi-line\"],\n /**\n * Require default clauses in switch statements to be last (if used).\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last\n */\n \"default-case-last\": \"warn\",\n /**\n * Require triple equals (`===` and `!==`).\n *å\n * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq\n */\n eqeqeq: \"warn\",\n \"for-direction\": \"warn\",\n /**\n * Require function expressions to have a name.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/func-names\n */\n \"func-names\": [\"warn\", \"as-needed\"],\n \"func-style\":\n // if arrow function, we use the prefer-arrow-functions plugin\n functionStyle === \"off\" || functionStyle === \"arrow\" ?\n \"off\"\n : [\"warn\", functionStyle, { allowArrowFunctions: true }],\n /**\n * Require grouped accessor pairs in object literals and classes.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs\n */\n \"grouped-accessor-pairs\": \"warn\",\n /**\n * Require a capital letter for constructors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/new-cap\n */\n \"new-cap\": [\"warn\", { capIsNew: false }],\n /**\n * Disallow use of `alert()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert\n */\n \"no-alert\": \"warn\",\n \"no-async-promise-executor\": \"warn\",\n /**\n * Disallow use of bitwise operators.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise\n */\n \"no-bitwise\": \"warn\",\n /**\n * Disallow use of `caller`/`callee`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller\n */\n \"no-caller\": \"warn\",\n \"no-case-declarations\": \"warn\",\n \"no-compare-neg-zero\": \"warn\",\n \"no-cond-assign\": \"warn\",\n /**\n * Disallow the use of console.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-console\n */\n \"no-console\": [\"warn\", { allow: [\"info\", \"warn\", \"error\"] }],\n /**\n * Disallow expressions where the operation doesn't affect the value.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-console\n */\n \"no-constant-binary-expression\": \"warn\",\n \"no-constant-condition\": \"warn\",\n /**\n * Disallow returning value in constructor.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return\n */\n \"no-constructor-return\": \"warn\",\n \"no-control-regex\": \"warn\",\n \"no-debugger\": \"warn\",\n \"no-delete-var\": \"warn\",\n \"no-dupe-else-if\": \"warn\",\n \"no-duplicate-case\": \"warn\",\n /**\n * Disallow using an `else` if the `if` block contains a return.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return\n */\n \"no-else-return\": \"warn\",\n \"no-empty\": \"warn\",\n \"no-empty-character-class\": \"warn\",\n \"no-empty-pattern\": \"warn\",\n \"no-empty-static-block\": \"warn\",\n /**\n * Disallow `eval()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval\n */\n \"no-eval\": \"warn\",\n \"no-ex-assign\": \"warn\",\n /**\n * Disallow extending native objects.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native\n */\n \"no-extend-native\": \"warn\",\n /**\n * Disallow unnecessary function binding.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind\n */\n \"no-extra-bind\": \"warn\",\n \"no-extra-boolean-cast\": \"warn\",\n /**\n * Disallow unnecessary labels.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label\n */\n \"no-extra-label\": \"warn\",\n \"no-fallthrough\": \"warn\",\n \"no-global-assign\": \"warn\",\n /**\n * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.\n *\n * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion\n */\n \"no-implicit-coercion\": \"warn\",\n \"no-invalid-regexp\": \"warn\",\n \"no-irregular-whitespace\": \"warn\",\n /**\n * Disallow usage of `__iterator__` property.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator\n */\n \"no-iterator\": \"warn\",\n /**\n * Disallow labels that share a name with a variable.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-label-var\n */\n \"no-label-var\": \"warn\",\n /**\n * Disallow use of labels for anything other than loops and switches.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels\n */\n \"no-labels\": [\"warn\"],\n /**\n * Disallow unnecessary nested blocks.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks\n */\n \"no-lone-blocks\": \"warn\",\n /**\n * Disallow if as the only statement in an else block.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if\n */\n \"no-lonely-if\": \"warn\",\n \"no-loss-of-precision\": \"warn\",\n \"no-misleading-character-class\": \"warn\",\n /**\n * Disallow use of chained assignment expressions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign\n */\n \"no-multi-assign\": [\"warn\"],\n /**\n * Disallow nested ternary expressions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-nested-ternary\n */\n \"no-nested-ternary\": \"warn\",\n /**\n * Disallow `new` for side effects.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new\n */\n \"no-new\": \"warn\",\n /**\n * Disallow function constructors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func\n */\n \"no-new-func\": \"warn\",\n /**\n * Disallow primitive wrapper instances, such as `new String('foo')`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers\n */\n \"no-new-wrappers\": \"warn\",\n \"no-nonoctal-decimal-escape\": \"warn\",\n \"no-octal\": \"warn\",\n /**\n * Disallow use of octal escape sequences in string literals.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape\n */\n \"no-octal-escape\": \"warn\",\n /**\n * Disallow reassignment of function parameters.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign\n */\n \"no-param-reassign\": \"warn\",\n /**\n * Disallow returning values from Promise executor functions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-promise-executor-return\n */\n \"no-promise-executor-return\": \"warn\",\n /**\n * Disallow usage of the deprecated `__proto__` property.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto\n */\n \"no-proto\": \"warn\",\n \"no-prototype-builtins\": \"warn\",\n \"no-regex-spaces\": \"warn\",\n /**\n * Disallow assignment in `return` statement.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign\n */\n \"no-return-assign\": \"warn\",\n /**\n * Disallow use of `javascript:` urls.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url\n */\n \"no-script-url\": \"warn\",\n \"no-self-assign\": \"warn\",\n /**\n * Disallow comparisons where both sides are exactly the same.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare\n */\n \"no-self-compare\": \"warn\",\n /**\n * Disallow use of comma operator.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences\n */\n \"no-sequences\": \"warn\",\n \"no-shadow-restricted-names\": \"warn\",\n \"no-sparse-arrays\": \"warn\",\n /**\n * Disallow template literal placeholder syntax in regular strings, as\n * these are likely errors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-template-curly-in-string\n */\n \"no-template-curly-in-string\": \"warn\",\n /**\n * Disallow initializing variables to `undefined`.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-undef-init\n */\n \"no-undef-init\": \"warn\",\n \"no-unexpected-multiline\": \"warn\",\n /**\n * Disallow ternary operators when simpler alternatives exist.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary\n */\n \"no-unneeded-ternary\": \"warn\",\n /**\n * Disallow loops with a body that allows only one iteration.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop\n */\n \"no-unreachable-loop\": \"warn\",\n \"no-unsafe-finally\": \"warn\",\n \"no-unsafe-optional-chaining\": \"warn\",\n \"no-unused-labels\": \"warn\",\n \"no-unused-private-class-members\": \"warn\",\n \"no-useless-backreference\": \"warn\",\n /**\n * Disallow unnecessary `.call()` and `.apply()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call\n */\n \"no-useless-call\": \"warn\",\n \"no-useless-catch\": \"warn\",\n /**\n * Disallow useless computed property keys.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-computed-key\n */\n \"no-useless-computed-key\": \"warn\",\n /**\n * Disallow unnecessary concatenation of strings.\n *\n * � Not fixable - https://eslint.org/docs/rules/no-useless-concat\n */\n \"no-useless-concat\": \"warn\",\n \"no-useless-escape\": \"warn\",\n /**\n * Disallow renaming import, export, and destructured assignments to the\n * same name.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-rename\n */\n \"no-useless-rename\": \"warn\",\n /**\n * Disallow redundant return statements.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-return\n */\n \"no-useless-return\": \"warn\",\n /**\n * Require `let` or `const` instead of `var`.\n * ts transpiles let/const to var, so no need for vars any more\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-var\n */\n \"no-var\": \"warn\",\n \"no-with\": \"warn\",\n /**\n * Require object literal shorthand syntax.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/object-shorthand\n */\n \"object-shorthand\": \"warn\",\n /**\n * Require default to `const` instead of `let`.\n * ts provides better types with const\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-const\n */\n \"prefer-const\": \"warn\",\n /**\n * Require using named capture groups in regular expressions.\n *\n * � Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group\n */\n \"prefer-named-capture-group\": \"warn\",\n /**\n * Disallow parseInt() in favor of binary, octal, and hexadecimal literals.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-numeric-literals\n */\n \"prefer-numeric-literals\": \"warn\",\n /**\n * Require use of an object spread over Object.assign.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread\n */\n \"prefer-object-spread\": \"warn\",\n /**\n * Disallow use of the RegExp constructor in favor of regular expression\n * literals.\n *\n * � Not fixable - https://eslint.org/docs/rules/prefer-regex-literals\n */\n \"prefer-regex-literals\": \"warn\",\n /**\n * Require using rest parameters instead of `arguments`.\n * ts provides better types with rest args over arguments\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-rest-params\n */\n \"prefer-rest-params\": \"warn\",\n /**\n * Require using spread syntax instead of `.apply()`.\n * ts transpiles spread to apply, so no need for manual apply\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-spread\n */\n \"prefer-spread\": \"warn\",\n /**\n * Require using template literals instead of string concatenation.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-template\n */\n \"prefer-template\": \"warn\",\n \"require-yield\": \"warn\",\n /**\n * Require a `Symbol` description.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/symbol-description\n */\n \"symbol-description\": \"warn\",\n \"use-isnan\": \"warn\",\n \"valid-typeof\": \"warn\",\n /**\n * Disallow \"Yoda conditions\", ensuring the comparison.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/yoda\n */\n yoda: \"warn\",\n});\n"],"mappings":";AAaO,IAAM,kBAAkB,CAC7B,mBACe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMf,yBAAyB;AAAA,IACvB;AAAA,IACA,EAAE,eAAe,MAAM,cAAc,KAAK;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,WAAW;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO,CAAC,UAAU;AAAA,MAClB,qBAAqB;AAAA,MACrB,eAAe;AAAA,MACf,YAAY;AAAA,IACd;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,CAAC,QAAQ,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrB,QAAQ;AAAA,EACR,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,cAAc,CAAC,QAAQ,WAAW;AAAA,EAClC;AAAA;AAAA,IAEE,kBAAkB,SAAS,kBAAkB,UAC3C,QACA,CAAC,QAAQ,eAAe,EAAE,qBAAqB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,WAAW,CAAC,QAAQ,EAAE,UAAU,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AA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../constants.js';
|
|
4
5
|
|
|
5
|
-
type BaseRules = Record<string, EslintRuleConfig> & {
|
|
6
|
-
"func-style"?: EslintRuleConfig<"declaration" | "expression", {
|
|
7
|
-
allowArrowFunctions?: boolean;
|
|
8
|
-
overrides?: {
|
|
9
|
-
namedExports?: "declaration" | "expression" | "ignore";
|
|
10
|
-
};
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
6
|
/**
|
|
14
7
|
* Generates the base set of ESLint rules with configurable function style enforcement.
|
|
15
8
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EslintRuleConfig } from '../types.js';
|
|
2
|
+
import 'eslint';
|
|
3
|
+
import '../constants.js';
|
|
4
|
+
|
|
5
|
+
type BaseRules = Record<string, EslintRuleConfig> & {
|
|
6
|
+
camelcase?: EslintRuleConfig<{
|
|
7
|
+
allow?: string[];
|
|
8
|
+
ignoreDestructuring?: boolean;
|
|
9
|
+
ignoreGlobals?: boolean;
|
|
10
|
+
ignoreImports?: boolean;
|
|
11
|
+
properties?: "always" | "never";
|
|
12
|
+
}>;
|
|
13
|
+
"func-style"?: EslintRuleConfig<"declaration" | "expression", {
|
|
14
|
+
allowArrowFunctions?: boolean;
|
|
15
|
+
overrides?: {
|
|
16
|
+
namedExports?: "declaration" | "expression" | "ignore";
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type { BaseRules };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/eslint/ignores.d.ts
CHANGED
|
@@ -4,9 +4,14 @@ import { Linter } from 'eslint';
|
|
|
4
4
|
* Creates an ESLint configuration for file and directory ignores.
|
|
5
5
|
* By default, ignores node_modules, dist directories, and .git directories.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
7
|
+
* @param options - Object with options to control the ignores configuration
|
|
8
|
+
* @param options.userIgnores - Additional glob patterns to ignore in ESLint checks
|
|
9
|
+
* @param options.next - Whether to include .next directory in ignores
|
|
8
10
|
* @returns ESLint configuration object with ignore patterns
|
|
9
11
|
*/
|
|
10
|
-
declare const ignoresConfig: (userIgnores
|
|
12
|
+
declare const ignoresConfig: ({ next, userIgnores, }?: {
|
|
13
|
+
next?: boolean;
|
|
14
|
+
userIgnores?: string[];
|
|
15
|
+
}) => Linter.Config;
|
|
11
16
|
|
|
12
17
|
export { ignoresConfig };
|
package/dist/eslint/ignores.js
CHANGED
package/dist/eslint/index.d.ts
CHANGED
|
@@ -2,33 +2,33 @@ import { Linter } from 'eslint';
|
|
|
2
2
|
import { FunctionStyle } from './types.js';
|
|
3
3
|
import './constants.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface EslintConfigOptions {
|
|
6
6
|
functionStyle?: "off" | FunctionStyle;
|
|
7
7
|
ignores?: string[];
|
|
8
8
|
jsdoc?: false | {
|
|
9
9
|
requireJsdoc?: boolean;
|
|
10
10
|
};
|
|
11
|
+
react?: boolean | {
|
|
12
|
+
next?: boolean | undefined;
|
|
13
|
+
reactCompiler?: boolean | undefined;
|
|
14
|
+
};
|
|
11
15
|
sorting?: boolean;
|
|
12
16
|
typescript?: boolean | string;
|
|
13
|
-
}
|
|
14
|
-
react: true;
|
|
15
|
-
reactCompiler: boolean | undefined;
|
|
16
|
-
} | {
|
|
17
|
-
react?: boolean;
|
|
18
|
-
});
|
|
17
|
+
}
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
19
|
+
* Configures ESLint based on provided options.
|
|
21
20
|
*
|
|
22
21
|
* @param options - The optional configuration object.
|
|
23
|
-
* @param options.functionStyle - The function style to
|
|
24
|
-
* @param options.ignores -
|
|
25
|
-
* @param options.jsdoc - Whether to include JSDoc rules.
|
|
26
|
-
* @param options.react - Whether to include React rules.
|
|
22
|
+
* @param options.functionStyle - The function style to enforce. Defaults to "arrow".
|
|
23
|
+
* @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `dist`.
|
|
24
|
+
* @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.
|
|
25
|
+
* @param options.react - Whether to include React rules. When true, reactCompiler is enabled by default.
|
|
26
|
+
* Can be configured with an object to control next.js support and reactCompiler.
|
|
27
27
|
* @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.
|
|
28
|
-
* @param options.typescript - Whether to include TypeScript rules
|
|
29
|
-
* @param additionalConfigs - Additional ESLint config objects to be
|
|
30
|
-
* @returns
|
|
28
|
+
* @param options.typescript - Whether to include TypeScript rules. Can be a boolean or a string with path to tsconfig.
|
|
29
|
+
* @param additionalConfigs - Additional ESLint config objects to be merged into the final configuration.
|
|
30
|
+
* @returns An array of ESLint configuration objects.
|
|
31
31
|
*/
|
|
32
|
-
declare const eslintConfig: ({ functionStyle, ignores, jsdoc, react, sorting, typescript,
|
|
32
|
+
declare const eslintConfig: ({ functionStyle, ignores, jsdoc, react, sorting, typescript, }?: EslintConfigOptions, ...additionalConfigs: Linter.Config[]) => Linter.Config[];
|
|
33
33
|
|
|
34
34
|
export { type EslintConfigOptions, eslintConfig };
|
package/dist/eslint/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
eslintConfig
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-VWKQSLJR.js";
|
|
4
4
|
import "../chunk-OPQZGCVL.js";
|
|
5
5
|
import "../chunk-SIH4WAXK.js";
|
|
6
6
|
import "../chunk-26SVGV32.js";
|
|
7
7
|
import "../chunk-GBJI557O.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-IZXVPZVW.js";
|
|
9
|
+
import "../chunk-LITSWCYQ.js";
|
|
10
|
+
import "../chunk-VF7D6J7C.js";
|
|
11
|
+
import "../chunk-ZOCL6XIB.js";
|
|
10
12
|
import "../chunk-LGB33CUY.js";
|
|
11
13
|
import "../chunk-XCPOAYGQ.js";
|
|
12
14
|
import "../chunk-HLX2OWWB.js";
|
|
13
15
|
import "../chunk-3SHRYTUT.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-6WWZTVUE.js";
|
|
16
|
-
import "../chunk-M4HZ67BH.js";
|
|
16
|
+
import "../chunk-3JDYGS77.js";
|
|
17
17
|
import "../chunk-XXWXCIGZ.js";
|
|
18
18
|
import "../chunk-7D4SUZUM.js";
|
|
19
19
|
export {
|
|
@@ -5,20 +5,20 @@ import {
|
|
|
5
5
|
} from "../chunk-Y4XKZK6J.js";
|
|
6
6
|
import {
|
|
7
7
|
eslintConfig
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-VWKQSLJR.js";
|
|
9
9
|
import "../chunk-OPQZGCVL.js";
|
|
10
10
|
import "../chunk-SIH4WAXK.js";
|
|
11
11
|
import "../chunk-26SVGV32.js";
|
|
12
12
|
import "../chunk-GBJI557O.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-IZXVPZVW.js";
|
|
14
|
+
import "../chunk-LITSWCYQ.js";
|
|
15
|
+
import "../chunk-VF7D6J7C.js";
|
|
16
|
+
import "../chunk-ZOCL6XIB.js";
|
|
15
17
|
import "../chunk-LGB33CUY.js";
|
|
16
18
|
import "../chunk-XCPOAYGQ.js";
|
|
17
19
|
import "../chunk-HLX2OWWB.js";
|
|
18
20
|
import "../chunk-3SHRYTUT.js";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-6WWZTVUE.js";
|
|
21
|
-
import "../chunk-M4HZ67BH.js";
|
|
21
|
+
import "../chunk-3JDYGS77.js";
|
|
22
22
|
import {
|
|
23
23
|
configNames
|
|
24
24
|
} from "../chunk-XXWXCIGZ.js";
|
|
@@ -104,7 +104,7 @@ describe("eslintConfig", () => {
|
|
|
104
104
|
);
|
|
105
105
|
});
|
|
106
106
|
it("excludes React compiler config when React is enabled but React compiler is not", () => {
|
|
107
|
-
const config = eslintConfig({ react:
|
|
107
|
+
const config = eslintConfig({ react: { reactCompiler: false } });
|
|
108
108
|
globalExpect(config.some((c) => c.name === configNames.reactCompiler)).toBe(
|
|
109
109
|
false
|
|
110
110
|
);
|
|
@@ -162,6 +162,11 @@ describe("eslintConfig", () => {
|
|
|
162
162
|
globalExpect.arrayContaining(["**/node_modules/", "**/dist/"])
|
|
163
163
|
);
|
|
164
164
|
});
|
|
165
|
+
it("it adds '.next' to ignores when `react.next` is true", () => {
|
|
166
|
+
const config = eslintConfig({ react: { next: true } });
|
|
167
|
+
const ignoresConfig = config[0];
|
|
168
|
+
globalExpect(ignoresConfig?.ignores).toEqual(globalExpect.arrayContaining([".next"]));
|
|
169
|
+
});
|
|
165
170
|
});
|
|
166
171
|
describe("additional config objects", () => {
|
|
167
172
|
it("includes additional config objects in the returned array", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eslint/index.test.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { describe, expect, it } from \"vitest\";\n\nimport { configNames } from \"./constants.js\";\nimport { eslintConfig } from \"./index.js\";\n\ndescribe(\"eslintConfig\", () => {\n describe(\"default configuration\", () => {\n it(\"returns expected default configs\", () => {\n const config = eslintConfig();\n const names = config.map((c) => c.name);\n const expectedConfigs = [\n configNames.ignores,\n configNames.base,\n configNames.jsdoc,\n configNames.typescript,\n configNames.perfectionist,\n configNames.disableTypeChecked,\n // the disable type checked config comes with an additional un-named config\n undefined,\n ];\n\n expect(config).toBeInstanceOf(Array);\n expectedConfigs.forEach((expectedName) => {\n expect(names).toContain(expectedName);\n });\n });\n });\n\n describe(\"function style options\", () => {\n it(\"applies 'arrow' function style by default\", () => {\n const config = eslintConfig();\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n // it is enforced by prefer-arrow-functions when functionStyle is \"arrow\"\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual(\"off\");\n });\n\n it(\"applies 'declaration' function style when specified\", () => {\n const config = eslintConfig({ functionStyle: \"declaration\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual([\n \"warn\",\n \"declaration\",\n { allowArrowFunctions: true },\n ]);\n });\n\n it(\"applies 'expression' function style when specified\", () => {\n const config = eslintConfig({ functionStyle: \"expression\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual([\n \"warn\",\n \"expression\",\n { allowArrowFunctions: true },\n ]);\n });\n\n it(\"disables function style rule when 'off' is specified\", () => {\n const config = eslintConfig({ functionStyle: \"off\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toBe(\"off\");\n });\n\n it(\"applies function style to React component definition when React is enabled\", () => {\n const config = eslintConfig({\n functionStyle: \"declaration\",\n react: true,\n });\n const reactConfig = config.find((c) => c.name === configNames.react);\n\n expect(\n reactConfig?.rules?.[\"react/function-component-definition\"],\n ).toEqual([\n \"warn\",\n {\n namedComponents: \"function-declaration\",\n unnamedComponents: \"function-expression\",\n },\n ]);\n });\n });\n\n describe(\"React configuration\", () => {\n it(\"includes React config when enabled\", () => {\n const config = eslintConfig({ react: true });\n\n expect(config.some((c) => c.name === configNames.react)).toBe(true);\n });\n\n it(\"includes React compiler config by default when React is enabled\", () => {\n const config = eslintConfig({ react: true });\n\n expect(config.some((c) => c.name === configNames.reactCompiler)).toBe(\n true,\n );\n });\n\n it(\"excludes React compiler config when React is enabled but React compiler is not\", () => {\n const config = eslintConfig({ react: true, reactCompiler: false });\n\n expect(config.some((c) => c.name === configNames.reactCompiler)).toBe(\n false,\n );\n });\n });\n\n describe(\"JSDoc configuration\", () => {\n it(\"includes JSDoc config by default with requirements disabled\", () => {\n const config = eslintConfig();\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toBe(\"off\");\n });\n\n it(\"excludes JSDoc config entirely when disabled\", () => {\n const config = eslintConfig({ jsdoc: false });\n\n expect(config.some((c) => c.name === configNames.jsdoc)).toBe(false);\n });\n\n it(\"enables JSDoc requirements when configured\", () => {\n const config = eslintConfig({ jsdoc: { requireJsdoc: true } });\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toEqual(\n expect.arrayContaining([\"warn\"]),\n );\n });\n\n it(\"keeps JSDoc requirements disabled when explicitly set\", () => {\n const config = eslintConfig({ jsdoc: { requireJsdoc: false } });\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toBeDefined();\n });\n });\n\n describe(\"optional configurations\", () => {\n it(\"excludes TypeScript config when disabled\", () => {\n const config = eslintConfig({ typescript: false });\n\n expect(config.some((c) => c.name === configNames.typescript)).toBe(false);\n });\n\n it(\"excludes sorting config when disabled\", () => {\n const config = eslintConfig({ sorting: false });\n\n expect(config.some((c) => c.name === configNames.perfectionist)).toBe(\n false,\n );\n });\n });\n\n describe(\"ignore patterns\", () => {\n it(\"applies custom ignores\", () => {\n const customIgnores = [\"*.test.ts\", \"*.spec.ts\"];\n const config = eslintConfig({ ignores: customIgnores });\n\n expect(config[0]?.ignores).toEqual(expect.arrayContaining(customIgnores));\n });\n\n it(\"handles empty ignores array\", () => {\n const config = eslintConfig({ ignores: [] });\n const ignoresConfig = config[0];\n\n // Should still include default ignores\n expect(ignoresConfig?.ignores?.length).toBeGreaterThan(0);\n expect(ignoresConfig?.ignores).toEqual(\n expect.arrayContaining([\"**/node_modules/\", \"**/dist/\"]),\n );\n });\n });\n\n describe(\"additional config objects\", () => {\n it(\"includes additional config objects in the returned array\", () => {\n const additionalConfig: Linter.Config = {\n name: \"custom-config\",\n rules: {\n \"no-console\": 2,\n },\n };\n\n const config = eslintConfig({}, additionalConfig);\n\n expect(config).toContainEqual(additionalConfig);\n });\n\n it(\"appends multiple additional config objects to the returned array\", () => {\n const additionalConfig1: Linter.Config = {\n name: \"custom-config-1\",\n rules: {\n \"custom-rule-1\": \"error\",\n },\n };\n\n const additionalConfig2: Linter.Config = {\n name: \"custom-config-2\",\n rules: {\n \"custom-rule-2\": \"warn\",\n },\n };\n\n const config = eslintConfig({}, additionalConfig1, additionalConfig2);\n\n expect(config).toContainEqual(additionalConfig1);\n expect(config).toContainEqual(additionalConfig2);\n });\n\n it(\"maintains the order of additional config objects\", () => {\n const additionalConfig1: Linter.Config = { name: \"custom-config-1\" };\n const additionalConfig2: Linter.Config = { name: \"custom-config-2\" };\n\n const config = eslintConfig({}, additionalConfig1, additionalConfig2);\n const index1 = config.findIndex((c) => c.name === \"custom-config-1\");\n const index2 = config.findIndex((c) => c.name === \"custom-config-2\");\n\n expect(index1).toBeGreaterThanOrEqual(0);\n expect(index2).toBeGreaterThanOrEqual(0);\n expect(index1).toBeLessThan(index2);\n });\n });\n\n describe(\"prefer arrow functions configuration\", () => {\n it(\"includes prefer-arrow-function config when function style is 'arrow'\", () => {\n const config = eslintConfig({ functionStyle: \"arrow\" });\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(true);\n });\n\n it(\"excludes prefer-arrow-function config when function style is not 'arrow'\", () => {\n const config = eslintConfig({ functionStyle: \"declaration\" });\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(false);\n });\n\n it(\"applies expected rules in prefer-arrow-function config\", () => {\n const config = eslintConfig({ functionStyle: \"arrow\" });\n const arrowConfig = config.find(\n (c) => c.name === configNames.preferArrowFunction,\n );\n\n expect(arrowConfig).toBeDefined();\n expect(\n arrowConfig?.rules?.[\"prefer-arrow-functions/prefer-arrow-functions\"],\n ).toEqual([\n \"warn\",\n {\n returnStyle: \"unchanged\",\n singleReturnOnly: false,\n },\n ]);\n });\n\n it(\"includes prefer-arrow-function config by default\", () => {\n const config = eslintConfig();\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(true);\n });\n });\n\n describe(\"edge cases\", () => {\n it(\"works when all optional features are disabled\", () => {\n const config = eslintConfig({\n jsdoc: false,\n react: false,\n sorting: false,\n typescript: false,\n });\n\n const names = config.map((c) => c.name);\n\n expect(names).toContain(configNames.base);\n expect(names).toContain(configNames.ignores);\n\n // These should be excluded\n expect(names).not.toContain(configNames.typescript);\n expect(names).not.toContain(configNames.react);\n expect(names).not.toContain(configNames.reactCompiler);\n expect(names).not.toContain(configNames.jsdoc);\n expect(names).not.toContain(configNames.perfectionist);\n });\n\n it(\"handles React options without TypeScript\", () => {\n const config = eslintConfig({\n react: true,\n typescript: false,\n });\n\n const reactConfig = config.find((c) => c.name === configNames.react);\n\n // Should still include React configs\n expect(reactConfig).toBeDefined();\n // React config should be initialized with typescript=false\n expect(reactConfig?.rules?.[\"react/prop-types\"]).toBe(\"warn\");\n });\n });\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAAS,gBAAgB,MAAM;AAC7B,WAAS,yBAAyB,MAAM;AACtC,OAAG,oCAAoC,MAAM;AAC3C,YAAM,SAAS,aAAa;AAC5B,YAAM,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI;AACtC,YAAM,kBAAkB;AAAA,QACtB,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA;AAAA,QAEZ;AAAA,MACF;AAEA,mBAAO,MAAM,EAAE,eAAe,KAAK;AACnC,sBAAgB,QAAQ,CAAC,iBAAiB;AACxC,qBAAO,KAAK,EAAE,UAAU,YAAY;AAAA,MACtC,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AAED,WAAS,0BAA0B,MAAM;AACvC,OAAG,6CAA6C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AAY,IAAI;AACxC,mBAAO,KAAK,EAAE,UAAU,YAAY,OAAO;AAG3C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,UAAU;AAClD,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,KAAK;AAC7C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,aAAa;AACrD,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,KAAK;AAC7C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,aAAa;AAAA,IACvD,CAAC;AAED,OAAG,4CAA4C,MAAM;AACnD,YAAM,SAAS,aAAa;AAAA,QAC1B,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAED,YAAM,cAAc,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY,KAAK;AAGnE,mBAAO,WAAW,EAAE,YAAY;AAEhC,mBAAO,aAAa,QAAQ,kBAAkB,CAAC,EAAE,KAAK,MAAM;AAAA,IAC9D,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/eslint/index.test.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { describe, expect, it } from \"vitest\";\n\nimport { configNames } from \"./constants.js\";\nimport { eslintConfig } from \"./index.js\";\n\ndescribe(\"eslintConfig\", () => {\n describe(\"default configuration\", () => {\n it(\"returns expected default configs\", () => {\n const config = eslintConfig();\n const names = config.map((c) => c.name);\n const expectedConfigs = [\n configNames.ignores,\n configNames.base,\n configNames.jsdoc,\n configNames.typescript,\n configNames.perfectionist,\n configNames.disableTypeChecked,\n // the disable type checked config comes with an additional un-named config\n undefined,\n ];\n\n expect(config).toBeInstanceOf(Array);\n expectedConfigs.forEach((expectedName) => {\n expect(names).toContain(expectedName);\n });\n });\n });\n\n describe(\"function style options\", () => {\n it(\"applies 'arrow' function style by default\", () => {\n const config = eslintConfig();\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n // it is enforced by prefer-arrow-functions when functionStyle is \"arrow\"\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual(\"off\");\n });\n\n it(\"applies 'declaration' function style when specified\", () => {\n const config = eslintConfig({ functionStyle: \"declaration\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual([\n \"warn\",\n \"declaration\",\n { allowArrowFunctions: true },\n ]);\n });\n\n it(\"applies 'expression' function style when specified\", () => {\n const config = eslintConfig({ functionStyle: \"expression\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toEqual([\n \"warn\",\n \"expression\",\n { allowArrowFunctions: true },\n ]);\n });\n\n it(\"disables function style rule when 'off' is specified\", () => {\n const config = eslintConfig({ functionStyle: \"off\" });\n const baseConfig = config.find((c) => c.name === configNames.base);\n\n expect(baseConfig?.rules?.[\"func-style\"]).toBe(\"off\");\n });\n\n it(\"applies function style to React component definition when React is enabled\", () => {\n const config = eslintConfig({\n functionStyle: \"declaration\",\n react: true,\n });\n const reactConfig = config.find((c) => c.name === configNames.react);\n\n expect(\n reactConfig?.rules?.[\"react/function-component-definition\"],\n ).toEqual([\n \"warn\",\n {\n namedComponents: \"function-declaration\",\n unnamedComponents: \"function-expression\",\n },\n ]);\n });\n });\n\n describe(\"React configuration\", () => {\n it(\"includes React config when enabled\", () => {\n const config = eslintConfig({ react: true });\n\n expect(config.some((c) => c.name === configNames.react)).toBe(true);\n });\n\n it(\"includes React compiler config by default when React is enabled\", () => {\n const config = eslintConfig({ react: true });\n\n expect(config.some((c) => c.name === configNames.reactCompiler)).toBe(\n true,\n );\n });\n\n it(\"excludes React compiler config when React is enabled but React compiler is not\", () => {\n const config = eslintConfig({ react: { reactCompiler: false } });\n\n expect(config.some((c) => c.name === configNames.reactCompiler)).toBe(\n false,\n );\n });\n });\n\n describe(\"JSDoc configuration\", () => {\n it(\"includes JSDoc config by default with requirements disabled\", () => {\n const config = eslintConfig();\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toBe(\"off\");\n });\n\n it(\"excludes JSDoc config entirely when disabled\", () => {\n const config = eslintConfig({ jsdoc: false });\n\n expect(config.some((c) => c.name === configNames.jsdoc)).toBe(false);\n });\n\n it(\"enables JSDoc requirements when configured\", () => {\n const config = eslintConfig({ jsdoc: { requireJsdoc: true } });\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toEqual(\n expect.arrayContaining([\"warn\"]),\n );\n });\n\n it(\"keeps JSDoc requirements disabled when explicitly set\", () => {\n const config = eslintConfig({ jsdoc: { requireJsdoc: false } });\n const jsdocConfig = config.find((c) => c.name === configNames.jsdoc);\n\n expect(jsdocConfig).toBeDefined();\n expect(jsdocConfig?.rules?.[\"jsdoc/require-jsdoc\"]).toBeDefined();\n });\n });\n\n describe(\"optional configurations\", () => {\n it(\"excludes TypeScript config when disabled\", () => {\n const config = eslintConfig({ typescript: false });\n\n expect(config.some((c) => c.name === configNames.typescript)).toBe(false);\n });\n\n it(\"excludes sorting config when disabled\", () => {\n const config = eslintConfig({ sorting: false });\n\n expect(config.some((c) => c.name === configNames.perfectionist)).toBe(\n false,\n );\n });\n });\n\n describe(\"ignore patterns\", () => {\n it(\"applies custom ignores\", () => {\n const customIgnores = [\"*.test.ts\", \"*.spec.ts\"];\n const config = eslintConfig({ ignores: customIgnores });\n\n expect(config[0]?.ignores).toEqual(expect.arrayContaining(customIgnores));\n });\n\n it(\"handles empty ignores array\", () => {\n const config = eslintConfig({ ignores: [] });\n const ignoresConfig = config[0];\n\n // Should still include default ignores\n expect(ignoresConfig?.ignores?.length).toBeGreaterThan(0);\n expect(ignoresConfig?.ignores).toEqual(\n expect.arrayContaining([\"**/node_modules/\", \"**/dist/\"]),\n );\n });\n\n it(\"it adds '.next' to ignores when `react.next` is true\", () => {\n const config = eslintConfig({ react: { next: true } });\n const ignoresConfig = config[0];\n\n expect(ignoresConfig?.ignores).toEqual(expect.arrayContaining([\".next\"]));\n });\n });\n\n describe(\"additional config objects\", () => {\n it(\"includes additional config objects in the returned array\", () => {\n const additionalConfig: Linter.Config = {\n name: \"custom-config\",\n rules: {\n \"no-console\": 2,\n },\n };\n\n const config = eslintConfig({}, additionalConfig);\n\n expect(config).toContainEqual(additionalConfig);\n });\n\n it(\"appends multiple additional config objects to the returned array\", () => {\n const additionalConfig1: Linter.Config = {\n name: \"custom-config-1\",\n rules: {\n \"custom-rule-1\": \"error\",\n },\n };\n\n const additionalConfig2: Linter.Config = {\n name: \"custom-config-2\",\n rules: {\n \"custom-rule-2\": \"warn\",\n },\n };\n\n const config = eslintConfig({}, additionalConfig1, additionalConfig2);\n\n expect(config).toContainEqual(additionalConfig1);\n expect(config).toContainEqual(additionalConfig2);\n });\n\n it(\"maintains the order of additional config objects\", () => {\n const additionalConfig1: Linter.Config = { name: \"custom-config-1\" };\n const additionalConfig2: Linter.Config = { name: \"custom-config-2\" };\n\n const config = eslintConfig({}, additionalConfig1, additionalConfig2);\n const index1 = config.findIndex((c) => c.name === \"custom-config-1\");\n const index2 = config.findIndex((c) => c.name === \"custom-config-2\");\n\n expect(index1).toBeGreaterThanOrEqual(0);\n expect(index2).toBeGreaterThanOrEqual(0);\n expect(index1).toBeLessThan(index2);\n });\n });\n\n describe(\"prefer arrow functions configuration\", () => {\n it(\"includes prefer-arrow-function config when function style is 'arrow'\", () => {\n const config = eslintConfig({ functionStyle: \"arrow\" });\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(true);\n });\n\n it(\"excludes prefer-arrow-function config when function style is not 'arrow'\", () => {\n const config = eslintConfig({ functionStyle: \"declaration\" });\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(false);\n });\n\n it(\"applies expected rules in prefer-arrow-function config\", () => {\n const config = eslintConfig({ functionStyle: \"arrow\" });\n const arrowConfig = config.find(\n (c) => c.name === configNames.preferArrowFunction,\n );\n\n expect(arrowConfig).toBeDefined();\n expect(\n arrowConfig?.rules?.[\"prefer-arrow-functions/prefer-arrow-functions\"],\n ).toEqual([\n \"warn\",\n {\n returnStyle: \"unchanged\",\n singleReturnOnly: false,\n },\n ]);\n });\n\n it(\"includes prefer-arrow-function config by default\", () => {\n const config = eslintConfig();\n\n expect(\n config.some((c) => c.name === configNames.preferArrowFunction),\n ).toBe(true);\n });\n });\n\n describe(\"edge cases\", () => {\n it(\"works when all optional features are disabled\", () => {\n const config = eslintConfig({\n jsdoc: false,\n react: false,\n sorting: false,\n typescript: false,\n });\n\n const names = config.map((c) => c.name);\n\n expect(names).toContain(configNames.base);\n expect(names).toContain(configNames.ignores);\n\n // These should be excluded\n expect(names).not.toContain(configNames.typescript);\n expect(names).not.toContain(configNames.react);\n expect(names).not.toContain(configNames.reactCompiler);\n expect(names).not.toContain(configNames.jsdoc);\n expect(names).not.toContain(configNames.perfectionist);\n });\n\n it(\"handles React options without TypeScript\", () => {\n const config = eslintConfig({\n react: true,\n typescript: false,\n });\n\n const reactConfig = config.find((c) => c.name === configNames.react);\n\n // Should still include React configs\n expect(reactConfig).toBeDefined();\n // React config should be initialized with typescript=false\n expect(reactConfig?.rules?.[\"react/prop-types\"]).toBe(\"warn\");\n });\n });\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAAS,gBAAgB,MAAM;AAC7B,WAAS,yBAAyB,MAAM;AACtC,OAAG,oCAAoC,MAAM;AAC3C,YAAM,SAAS,aAAa;AAC5B,YAAM,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI;AACtC,YAAM,kBAAkB;AAAA,QACtB,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA;AAAA,QAEZ;AAAA,MACF;AAEA,mBAAO,M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DAAoD,MAAM;AAC3D,YAAM,SAAS,aAAa;AAE5B;AAAA,QACE,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY,mBAAmB;AAAA,MAC/D,EAAE,KAAK,IAAI;AAAA,IACb,CAAC;AAAA,EACH,CAAC;AAED,WAAS,cAAc,MAAM;AAC3B,OAAG,iDAAiD,MAAM;AACxD,YAAM,SAAS,aAAa;AAAA,QAC1B,OAAO;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,YAAY;AAAA,MACd,CAAC;AAED,YAAM,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI;AAEtC,mBAAO,KAAK,EAAE,UAAU,YAAY,IAAI;AACxC,mBAAO,KAAK,EAAE,UAAU,YAAY,OAAO;AAG3C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,UAAU;AAClD,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,KAAK;AAC7C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,aAAa;AACrD,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,KAAK;AAC7C,mBAAO,KAAK,EAAE,IAAI,UAAU,YAAY,aAAa;AAAA,IACvD,CAAC;AAED,OAAG,4CAA4C,MAAM;AACnD,YAAM,SAAS,aAAa;AAAA,QAC1B,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAED,YAAM,cAAc,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY,KAAK;AAGnE,mBAAO,WAAW,EAAE,YAAY;AAEhC,mBAAO,aAAa,QAAQ,kBAAkB,CAAC,EAAE,KAAK,MAAM;AAAA,IAC9D,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypescriptRules } from './types.js';
|
|
2
|
+
import '../types.js';
|
|
3
|
+
import 'eslint';
|
|
4
|
+
import '../constants.js';
|
|
2
5
|
|
|
3
|
-
declare const tseslintRules:
|
|
6
|
+
declare const tseslintRules: TypescriptRules;
|
|
4
7
|
|
|
5
8
|
export { tseslintRules };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
} from "./chunk-MQCYNRXY.js";
|
|
5
5
|
import {
|
|
6
6
|
eslintConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VWKQSLJR.js";
|
|
8
8
|
import "./chunk-OPQZGCVL.js";
|
|
9
9
|
import "./chunk-SIH4WAXK.js";
|
|
10
10
|
import "./chunk-26SVGV32.js";
|
|
11
11
|
import "./chunk-GBJI557O.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-IZXVPZVW.js";
|
|
13
|
+
import "./chunk-LITSWCYQ.js";
|
|
14
|
+
import "./chunk-VF7D6J7C.js";
|
|
15
|
+
import "./chunk-ZOCL6XIB.js";
|
|
14
16
|
import "./chunk-LGB33CUY.js";
|
|
15
17
|
import "./chunk-XCPOAYGQ.js";
|
|
16
18
|
import "./chunk-HLX2OWWB.js";
|
|
17
19
|
import "./chunk-3SHRYTUT.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-6WWZTVUE.js";
|
|
20
|
-
import "./chunk-M4HZ67BH.js";
|
|
20
|
+
import "./chunk-3JDYGS77.js";
|
|
21
21
|
import "./chunk-XXWXCIGZ.js";
|
|
22
22
|
import "./chunk-7D4SUZUM.js";
|
|
23
23
|
export {
|
|
@@ -7,20 +7,20 @@ import {
|
|
|
7
7
|
globalExpect,
|
|
8
8
|
it
|
|
9
9
|
} from "../chunk-Y4XKZK6J.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-VWKQSLJR.js";
|
|
11
11
|
import "../chunk-OPQZGCVL.js";
|
|
12
12
|
import "../chunk-SIH4WAXK.js";
|
|
13
13
|
import "../chunk-26SVGV32.js";
|
|
14
14
|
import "../chunk-GBJI557O.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-IZXVPZVW.js";
|
|
16
|
+
import "../chunk-LITSWCYQ.js";
|
|
17
|
+
import "../chunk-VF7D6J7C.js";
|
|
18
|
+
import "../chunk-ZOCL6XIB.js";
|
|
17
19
|
import "../chunk-LGB33CUY.js";
|
|
18
20
|
import "../chunk-XCPOAYGQ.js";
|
|
19
21
|
import "../chunk-HLX2OWWB.js";
|
|
20
22
|
import "../chunk-3SHRYTUT.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-6WWZTVUE.js";
|
|
23
|
-
import "../chunk-M4HZ67BH.js";
|
|
23
|
+
import "../chunk-3JDYGS77.js";
|
|
24
24
|
import "../chunk-XXWXCIGZ.js";
|
|
25
25
|
import "../chunk-7D4SUZUM.js";
|
|
26
26
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eslint/javascript/rules.ts"],"sourcesContent":["import type { EslintRuleConfig, FunctionStyle } from \"../types.js\";\n\ntype BaseRules = Record<string, EslintRuleConfig> & {\n \"func-style\"?: EslintRuleConfig<\n \"declaration\" | \"expression\",\n {\n allowArrowFunctions?: boolean;\n overrides?: {\n namedExports?: \"declaration\" | \"expression\" | \"ignore\";\n };\n }\n >;\n};\n\n/**\n * Generates the base set of ESLint rules with configurable function style enforcement.\n *\n * @param functionStyle - Controls how functions should be written. Can be:\n * - \"off\": Disables function style enforcement\n * - \"arrow\": Enforces arrow function expressions\n * - \"declaration\": Enforces function declarations\n * - \"expression\": Enforces function expressions\n * @returns An object containing ESLint rule configurations\n */\nexport const baseEslintRules = (\n functionStyle: \"off\" | FunctionStyle,\n): BaseRules => ({\n /**\n * Require return statements in array methods callbacks.\n *\n * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return\n */\n \"array-callback-return\": [\n \"warn\",\n { allowImplicit: true, checkForEach: true },\n ],\n /**\n * Treat `var` statements as if they were block scoped.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var\n */\n \"block-scoped-var\": \"warn\",\n /**\n * Require camel case names.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/camelcase\n */\n camelcase: [\n \"warn\",\n { allow: [\"^UNSAFE_\"], ignoreDestructuring: false, properties: \"never\" },\n ],\n /**\n * Require curly braces for multiline blocks.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/curly\n */\n curly: [\"warn\", \"multi-line\"],\n /**\n * Require default clauses in switch statements to be last (if used).\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last\n */\n \"default-case-last\": \"warn\",\n /**\n * Require triple equals (`===` and `!==`).\n *å\n * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq\n */\n eqeqeq: \"warn\",\n \"for-direction\": \"warn\",\n /**\n * Require function expressions to have a name.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/func-names\n */\n \"func-names\": [\"warn\", \"as-needed\"],\n \"func-style\":\n // if arrow function, we use the prefer-arrow-functions plugin\n functionStyle === \"off\" || functionStyle === \"arrow\" ?\n \"off\"\n : [\"warn\", functionStyle, { allowArrowFunctions: true }],\n /**\n * Require grouped accessor pairs in object literals and classes.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs\n */\n \"grouped-accessor-pairs\": \"warn\",\n /**\n * Require a capital letter for constructors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/new-cap\n */\n \"new-cap\": [\"warn\", { capIsNew: false }],\n /**\n * Disallow use of `alert()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert\n */\n \"no-alert\": \"warn\",\n \"no-async-promise-executor\": \"warn\",\n /**\n * Disallow use of bitwise operators.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise\n */\n \"no-bitwise\": \"warn\",\n /**\n * Disallow use of `caller`/`callee`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller\n */\n \"no-caller\": \"warn\",\n \"no-case-declarations\": \"warn\",\n \"no-compare-neg-zero\": \"warn\",\n \"no-cond-assign\": \"warn\",\n /**\n * Disallow the use of console.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-console\n */\n \"no-console\": [\"warn\", { allow: [\"info\", \"warn\", \"error\"] }],\n /**\n * Disallow expressions where the operation doesn't affect the value.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-console\n */\n \"no-constant-binary-expression\": \"warn\",\n \"no-constant-condition\": \"warn\",\n /**\n * Disallow returning value in constructor.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return\n */\n \"no-constructor-return\": \"warn\",\n \"no-control-regex\": \"warn\",\n \"no-debugger\": \"warn\",\n \"no-delete-var\": \"warn\",\n \"no-dupe-else-if\": \"warn\",\n \"no-duplicate-case\": \"warn\",\n /**\n * Disallow using an `else` if the `if` block contains a return.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return\n */\n \"no-else-return\": \"warn\",\n \"no-empty\": \"warn\",\n \"no-empty-character-class\": \"warn\",\n \"no-empty-pattern\": \"warn\",\n \"no-empty-static-block\": \"warn\",\n /**\n * Disallow `eval()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval\n */\n \"no-eval\": \"warn\",\n \"no-ex-assign\": \"warn\",\n /**\n * Disallow extending native objects.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native\n */\n \"no-extend-native\": \"warn\",\n /**\n * Disallow unnecessary function binding.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind\n */\n \"no-extra-bind\": \"warn\",\n \"no-extra-boolean-cast\": \"warn\",\n /**\n * Disallow unnecessary labels.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label\n */\n \"no-extra-label\": \"warn\",\n \"no-fallthrough\": \"warn\",\n \"no-global-assign\": \"warn\",\n /**\n * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.\n *\n * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion\n */\n \"no-implicit-coercion\": \"warn\",\n \"no-invalid-regexp\": \"warn\",\n \"no-irregular-whitespace\": \"warn\",\n /**\n * Disallow usage of `__iterator__` property.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator\n */\n \"no-iterator\": \"warn\",\n /**\n * Disallow labels that share a name with a variable.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-label-var\n */\n \"no-label-var\": \"warn\",\n /**\n * Disallow use of labels for anything other than loops and switches.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels\n */\n \"no-labels\": [\"warn\"],\n /**\n * Disallow unnecessary nested blocks.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks\n */\n \"no-lone-blocks\": \"warn\",\n /**\n * Disallow if as the only statement in an else block.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if\n */\n \"no-lonely-if\": \"warn\",\n \"no-loss-of-precision\": \"warn\",\n \"no-misleading-character-class\": \"warn\",\n /**\n * Disallow use of chained assignment expressions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign\n */\n \"no-multi-assign\": [\"warn\"],\n /**\n * Disallow nested ternary expressions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-nested-ternary\n */\n \"no-nested-ternary\": \"warn\",\n /**\n * Disallow `new` for side effects.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new\n */\n \"no-new\": \"warn\",\n /**\n * Disallow function constructors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func\n */\n \"no-new-func\": \"warn\",\n /**\n * Disallow primitive wrapper instances, such as `new String('foo')`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers\n */\n \"no-new-wrappers\": \"warn\",\n \"no-nonoctal-decimal-escape\": \"warn\",\n \"no-octal\": \"warn\",\n /**\n * Disallow use of octal escape sequences in string literals.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape\n */\n \"no-octal-escape\": \"warn\",\n /**\n * Disallow reassignment of function parameters.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign\n */\n \"no-param-reassign\": \"warn\",\n /**\n * Disallow returning values from Promise executor functions.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-promise-executor-return\n */\n \"no-promise-executor-return\": \"warn\",\n /**\n * Disallow usage of the deprecated `__proto__` property.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto\n */\n \"no-proto\": \"warn\",\n \"no-prototype-builtins\": \"warn\",\n \"no-regex-spaces\": \"warn\",\n /**\n * Disallow assignment in `return` statement.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign\n */\n \"no-return-assign\": \"warn\",\n /**\n * Disallow use of `javascript:` urls.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url\n */\n \"no-script-url\": \"warn\",\n \"no-self-assign\": \"warn\",\n /**\n * Disallow comparisons where both sides are exactly the same.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare\n */\n \"no-self-compare\": \"warn\",\n /**\n * Disallow use of comma operator.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences\n */\n \"no-sequences\": \"warn\",\n \"no-shadow-restricted-names\": \"warn\",\n \"no-sparse-arrays\": \"warn\",\n /**\n * Disallow template literal placeholder syntax in regular strings, as\n * these are likely errors.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-template-curly-in-string\n */\n \"no-template-curly-in-string\": \"warn\",\n /**\n * Disallow initializing variables to `undefined`.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-undef-init\n */\n \"no-undef-init\": \"warn\",\n \"no-unexpected-multiline\": \"warn\",\n /**\n * Disallow ternary operators when simpler alternatives exist.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary\n */\n \"no-unneeded-ternary\": \"warn\",\n /**\n * Disallow loops with a body that allows only one iteration.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop\n */\n \"no-unreachable-loop\": \"warn\",\n \"no-unsafe-finally\": \"warn\",\n \"no-unsafe-optional-chaining\": \"warn\",\n \"no-unused-labels\": \"warn\",\n \"no-unused-private-class-members\": \"warn\",\n \"no-useless-backreference\": \"warn\",\n /**\n * Disallow unnecessary `.call()` and `.apply()`.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call\n */\n \"no-useless-call\": \"warn\",\n \"no-useless-catch\": \"warn\",\n /**\n * Disallow useless computed property keys.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-computed-key\n */\n \"no-useless-computed-key\": \"warn\",\n /**\n * Disallow unnecessary concatenation of strings.\n *\n * � Not fixable - https://eslint.org/docs/rules/no-useless-concat\n */\n \"no-useless-concat\": \"warn\",\n \"no-useless-escape\": \"warn\",\n /**\n * Disallow renaming import, export, and destructured assignments to the\n * same name.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-rename\n */\n \"no-useless-rename\": \"warn\",\n /**\n * Disallow redundant return statements.\n *\n * � Fixable - https://eslint.org/docs/rules/no-useless-return\n */\n \"no-useless-return\": \"warn\",\n /**\n * Require `let` or `const` instead of `var`.\n * ts transpiles let/const to var, so no need for vars any more\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/no-var\n */\n \"no-var\": \"warn\",\n \"no-with\": \"warn\",\n /**\n * Require object literal shorthand syntax.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/object-shorthand\n */\n \"object-shorthand\": \"warn\",\n /**\n * Require default to `const` instead of `let`.\n * ts provides better types with const\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-const\n */\n \"prefer-const\": \"warn\",\n /**\n * Require using named capture groups in regular expressions.\n *\n * � Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group\n */\n \"prefer-named-capture-group\": \"warn\",\n /**\n * Disallow parseInt() in favor of binary, octal, and hexadecimal literals.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-numeric-literals\n */\n \"prefer-numeric-literals\": \"warn\",\n /**\n * Require use of an object spread over Object.assign.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread\n */\n \"prefer-object-spread\": \"warn\",\n /**\n * Disallow use of the RegExp constructor in favor of regular expression\n * literals.\n *\n * � Not fixable - https://eslint.org/docs/rules/prefer-regex-literals\n */\n \"prefer-regex-literals\": \"warn\",\n /**\n * Require using rest parameters instead of `arguments`.\n * ts provides better types with rest args over arguments\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-rest-params\n */\n \"prefer-rest-params\": \"warn\",\n /**\n * Require using spread syntax instead of `.apply()`.\n * ts transpiles spread to apply, so no need for manual apply\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-spread\n */\n \"prefer-spread\": \"warn\",\n /**\n * Require using template literals instead of string concatenation.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/prefer-template\n */\n \"prefer-template\": \"warn\",\n \"require-yield\": \"warn\",\n /**\n * Require a `Symbol` description.\n *\n * 🚫 Not fixable - https://eslint.org/docs/rules/symbol-description\n */\n \"symbol-description\": \"warn\",\n \"use-isnan\": \"warn\",\n \"valid-typeof\": \"warn\",\n /**\n * Disallow \"Yoda conditions\", ensuring the comparison.\n *\n * 🔧 Fixable - https://eslint.org/docs/rules/yoda\n */\n yoda: \"warn\",\n});\n"],"mappings":";AAwBO,IAAM,kBAAkB,CAC7B,mBACe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMf,yBAAyB;AAAA,IACvB;AAAA,IACA,EAAE,eAAe,MAAM,cAAc,KAAK;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,oBAAoB;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;AAAA;AAAA,EAMhB,8BAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9B,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOxB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOtB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,MAAM;AACR;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eslint/typescript/rules.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const tseslintRules: Linter.RulesRecord = {\n \"@typescript-eslint/adjacent-overload-signatures\": \"warn\",\n \"@typescript-eslint/array-type\": \"warn\",\n \"@typescript-eslint/await-thenable\": \"warn\",\n \"@typescript-eslint/ban-ts-comment\": [\n \"warn\",\n { minimumDescriptionLength: 10 },\n ],\n \"@typescript-eslint/ban-tslint-comment\": \"warn\",\n \"@typescript-eslint/class-literal-property-style\": \"warn\",\n \"@typescript-eslint/consistent-generic-constructors\": \"warn\",\n \"@typescript-eslint/consistent-indexed-object-style\": \"warn\",\n \"@typescript-eslint/consistent-type-assertions\": \"warn\",\n \"@typescript-eslint/consistent-type-definitions\": \"warn\",\n \"@typescript-eslint/consistent-type-exports\": [\n \"warn\",\n { fixMixedExportsWithInlineTypeSpecifier: true },\n ],\n \"@typescript-eslint/consistent-type-imports\": [\n \"warn\",\n {\n fixStyle: \"inline-type-imports\",\n prefer: \"type-imports\",\n },\n ],\n \"@typescript-eslint/dot-notation\": \"warn\",\n \"@typescript-eslint/no-array-constructor\": \"warn\",\n \"@typescript-eslint/no-array-delete\": \"warn\",\n \"@typescript-eslint/no-base-to-string\": \"warn\",\n \"@typescript-eslint/no-confusing-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-confusing-void-expression\": \"warn\",\n \"@typescript-eslint/no-deprecated\": \"warn\",\n \"@typescript-eslint/no-duplicate-enum-values\": \"warn\",\n \"@typescript-eslint/no-duplicate-type-constituents\": \"warn\",\n \"@typescript-eslint/no-dynamic-delete\": \"warn\",\n \"@typescript-eslint/no-empty-function\": \"warn\",\n \"@typescript-eslint/no-empty-object-type\": \"warn\",\n \"@typescript-eslint/no-explicit-any\": \"warn\",\n \"@typescript-eslint/no-extra-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-extraneous-class\": \"warn\",\n \"@typescript-eslint/no-floating-promises\": \"warn\",\n \"@typescript-eslint/no-for-in-array\": \"warn\",\n \"@typescript-eslint/no-implied-eval\": \"warn\",\n \"@typescript-eslint/no-import-type-side-effects\": \"warn\",\n \"@typescript-eslint/no-inferrable-types\": \"warn\",\n \"@typescript-eslint/no-invalid-void-type\": \"warn\",\n \"@typescript-eslint/no-meaningless-void-operator\": \"warn\",\n \"@typescript-eslint/no-misused-new\": \"warn\",\n \"@typescript-eslint/no-misused-promises\": \"warn\",\n \"@typescript-eslint/no-mixed-enums\": \"warn\",\n \"@typescript-eslint/no-namespace\": \"warn\",\n \"@typescript-eslint/no-non-null-asserted-nullish-coalescing\": \"warn\",\n \"@typescript-eslint/no-non-null-asserted-optional-chain\": \"warn\",\n \"@typescript-eslint/no-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-redundant-type-constituents\": \"warn\",\n \"@typescript-eslint/no-require-imports\": \"warn\",\n \"@typescript-eslint/no-this-alias\": \"warn\",\n \"@typescript-eslint/no-unnecessary-boolean-literal-compare\": \"warn\",\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n \"@typescript-eslint/no-unnecessary-template-expression\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-arguments\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-assertion\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-constraint\": \"warn\",\n \"@typescript-eslint/no-unnecessary-type-parameters\": \"warn\",\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"warn\",\n \"@typescript-eslint/no-unsafe-enum-comparison\": \"warn\",\n \"@typescript-eslint/no-unsafe-function-type\": \"warn\",\n \"@typescript-eslint/no-unsafe-unary-minus\": \"warn\",\n \"@typescript-eslint/no-unused-expressions\": \"warn\",\n \"@typescript-eslint/no-unused-vars\": [\n \"warn\",\n {\n args: \"after-used\",\n argsIgnorePattern: \"^_\",\n ignoreRestSiblings: false,\n vars: \"all\",\n varsIgnorePattern: \"^_\",\n },\n ],\n \"@typescript-eslint/no-useless-constructor\": \"warn\",\n \"@typescript-eslint/no-wrapper-object-types\": \"warn\",\n \"@typescript-eslint/non-nullable-type-assertion-style\": \"warn\",\n \"@typescript-eslint/only-throw-error\": \"warn\",\n \"@typescript-eslint/prefer-as-const\": \"warn\",\n \"@typescript-eslint/prefer-find\": \"warn\",\n \"@typescript-eslint/prefer-for-of\": \"warn\",\n \"@typescript-eslint/prefer-function-type\": \"warn\",\n \"@typescript-eslint/prefer-includes\": \"warn\",\n \"@typescript-eslint/prefer-literal-enum-member\": \"warn\",\n \"@typescript-eslint/prefer-namespace-keyword\": \"warn\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"warn\",\n \"@typescript-eslint/prefer-optional-chain\": \"warn\",\n \"@typescript-eslint/prefer-promise-reject-errors\": \"warn\",\n \"@typescript-eslint/prefer-reduce-type-parameter\": \"warn\",\n \"@typescript-eslint/prefer-regexp-exec\": \"warn\",\n \"@typescript-eslint/prefer-return-this-type\": \"warn\",\n \"@typescript-eslint/prefer-string-starts-ends-with\": \"warn\",\n \"@typescript-eslint/related-getter-setter-pairs\": \"warn\",\n \"@typescript-eslint/require-await\": \"warn\",\n \"@typescript-eslint/restrict-plus-operands\": [\n \"warn\",\n {\n allowAny: false,\n allowBoolean: false,\n allowNullish: false,\n allowNumberAndString: false,\n allowRegExp: false,\n },\n ],\n \"@typescript-eslint/restrict-template-expressions\": [\n \"warn\",\n {\n allow: [{ from: \"lib\", name: [\"Error\", \"URL\", \"URLSearchParams\"] }],\n allowAny: true,\n allowBoolean: true,\n allowNullish: true,\n allowNumber: true,\n allowRegExp: true,\n },\n ],\n \"@typescript-eslint/return-await\": [\n \"warn\",\n \"error-handling-correctness-only\",\n ],\n \"@typescript-eslint/triple-slash-reference\": \"warn\",\n \"@typescript-eslint/unbound-method\": \"warn\",\n \"@typescript-eslint/unified-signatures\": \"warn\",\n \"@typescript-eslint/use-unknown-in-catch-callback-variable\": \"warn\",\n \"dot-notation\": \"off\",\n \"no-empty-function\": \"off\",\n};\n"],"mappings":";AAEO,IAAM,gBAAoC;AAAA,EAC/C,mDAAmD;AAAA,EACnD,iCAAiC;AAAA,EACjC,qCAAqC;AAAA,EACrC,qCAAqC;AAAA,IACnC;AAAA,IACA,EAAE,0BAA0B,GAAG;AAAA,EACjC;AAAA,EACA,yCAAyC;AAAA,EACzC,mDAAmD;AAAA,EACnD,sDAAsD;AAAA,EACtD,sDAAsD;AAAA,EACtD,iDAAiD;AAAA,EACjD,kDAAkD;AAAA,EAClD,8CAA8C;AAAA,IAC5C;AAAA,IACA,EAAE,wCAAwC,KAAK;AAAA,EACjD;AAAA,EACA,8CAA8C;AAAA,IAC5C;AAAA,IACA;AAAA,MACE,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,mCAAmC;AAAA,EACnC,2CAA2C;AAAA,EAC3C,sCAAsC;AAAA,EACtC,wCAAwC;AAAA,EACxC,sDAAsD;AAAA,EACtD,mDAAmD;AAAA,EACnD,oCAAoC;AAAA,EACpC,+CAA+C;AAAA,EAC/C,qDAAqD;AAAA,EACrD,wCAAwC;AAAA,EACxC,wCAAwC;AAAA,EACxC,2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;AAAA,EAClD,oCAAoC;AAAA,EACpC,6CAA6C;AAAA,IAC3C;AAAA,IACA;AAAA,MACE,UAAU;AAAA,MACV,cAAc;AAAA,MACd,cAAc;AAAA,MACd,sBAAsB;AAAA,MACtB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,oDAAoD;AAAA,IAClD;AAAA,IACA;AAAA,MACE,OAAO,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,SAAS,OAAO,iBAAiB,EAAE,CAAC;AAAA,MAClE,UAAU;AAAA,MACV,cAAc;AAAA,MACd,cAAc;AAAA,MACd,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,mCAAmC;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAAA,EACA,6CAA6C;AAAA,EAC7C,qCAAqC;AAAA,EACrC,yCAAyC;AAAA,EACzC,6DAA6D;AAAA,EAC7D,gBAAgB;AAAA,EAChB,qBAAqB;AACvB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eslint/javascript/config.ts"],"sourcesContent":["import type { EslintConfigObject, FunctionStyle } from \"../types.js\";\n\nimport { configNames } from \"../constants.js\";\nimport { baseEslintRules } from \"./rules.js\";\n\n/**\n * Creates a base ESLint configuration object with specified function style rules.\n *\n * @param functionStyle - Controls how functions should be written. Can be:\n * - \"off\": Disables function style enforcement\n * - \"arrow\": Enforces arrow function expressions\n * - \"declaration\": Enforces function declarations\n * - \"expression\": Enforces function expressions\n * @returns ESLint configuration object\n */\nexport const baseEslintConfig = (\n functionStyle: \"off\" | FunctionStyle,\n): EslintConfigObject => ({\n languageOptions: {\n ecmaVersion: 2022,\n },\n linterOptions: { reportUnusedDisableDirectives: true },\n name: configNames.base,\n rules: baseEslintRules(functionStyle),\n});\n"],"mappings":";;;;;;;;AAeO,IAAM,mBAAmB,CAC9B,mBACwB;AAAA,EACxB,iBAAiB;AAAA,IACf,aAAa;AAAA,EACf;AAAA,EACA,eAAe,EAAE,+BAA+B,KAAK;AAAA,EACrD,MAAM,YAAY;AAAA,EAClB,OAAO,gBAAgB,aAAa;AACtC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eslint/index.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { isString } from \"is-type-of\";\n\nimport type { FunctionStyle } from \"./types.js\";\n\nimport { ignoresConfig } from \"./ignores.js\";\nimport { baseEslintConfig } from \"./javascript/config.js\";\nimport { jsdocConfig } from \"./jsdoc/config.js\";\nimport { perfectionistConfig } from \"./perfectionist/config.js\";\nimport { preferArrowFunctionConfig } from \"./prefer-arrow-function/config.js\";\nimport { reactCompilerEslintConfig } from \"./react-compiler/config.js\";\nimport { reactEslintConfig } from \"./react/config.js\";\nimport { tseslintConfig } from \"./typescript/config.js\";\n\nexport type EslintConfigOptions = {\n functionStyle?: \"off\" | FunctionStyle;\n ignores?: string[];\n jsdoc?:\n | false\n | {\n requireJsdoc?: boolean;\n };\n sorting?: boolean;\n typescript?: boolean | string;\n} & (\n | {\n react: true;\n reactCompiler: boolean | undefined;\n }\n | {\n react?: boolean;\n }\n);\n\n/**\n * This function configures your ESLint config based on inputs. It accepts a configuration object with the following properties:\n *\n * @param options - The optional configuration object.\n * @param options.functionStyle - The function style to use. Defaults to \"arrow\".\n * @param options.ignores - An array of paths to ignore. Already excludes `node_modules` and `dist`.\n * @param options.jsdoc - Whether to include JSDoc rules. Defaults to true.\n * @param options.react - Whether to include React rules. Defaults to false.\n * @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.\n * @param options.typescript - Whether to include TypeScript rules OR a string with the path to your tsconfig. Defaults to true.\n * @param additionalConfigs - Additional ESLint config objects to be included in the final configuration.\n * @returns The ESLint configuration array.\n */\nexport const eslintConfig = (\n {\n functionStyle = \"arrow\",\n ignores = [],\n jsdoc = { requireJsdoc: false },\n react = false,\n sorting = true,\n typescript = true,\n ...options\n }: EslintConfigOptions = {},\n ...additionalConfigs: Linter.Config[]\n): Linter.Config[] => {\n const configs: Linter.Config[] = [\n ignoresConfig(ignores),\n baseEslintConfig(functionStyle),\n ];\n\n if (jsdoc !== false) {\n configs.push(jsdocConfig(jsdoc.requireJsdoc ?? false));\n }\n\n if (typescript) {\n configs.push(\n ...(tseslintConfig(\n isString(typescript) ? typescript : undefined,\n ) as Linter.Config[]),\n );\n }\n\n if (react) {\n configs.push(reactEslintConfig(functionStyle, Boolean(typescript)));\n\n // Default to true if not explicitly set to false\n if (!(\"reactCompiler\" in options) || options.reactCompiler !== false) {\n configs.push(reactCompilerEslintConfig);\n }\n }\n\n if (sorting) {\n configs.push(perfectionistConfig);\n }\n\n if (functionStyle === \"arrow\") {\n configs.push(preferArrowFunctionConfig());\n }\n\n // Add any additional config objects provided by the user\n if (additionalConfigs.length > 0) {\n configs.push(...additionalConfigs);\n }\n\n return configs;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,gBAAgB;AA8ClB,IAAM,eAAe,CAC1B;AAAA,EACE,gBAAgB;AAAA,EAChB,UAAU,CAAC;AAAA,EACX,QAAQ,EAAE,cAAc,MAAM;AAAA,EAC9B,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AAAA,EACb,GAAG;AACL,IAAyB,CAAC,MACvB,sBACiB;AACpB,QAAM,UAA2B;AAAA,IAC/B,cAAc,OAAO;AAAA,IACrB,iBAAiB,aAAa;AAAA,EAChC;AAEA,MAAI,UAAU,OAAO;AACnB,YAAQ,KAAK,YAAY,MAAM,gBAAgB,KAAK,CAAC;AAAA,EACvD;AAEA,MAAI,YAAY;AACd,YAAQ;AAAA,MACN,GAAI;AAAA,QACF,SAAS,UAAU,IAAI,aAAa;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO;AACT,YAAQ,KAAK,kBAAkB,eAAe,QAAQ,UAAU,CAAC,CAAC;AAGlE,QAAI,EAAE,mBAAmB,YAAY,QAAQ,kBAAkB,OAAO;AACpE,cAAQ,KAAK,yBAAyB;AAAA,IACxC;AAAA,EACF;AAEA,MAAI,SAAS;AACX,YAAQ,KAAK,mBAAmB;AAAA,EAClC;AAEA,MAAI,kBAAkB,SAAS;AAC7B,YAAQ,KAAK,0BAA0B,CAAC;AAAA,EAC1C;AAGA,MAAI,kBAAkB,SAAS,GAAG;AAChC,YAAQ,KAAK,GAAG,iBAAiB;AAAA,EACnC;AAEA,SAAO;AACT;","names":[]}
|
package/dist/chunk-M4HZ67BH.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
configNames
|
|
3
|
-
} from "./chunk-XXWXCIGZ.js";
|
|
4
|
-
|
|
5
|
-
// src/eslint/ignores.ts
|
|
6
|
-
var ignoresConfig = (userIgnores) => ({
|
|
7
|
-
ignores: ["**/node_modules/", "**/dist/", ".git/", ...userIgnores],
|
|
8
|
-
name: configNames.ignores
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
ignoresConfig
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-M4HZ67BH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eslint/ignores.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { configNames } from \"./constants.js\";\n\n/**\n * Creates an ESLint configuration for file and directory ignores.\n * By default, ignores node_modules, dist directories, and .git directories.\n *\n * @param userIgnores - Additional glob patterns to ignore in ESLint checks\n * @returns ESLint configuration object with ignore patterns\n */\nexport const ignoresConfig = (userIgnores: string[]): Linter.Config => ({\n ignores: [\"**/node_modules/\", \"**/dist/\", \".git/\", ...userIgnores],\n name: configNames.ignores,\n});\n"],"mappings":";;;;;AAWO,IAAM,gBAAgB,CAAC,iBAA0C;AAAA,EACtE,SAAS,CAAC,oBAAoB,YAAY,SAAS,GAAG,WAAW;AAAA,EACjE,MAAM,YAAY;AACpB;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|