js-style-kit 0.2.11 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -11
- package/dist/bin/index.js +12 -16
- package/dist/bin/index.js.map +1 -1
- package/dist/index.d.ts +130 -9
- package/dist/index.js +301 -83
- package/dist/index.js.map +1 -1
- package/package.json +19 -14
- package/dist/eslint/base/config.d.ts +0 -17
- package/dist/eslint/base/config.js +0 -457
- package/dist/eslint/base/config.js.map +0 -1
- package/dist/eslint/base/rules.d.ts +0 -18
- package/dist/eslint/base/rules.js +0 -425
- package/dist/eslint/base/rules.js.map +0 -1
- package/dist/eslint/base/types.d.ts +0 -21
- package/dist/eslint/base/types.js +0 -1
- package/dist/eslint/base/types.js.map +0 -1
- package/dist/eslint/constants.d.ts +0 -28
- package/dist/eslint/constants.js +0 -25
- package/dist/eslint/constants.js.map +0 -1
- package/dist/eslint/ignores.d.ts +0 -19
- package/dist/eslint/ignores.js +0 -42
- package/dist/eslint/ignores.js.map +0 -1
- package/dist/eslint/index.d.ts +0 -55
- package/dist/eslint/index.js +0 -1410
- package/dist/eslint/index.js.map +0 -1
- package/dist/eslint/jsdoc/config.d.ts +0 -14
- package/dist/eslint/jsdoc/config.js +0 -109
- package/dist/eslint/jsdoc/config.js.map +0 -1
- package/dist/eslint/jsdoc/rules.d.ts +0 -15
- package/dist/eslint/jsdoc/rules.js +0 -73
- package/dist/eslint/jsdoc/rules.js.map +0 -1
- package/dist/eslint/jsdoc/types.d.ts +0 -52
- package/dist/eslint/jsdoc/types.js +0 -1
- package/dist/eslint/jsdoc/types.js.map +0 -1
- package/dist/eslint/nextjs/config.d.ts +0 -12
- package/dist/eslint/nextjs/config.js +0 -62
- package/dist/eslint/nextjs/config.js.map +0 -1
- package/dist/eslint/nextjs/rules.d.ts +0 -8
- package/dist/eslint/nextjs/rules.js +0 -28
- package/dist/eslint/nextjs/rules.js.map +0 -1
- package/dist/eslint/nextjs/types.d.ts +0 -29
- package/dist/eslint/nextjs/types.js +0 -1
- package/dist/eslint/nextjs/types.js.map +0 -1
- package/dist/eslint/perfectionist/config.d.ts +0 -7
- package/dist/eslint/perfectionist/config.js +0 -65
- package/dist/eslint/perfectionist/config.js.map +0 -1
- package/dist/eslint/perfectionist/rules.d.ts +0 -12
- package/dist/eslint/perfectionist/rules.js +0 -31
- package/dist/eslint/perfectionist/rules.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/config.d.ts +0 -12
- package/dist/eslint/prefer-arrow-function/config.js +0 -45
- package/dist/eslint/prefer-arrow-function/config.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/types.d.ts +0 -17
- package/dist/eslint/prefer-arrow-function/types.js +0 -1
- package/dist/eslint/prefer-arrow-function/types.js.map +0 -1
- package/dist/eslint/react/config.d.ts +0 -18
- package/dist/eslint/react/config.js +0 -186
- package/dist/eslint/react/config.js.map +0 -1
- package/dist/eslint/react/rules.d.ts +0 -26
- package/dist/eslint/react/rules.js +0 -132
- package/dist/eslint/react/rules.js.map +0 -1
- package/dist/eslint/react-compiler/config.d.ts +0 -12
- package/dist/eslint/react-compiler/config.js +0 -39
- package/dist/eslint/react-compiler/config.js.map +0 -1
- package/dist/eslint/react-refresh/config.d.ts +0 -16
- package/dist/eslint/react-refresh/config.js +0 -55
- package/dist/eslint/react-refresh/config.js.map +0 -1
- package/dist/eslint/react-refresh/rules.d.ts +0 -38
- package/dist/eslint/react-refresh/rules.js +0 -19
- package/dist/eslint/react-refresh/rules.js.map +0 -1
- package/dist/eslint/storybook/config.d.ts +0 -13
- package/dist/eslint/storybook/config.js +0 -67
- package/dist/eslint/storybook/config.js.map +0 -1
- package/dist/eslint/testing/config.d.ts +0 -25
- package/dist/eslint/testing/config.js +0 -169
- package/dist/eslint/testing/config.js.map +0 -1
- package/dist/eslint/testing/jest-rules.d.ts +0 -14
- package/dist/eslint/testing/jest-rules.js +0 -44
- package/dist/eslint/testing/jest-rules.js.map +0 -1
- package/dist/eslint/testing/vitest-rules.d.ts +0 -14
- package/dist/eslint/testing/vitest-rules.js +0 -50
- package/dist/eslint/testing/vitest-rules.js.map +0 -1
- package/dist/eslint/turbo/config.d.ts +0 -12
- package/dist/eslint/turbo/config.js +0 -39
- package/dist/eslint/turbo/config.js.map +0 -1
- package/dist/eslint/turbo/types.d.ts +0 -11
- package/dist/eslint/turbo/types.js +0 -1
- package/dist/eslint/turbo/types.js.map +0 -1
- package/dist/eslint/types.d.ts +0 -11
- package/dist/eslint/types.js +0 -1
- package/dist/eslint/types.js.map +0 -1
- package/dist/eslint/typescript/config.d.ts +0 -11
- package/dist/eslint/typescript/config.js +0 -186
- package/dist/eslint/typescript/config.js.map +0 -1
- package/dist/eslint/typescript/rules.d.ts +0 -8
- package/dist/eslint/typescript/rules.js +0 -135
- package/dist/eslint/typescript/rules.js.map +0 -1
- package/dist/eslint/typescript/types.d.ts +0 -7
- package/dist/eslint/typescript/types.js +0 -1
- package/dist/eslint/typescript/types.js.map +0 -1
- package/dist/eslint/unicorn/config.d.ts +0 -11
- package/dist/eslint/unicorn/config.js +0 -113
- package/dist/eslint/unicorn/config.js.map +0 -1
- package/dist/eslint/unicorn/rules.d.ts +0 -8
- package/dist/eslint/unicorn/rules.js +0 -79
- package/dist/eslint/unicorn/rules.js.map +0 -1
- package/dist/modules.d.d.ts +0 -3
- package/dist/modules.d.js +0 -1
- package/dist/modules.d.js.map +0 -1
- package/dist/prettier/index.d.ts +0 -34
- package/dist/prettier/index.js +0 -132
- package/dist/prettier/index.js.map +0 -1
- package/dist/prettier/patch-tailwind-plugin.d.ts +0 -9
- package/dist/prettier/patch-tailwind-plugin.js +0 -72
- package/dist/prettier/patch-tailwind-plugin.js.map +0 -1
- package/dist/utils/is-type.d.ts +0 -44
- package/dist/utils/is-type.js +0 -28
- package/dist/utils/is-type.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
import { SortJsonOptions } from 'prettier-plugin-sort-json';
|
|
4
|
+
import { PluginOptions } from 'prettier-plugin-tailwindcss';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Debug names for ESLint configuration objects.
|
|
8
|
+
* These names help identify different configuration sections in ESLint's debug output
|
|
9
|
+
* and error messages, making it easier to track which rules come from which config.
|
|
10
|
+
*/
|
|
11
|
+
declare const configNames: {
|
|
12
|
+
readonly base: "base";
|
|
13
|
+
readonly disableTypeChecked: "typescript-eslint/disable-type-checked";
|
|
14
|
+
readonly ignores: "ignores";
|
|
15
|
+
readonly import: "import";
|
|
16
|
+
readonly jsdoc: "jsdoc";
|
|
17
|
+
readonly markdown: "markdown";
|
|
18
|
+
readonly nextjs: "nextjs";
|
|
19
|
+
readonly perfectionist: "perfectionist";
|
|
20
|
+
readonly preferArrowFunction: "prefer-arrow-function";
|
|
21
|
+
readonly react: "react";
|
|
22
|
+
readonly reactCompiler: "react-compiler";
|
|
23
|
+
readonly reactRefresh: "react-refresh";
|
|
24
|
+
readonly storybook: "storybook:stories";
|
|
25
|
+
readonly storybookConfig: "storybook:config";
|
|
26
|
+
readonly testing: "testing";
|
|
27
|
+
readonly turbo: "turbo";
|
|
28
|
+
readonly typescript: "tseslint";
|
|
29
|
+
readonly typescriptTesting: "tseslint-testing";
|
|
30
|
+
readonly unicorn: "unicorn";
|
|
31
|
+
};
|
|
32
|
+
type ConfigName = (typeof configNames)[keyof typeof configNames];
|
|
33
|
+
|
|
34
|
+
type EslintSeverity = 0 | 1 | 2 | "error" | "off" | "warn";
|
|
35
|
+
type EslintRuleConfig<TOptions = Record<string, unknown>, TOptions2 = Record<string, unknown>> = [EslintSeverity, string | TOptions | undefined] | [EslintSeverity, string | undefined, TOptions2 | undefined] | [EslintSeverity, TOptions | undefined, TOptions2 | undefined] | [EslintSeverity] | EslintSeverity;
|
|
36
|
+
type FunctionStyle = "arrow" | "declaration" | "expression";
|
|
37
|
+
interface EslintConfigObject<Rules extends Linter.RulesRecord = Linter.RulesRecord> extends Linter.Config<Rules> {
|
|
38
|
+
name: ConfigName;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface TestingConfig {
|
|
42
|
+
filenamePattern?: "spec" | "test";
|
|
43
|
+
files?: string[];
|
|
44
|
+
formattingRules?: boolean;
|
|
45
|
+
framework?: "bun" | "jest" | "node" | "vitest";
|
|
46
|
+
itOrTest?: "it" | "test";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface EslintConfigOptions {
|
|
50
|
+
functionStyle?: "off" | FunctionStyle;
|
|
51
|
+
ignores?: string[];
|
|
52
|
+
importPlugin?: boolean;
|
|
53
|
+
jsdoc?: false | {
|
|
54
|
+
requireJsdoc?: boolean;
|
|
55
|
+
};
|
|
56
|
+
react?: boolean | {
|
|
57
|
+
framework?: "next" | "none" | "vite";
|
|
58
|
+
reactCompiler?: boolean;
|
|
59
|
+
reactRefresh?: boolean;
|
|
60
|
+
};
|
|
61
|
+
rules?: Record<string, EslintRuleConfig>;
|
|
62
|
+
sorting?: boolean;
|
|
63
|
+
storybook?: boolean;
|
|
64
|
+
testing?: false | TestingConfig;
|
|
65
|
+
turbo?: boolean;
|
|
66
|
+
typescript?: boolean | string;
|
|
67
|
+
unicorn?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Configures ESLint based on provided options.
|
|
71
|
+
*
|
|
72
|
+
* @param options - The optional configuration object.
|
|
73
|
+
* @param options.functionStyle - The function style to enforce. Defaults to "arrow".
|
|
74
|
+
* @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `dist`.
|
|
75
|
+
* @param options.importPlugin - Whether to include the import plugin. Defaults to true.
|
|
76
|
+
* @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.
|
|
77
|
+
* @param options.react - Whether to include React rules. When true, reactCompiler is enabled by default.
|
|
78
|
+
* Can be configured with an object to control next.js support and reactCompiler.
|
|
79
|
+
* Also controls reactRefresh, which is enabled by default when react is true.
|
|
80
|
+
* Can specify framework as "next", "none", or "vite" to control related configs:
|
|
81
|
+
* - "next": Includes Next.js config, excludes React Refresh.
|
|
82
|
+
* - "vite" or "none": Includes React Refresh, excludes Next.js.
|
|
83
|
+
* - The reactRefresh property can override this framework-based behavior.
|
|
84
|
+
* @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.
|
|
85
|
+
* @param options.storybook - Whether to include Storybook rules. Defaults to false.
|
|
86
|
+
* @param options.testing - An object with the following properties:
|
|
87
|
+
* - `filenamePattern`: One of "spec" or "test" to determine which filename pattern to use.
|
|
88
|
+
* - `files`: Array of file patterns to include in the configuration.
|
|
89
|
+
* - `framework`: One of "vitest" or "jest" to determine which testing library to use.
|
|
90
|
+
* - `formattingRules`: Whether to include formatting rules like padding around blocks.
|
|
91
|
+
* - `itOrTest`: One of "it" or "test" to determine which test function to use.
|
|
92
|
+
* @param options.typescript - Whether to include TypeScript rules. Can be a boolean or a string with path to tsconfig.
|
|
93
|
+
* @param options.turbo - Whether to include Turborepo rules. Defaults to false.
|
|
94
|
+
* @param options.unicorn - Whether to include Unicorn rules. Defaults to true.
|
|
95
|
+
* @param options.rules - This is for rules that you need to alter or turn off.
|
|
96
|
+
* @param additionalConfigs - Additional ESLint config objects to be merged into the final configuration.
|
|
97
|
+
* @returns An array of ESLint configuration objects.
|
|
98
|
+
*/
|
|
99
|
+
declare const eslintConfig: ({ functionStyle, ignores, importPlugin, jsdoc, react, rules, sorting, storybook, testing, turbo, typescript, unicorn, }?: EslintConfigOptions, ...additionalConfigs: Linter.Config[]) => Linter.Config[];
|
|
100
|
+
|
|
101
|
+
interface PrettierConfigOptions extends Config {
|
|
102
|
+
cssOrderPlugin?: boolean;
|
|
103
|
+
curlyPlugin?: boolean;
|
|
104
|
+
jsonSortPlugin?: boolean | SortJsonOptions;
|
|
105
|
+
packageJsonPlugin?: boolean;
|
|
106
|
+
tailwindPlugin?: boolean | string | PluginOptions;
|
|
107
|
+
}
|
|
108
|
+
interface PrettierConfigWithPlugins extends Config, SortJsonOptions, PluginOptions {
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a Prettier configuration object with optional Tailwind support
|
|
112
|
+
*
|
|
113
|
+
* @param options - Configuration options for Prettier
|
|
114
|
+
* @param options.cssOrderPlugin CSS order sorting support
|
|
115
|
+
* @param options.curlyPlugin Enforce curly braces for all control statements
|
|
116
|
+
* @param options.jsonSortPlugin JSON sorting support
|
|
117
|
+
* @param options.packageJsonPlugin Package.json sorting support
|
|
118
|
+
* @param options.tailwindPlugin Tailwind CSS formatting support
|
|
119
|
+
* @returns Prettier configuration object with:
|
|
120
|
+
* - Default Prettier configuration
|
|
121
|
+
* - Experimental ternaries enabled
|
|
122
|
+
* - CSS order plugin
|
|
123
|
+
* - Curly braces plugin
|
|
124
|
+
* - JSON sorting plugin
|
|
125
|
+
* - Package.json sorting plugin
|
|
126
|
+
* - Optional Tailwind plugin and functions
|
|
127
|
+
*/
|
|
128
|
+
declare const prettierConfig: (options?: PrettierConfigOptions) => PrettierConfigWithPlugins;
|
|
129
|
+
|
|
130
|
+
export { type EslintConfigObject, type EslintConfigOptions, type EslintRuleConfig, type EslintSeverity, type FunctionStyle, type PrettierConfigOptions, type PrettierConfigWithPlugins, eslintConfig, prettierConfig };
|