@heyq02/rslint-config 0.0.1 → 0.0.2

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.
@@ -0,0 +1,85 @@
1
+ import type { RslintConfig, RslintConfigEntry } from '@rslint/core';
2
+ export type { RslintConfig, RslintConfigEntry };
3
+ export type TypedFlatConfig = RslintConfigEntry;
4
+ export type ResolvableConfig = TypedFlatConfig | TypedFlatConfig[] | RslintConfig | false | null | undefined;
5
+ export type TypeScriptPreset = 'recommended' | 'recommendedTypeChecked' | 'strict' | 'strictTypeChecked';
6
+ export interface TypeScriptOptions {
7
+ /**
8
+ * Enable type-aware TypeScript rules.
9
+ * When true, uses `*TypeChecked` presets and enables `projectService` by default.
10
+ * @default false
11
+ */
12
+ typeChecked?: boolean;
13
+ /**
14
+ * Use TypeScript strict presets instead of recommended.
15
+ * @default false
16
+ */
17
+ strict?: boolean;
18
+ /**
19
+ * Layer TypeScript stylistic rules after the baseline.
20
+ * @default true
21
+ */
22
+ stylistic?: boolean;
23
+ /**
24
+ * Enable automatic TypeScript project discovery for type-aware rules.
25
+ * Defaults to `true` when `typeChecked` is enabled.
26
+ */
27
+ projectService?: boolean;
28
+ }
29
+ export type NodePreset = boolean | 'module' | 'script' | 'mixed';
30
+ export interface Options {
31
+ /**
32
+ * Global ignore patterns. Merged with the built-in excludes.
33
+ */
34
+ ignores?: string[];
35
+ /**
36
+ * JavaScript support. @default true
37
+ */
38
+ javascript?: boolean;
39
+ /**
40
+ * TypeScript support. Auto-enabled when `typescript` is installed.
41
+ * Pass an object for type-checked / strict / stylistic controls.
42
+ * @default auto
43
+ */
44
+ typescript?: boolean | TypeScriptOptions;
45
+ /**
46
+ * Unicorn rules. @default true
47
+ */
48
+ unicorn?: boolean;
49
+ /**
50
+ * Import rules. @default true
51
+ */
52
+ imports?: boolean;
53
+ /**
54
+ * Node.js rules.
55
+ * - `true` / `'module'` — ESM-oriented Node rules (default)
56
+ * - `'script'` — CommonJS-oriented
57
+ * - `'mixed'` — upstream mixed recommended preset
58
+ * @default true
59
+ */
60
+ node?: NodePreset;
61
+ /**
62
+ * Promise rules. @default true
63
+ */
64
+ promise?: boolean;
65
+ /**
66
+ * React + React Hooks. Auto-enabled when React is detected.
67
+ * @default auto
68
+ */
69
+ react?: boolean;
70
+ /**
71
+ * JSX accessibility rules. Auto-enabled with React when unset.
72
+ * @default auto with react
73
+ */
74
+ jsxA11y?: boolean;
75
+ /**
76
+ * Jest rules. Auto-enabled when `jest` is detected.
77
+ * @default auto
78
+ */
79
+ jest?: boolean;
80
+ /**
81
+ * Rstest rules. Auto-enabled when `rstest` / `@rstest/core` is detected.
82
+ * @default auto
83
+ */
84
+ rstest?: boolean;
85
+ }
@@ -0,0 +1,4 @@
1
+ import type { ResolvableConfig, TypedFlatConfig } from './types.js';
2
+ /** Flatten nested config values into a single entry list. */
3
+ export declare function flattenConfigs(...configs: ResolvableConfig[]): TypedFlatConfig[];
4
+ export declare function toArray<T>(value: T | T[]): T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyq02/rslint-config",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Opinionated Rslint flat-config preset.",
5
5
  "keywords": [
6
6
  "flat-config",
@@ -24,21 +24,31 @@
24
24
  ],
25
25
  "type": "module",
26
26
  "exports": {
27
- ".": "./dist/index.mjs",
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
28
31
  "./package.json": "./package.json"
29
32
  },
33
+ "types": "./dist/index.d.ts",
34
+ "sideEffects": false,
30
35
  "publishConfig": {
31
36
  "access": "public"
32
37
  },
38
+ "peerDependencies": {
39
+ "@rslint/core": "^0.9.0"
40
+ },
33
41
  "devDependencies": {
42
+ "@heyq02/rslib-config": "^1.0.1",
43
+ "@rslib/core": "^1.0.3",
34
44
  "@rslint/core": "^0.9.4",
35
45
  "@types/node": "^26.1.1",
36
46
  "bumpp": "^11.1.0",
37
- "typescript": "^7.0.2",
38
- "vite-plus": "1.0.0"
47
+ "prettier": "^3.9.6",
48
+ "typescript": "^7.0.2"
39
49
  },
40
- "peerDependencies": {
41
- "@rslint/core": "^0.9.0"
50
+ "engines": {
51
+ "node": "^20.19.0 || >=22.12.0"
42
52
  },
43
53
  "devEngines": {
44
54
  "packageManager": {
@@ -48,14 +58,13 @@
48
58
  }
49
59
  },
50
60
  "scripts": {
51
- "build": "vp pack",
52
- "dev": "vp pack --watch",
61
+ "build": "rslib",
62
+ "dev": "rslib --watch",
53
63
  "test": "echo Skip",
54
- "check": "vp check",
55
64
  "lint": "rslint .",
56
65
  "lint:fix": "rslint --fix .",
57
- "format": "vp fmt",
58
- "typecheck": "vp check --no-fmt --no-lint",
66
+ "format": "prettier --write .",
67
+ "typecheck": "tsc --noEmit",
59
68
  "release": "bumpp"
60
69
  }
61
70
  }
package/dist/index.d.mts DELETED
@@ -1,183 +0,0 @@
1
- import { RslintConfig, RslintConfigEntry } from "@rslint/core";
2
- //#region src/types.d.ts
3
- export type TypedFlatConfig = RslintConfigEntry;
4
- export type ResolvableConfig = TypedFlatConfig | TypedFlatConfig[] | RslintConfig | false | null | undefined;
5
- export type TypeScriptPreset = "recommended" | "recommendedTypeChecked" | "strict" | "strictTypeChecked";
6
- export interface TypeScriptOptions {
7
- /**
8
- * Enable type-aware TypeScript rules.
9
- * When true, uses `*TypeChecked` presets and enables `projectService` by default.
10
- * @default false
11
- */
12
- typeChecked?: boolean;
13
- /**
14
- * Use TypeScript strict presets instead of recommended.
15
- * @default false
16
- */
17
- strict?: boolean;
18
- /**
19
- * Layer TypeScript stylistic rules after the baseline.
20
- * @default true
21
- */
22
- stylistic?: boolean;
23
- /**
24
- * Enable automatic TypeScript project discovery for type-aware rules.
25
- * Defaults to `true` when `typeChecked` is enabled.
26
- */
27
- projectService?: boolean;
28
- }
29
- export type NodePreset = boolean | "module" | "script" | "mixed";
30
- export interface Options {
31
- /**
32
- * Global ignore patterns. Merged with the built-in excludes.
33
- */
34
- ignores?: string[];
35
- /**
36
- * JavaScript support. @default true
37
- */
38
- javascript?: boolean;
39
- /**
40
- * TypeScript support. Auto-enabled when `typescript` is installed.
41
- * Pass an object for type-checked / strict / stylistic controls.
42
- * @default auto
43
- */
44
- typescript?: boolean | TypeScriptOptions;
45
- /**
46
- * Unicorn rules. @default true
47
- */
48
- unicorn?: boolean;
49
- /**
50
- * Import rules. @default true
51
- */
52
- imports?: boolean;
53
- /**
54
- * Node.js rules.
55
- * - `true` / `'module'` — ESM-oriented Node rules (default)
56
- * - `'script'` — CommonJS-oriented
57
- * - `'mixed'` — upstream mixed recommended preset
58
- * @default true
59
- */
60
- node?: NodePreset;
61
- /**
62
- * Promise rules. @default true
63
- */
64
- promise?: boolean;
65
- /**
66
- * React + React Hooks. Auto-enabled when React is detected.
67
- * @default auto
68
- */
69
- react?: boolean;
70
- /**
71
- * JSX accessibility rules. Auto-enabled with React when unset.
72
- * @default auto with react
73
- */
74
- jsxA11y?: boolean;
75
- /**
76
- * Jest rules. Auto-enabled when `jest` is detected.
77
- * @default auto
78
- */
79
- jest?: boolean;
80
- /**
81
- * Rstest rules. Auto-enabled when `rstest` / `@rstest/core` is detected.
82
- * @default auto
83
- */
84
- rstest?: boolean;
85
- }
86
- //#endregion
87
- //#region src/configs/ignores.d.ts
88
- export declare const ignores: (extra?: string[]) => TypedFlatConfig[];
89
- //#endregion
90
- //#region src/configs/imports.d.ts
91
- export declare const imports: (options?: {
92
- typescript?: boolean;
93
- }) => TypedFlatConfig[];
94
- //#endregion
95
- //#region src/configs/javascript.d.ts
96
- export declare const restrictedSyntaxJs: string[];
97
- export declare const javascript: () => TypedFlatConfig[];
98
- //#endregion
99
- //#region src/configs/jest.d.ts
100
- export declare const jest: () => TypedFlatConfig[];
101
- //#endregion
102
- //#region src/configs/node.d.ts
103
- export declare const node: (preset?: Exclude<NodePreset, false>) => TypedFlatConfig[];
104
- //#endregion
105
- //#region src/configs/promise.d.ts
106
- export declare const promise: () => TypedFlatConfig[];
107
- //#endregion
108
- //#region src/configs/react.d.ts
109
- export declare const jsxA11y: () => TypedFlatConfig[];
110
- export declare const react: (options?: {
111
- jsxA11y?: boolean;
112
- }) => TypedFlatConfig[];
113
- //#endregion
114
- //#region src/configs/rstest.d.ts
115
- export declare const rstest: () => TypedFlatConfig[];
116
- //#endregion
117
- //#region src/configs/special-cases.d.ts
118
- export declare const specialCases: () => TypedFlatConfig[];
119
- //#endregion
120
- //#region src/configs/typescript.d.ts
121
- export declare const typescript: (options?: true | TypeScriptOptions) => TypedFlatConfig[];
122
- //#endregion
123
- //#region src/configs/unicorn.d.ts
124
- export declare const unicorn: () => TypedFlatConfig[];
125
- //#endregion
126
- //#region src/env.d.ts
127
- export declare const hasTypeScript: () => boolean;
128
- export declare const hasReact: () => boolean;
129
- export declare const hasJest: () => boolean;
130
- export declare const hasRstest: () => boolean;
131
- export declare function isInEditorEnv(): boolean;
132
- export declare function isInGitHooksOrLintStaged(): boolean;
133
- //#endregion
134
- //#region src/globs.d.ts
135
- export declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
136
- export declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
137
- export declare const GLOB_JS = "**/*.?([cm])js";
138
- export declare const GLOB_JSX = "**/*.jsx";
139
- export declare const GLOB_TS = "**/*.?([cm])ts";
140
- export declare const GLOB_TSX = "**/*.tsx";
141
- export declare const GLOB_TESTS: readonly ["**/__tests__/**/*.?([cm])[jt]s?(x)", "**/*.spec.?([cm])[jt]s?(x)", "**/*.test.?([cm])[jt]s?(x)", "**/*.bench.?([cm])[jt]s?(x)", "**/*.benchmark.?([cm])[jt]s?(x)"];
142
- export declare const GLOB_NODE_MODULES: "**/node_modules";
143
- export declare const GLOB_DIST: "**/dist";
144
- export declare const GLOB_LOCKFILE: string[];
145
- export declare const GLOB_EXCLUDE: string[];
146
- //#endregion
147
- //#region src/presets.d.ts
148
- /** Ignore common files and include JavaScript support. */
149
- export declare const presetJavaScript: () => TypedFlatConfig[];
150
- /** Includes `presetJavaScript` and TypeScript support. */
151
- export declare const presetBasic: (typescriptOptions?: true | TypeScriptOptions) => TypedFlatConfig[];
152
- /**
153
- * Full opinionated preset:
154
- * - JS + TS
155
- * - Unicorn / import / node / promise
156
- * - React / Jest / Rstest when detected
157
- * - Special-case overrides
158
- */
159
- export declare const presetAll: () => TypedFlatConfig[];
160
- /**
161
- * `@heyq02`'s opinionated Rslint config preset.
162
- *
163
- * @example
164
- * ```ts
165
- * // rslint.config.ts
166
- * import { heyq02 } from '@heyq02/rslint-config'
167
- *
168
- * export default heyq02({
169
- * typescript: { typeChecked: true, strict: true },
170
- * react: true,
171
- * })
172
- * ```
173
- */
174
- export declare function heyq02(options?: Options, ...userConfigs: ResolvableConfig[]): TypedFlatConfig[];
175
- /** Alias of {@link heyq02}. */
176
- export declare const rslintConfig: typeof heyq02;
177
- //#endregion
178
- //#region src/utils.d.ts
179
- /** Flatten nested config values into a single entry list. */
180
- export declare function flattenConfigs(...configs: ResolvableConfig[]): TypedFlatConfig[];
181
- export declare function toArray<T>(value: T | T[]): T[];
182
- //#endregion
183
- export type { RslintConfig, RslintConfigEntry };