@heyq02/rslint-config 0.0.1 → 0.0.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import type { ESLintPlugin } from '@rslint/core';
2
+ /** Cast community ESLint plugin objects into Rslint's `ESLintPlugin` shape. */
3
+ export declare function asESLintPlugin(plugin: unknown): ESLintPlugin;
@@ -0,0 +1,30 @@
1
+ import type { Options, ResolvableConfig, TypeScriptOptions, TypedFlatConfig } from './types.js';
2
+ /** Ignore common files and include JavaScript support. */
3
+ export declare const presetJavaScript: () => TypedFlatConfig[];
4
+ /** Includes `presetJavaScript` and TypeScript support. */
5
+ export declare const presetBasic: (typescriptOptions?: true | TypeScriptOptions) => TypedFlatConfig[];
6
+ /**
7
+ * Full opinionated preset:
8
+ * - JS + TS
9
+ * - Unicorn / import / node / promise
10
+ * - React / Jest / Rstest when detected
11
+ * - Special-case overrides
12
+ */
13
+ export declare const presetAll: () => TypedFlatConfig[];
14
+ /**
15
+ * `@heyq02`'s opinionated Rslint config preset.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // rslint.config.ts
20
+ * import { heyq02 } from '@heyq02/rslint-config'
21
+ *
22
+ * export default heyq02({
23
+ * typescript: { typeChecked: true, strict: true },
24
+ * react: true,
25
+ * })
26
+ * ```
27
+ */
28
+ export declare function heyq02(options?: Options, ...userConfigs: ResolvableConfig[]): TypedFlatConfig[];
29
+ /** Alias of {@link heyq02}. */
30
+ export declare const rslintConfig: typeof heyq02;
@@ -0,0 +1,197 @@
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
+ /**
31
+ * `import/order` group names (Rslint / eslint-plugin-import).
32
+ * Closest enforceable equivalent of Oxfmt perfectionist selectors.
33
+ */
34
+ export type SortImportsGroup = 'builtin' | 'external' | 'internal' | 'unknown' | 'parent' | 'sibling' | 'index' | 'object' | 'type';
35
+ /**
36
+ * Oxfmt-like custom group → mapped to `import/order` `pathGroups`.
37
+ *
38
+ * @see https://oxc.rs/docs/guide/usage/formatter/sorting.html
39
+ */
40
+ export interface SortImportsCustomGroup {
41
+ /**
42
+ * Display / documentation name (Oxfmt `groupName`).
43
+ * Not a first-class `import/order` group — attach via {@link group}.
44
+ */
45
+ groupName?: string;
46
+ /**
47
+ * Glob patterns matched against the import source (Oxfmt `elementNamePattern`).
48
+ */
49
+ elementNamePattern: string | string[];
50
+ /**
51
+ * Target `import/order` group to attach to.
52
+ * @default 'external'
53
+ */
54
+ group?: SortImportsGroup;
55
+ /**
56
+ * Position relative to {@link group}.
57
+ * @default 'before'
58
+ */
59
+ position?: 'before' | 'after';
60
+ }
61
+ /**
62
+ * Import sorting options, shaped like Oxfmt `sortImports` and implemented via
63
+ * Rslint `import/order`.
64
+ *
65
+ * Unsupported Oxfmt knobs (no-op / not exposed): per-group `{ newlinesBetween }`,
66
+ * `partitionByComment`, `partitionByNewline`, perfectionist modifier-selectors
67
+ * (`value-builtin`, `type-import`, …).
68
+ *
69
+ * @see https://oxc.rs/docs/guide/usage/formatter/sorting.html
70
+ */
71
+ export interface SortImportsOptions {
72
+ /**
73
+ * Relative order of import groups.
74
+ * @default `['type', ['builtin', 'external'], 'internal', ['parent', 'sibling', 'index'], 'unknown']`
75
+ */
76
+ groups?: (SortImportsGroup | SortImportsGroup[])[];
77
+ /**
78
+ * Insert a blank line between groups.
79
+ * Maps to `newlines-between: 'always' | 'never'`.
80
+ * @default true
81
+ */
82
+ newlinesBetween?: boolean;
83
+ /**
84
+ * Custom path-based groups (Oxfmt `customGroups` → `pathGroups`).
85
+ */
86
+ customGroups?: SortImportsCustomGroup[];
87
+ /**
88
+ * Prefixes treated as internal imports (Oxfmt `internalPattern`).
89
+ * Converted to `settings['import/internal-regex']`.
90
+ * @default `['~/', '@/', '#']`
91
+ */
92
+ internalPattern?: string[];
93
+ /**
94
+ * Alphabetical order within each group.
95
+ * @default 'asc'
96
+ */
97
+ order?: 'asc' | 'desc';
98
+ /**
99
+ * Case-insensitive alphabetical sort.
100
+ * @default true
101
+ */
102
+ ignoreCase?: boolean;
103
+ /**
104
+ * Sort named import / export members.
105
+ * @default true
106
+ */
107
+ named?: boolean;
108
+ /**
109
+ * Whether side-effect imports participate in ordering
110
+ * (`warnOnUnassignedImports`).
111
+ * @default false
112
+ */
113
+ sortSideEffects?: boolean;
114
+ }
115
+ export interface Options {
116
+ /**
117
+ * Global ignore patterns. Merged with the built-in excludes.
118
+ */
119
+ ignores?: string[];
120
+ /**
121
+ * JavaScript support. @default true
122
+ */
123
+ javascript?: boolean;
124
+ /**
125
+ * TypeScript support. Auto-enabled when `typescript` is installed.
126
+ * Pass an object for type-checked / strict / stylistic controls.
127
+ * @default auto
128
+ */
129
+ typescript?: boolean | TypeScriptOptions;
130
+ /**
131
+ * Unicorn rules. @default true
132
+ */
133
+ unicorn?: boolean;
134
+ /**
135
+ * Import rules. @default true
136
+ */
137
+ imports?: boolean;
138
+ /**
139
+ * Sort imports via `import/order`, with an Oxfmt-like options surface.
140
+ * Enabled by default when {@link imports} is on.
141
+ * Set `false` if Oxfmt `sortImports` already owns ordering.
142
+ * @default true
143
+ */
144
+ sortImports?: boolean | SortImportsOptions;
145
+ /**
146
+ * Node.js rules.
147
+ * - `true` / `'module'` — ESM-oriented Node rules (default)
148
+ * - `'script'` — CommonJS-oriented
149
+ * - `'mixed'` — upstream mixed recommended preset
150
+ * @default true
151
+ */
152
+ node?: NodePreset;
153
+ /**
154
+ * Promise rules. @default true
155
+ */
156
+ promise?: boolean;
157
+ /**
158
+ * React + React Hooks. Auto-enabled when React is detected.
159
+ * @default auto
160
+ */
161
+ react?: boolean;
162
+ /**
163
+ * JSX accessibility rules. Auto-enabled with React when unset.
164
+ * @default auto with react
165
+ */
166
+ jsxA11y?: boolean;
167
+ /**
168
+ * Jest rules. Auto-enabled when `jest` is detected.
169
+ * @default auto
170
+ */
171
+ jest?: boolean;
172
+ /**
173
+ * Rstest rules. Auto-enabled when `rstest` / `@rstest/core` is detected.
174
+ * @default auto
175
+ */
176
+ rstest?: boolean;
177
+ /**
178
+ * Autofix unused imports (`eslint-plugin-unused-imports`).
179
+ * @default true
180
+ */
181
+ unusedImports?: boolean;
182
+ /**
183
+ * RegExp rules (`eslint-plugin-regexp`).
184
+ * @default true
185
+ */
186
+ regexp?: boolean;
187
+ /**
188
+ * De Morgan rewrites (`eslint-plugin-de-morgan`).
189
+ * @default true
190
+ */
191
+ deMorgan?: boolean;
192
+ /**
193
+ * `eslint-disable` hygiene (`@eslint-community/eslint-plugin-eslint-comments`).
194
+ * @default true
195
+ */
196
+ eslintComments?: boolean;
197
+ }
@@ -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.3-beta.1",
4
4
  "description": "Opinionated Rslint flat-config preset.",
5
5
  "keywords": [
6
6
  "flat-config",
@@ -23,19 +23,36 @@
23
23
  "dist"
24
24
  ],
25
25
  "type": "module",
26
+ "sideEffects": false,
27
+ "types": "./dist/index.d.ts",
26
28
  "exports": {
27
- ".": "./dist/index.mjs",
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ },
28
33
  "./package.json": "./package.json"
29
34
  },
30
35
  "publishConfig": {
31
36
  "access": "public"
32
37
  },
38
+ "dependencies": {
39
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
40
+ "eslint-plugin-de-morgan": "^2.2.0",
41
+ "eslint-plugin-regexp": "^3.3.1",
42
+ "eslint-plugin-unused-imports": "^4.4.1",
43
+ "local-pkg": "^1.2.1"
44
+ },
33
45
  "devDependencies": {
46
+ "@arethetypeswrong/cli": "^0.18.5",
47
+ "@heyq02/rslib-config": "^1.0.1",
48
+ "@rslib/core": "^1.0.3",
34
49
  "@rslint/core": "^0.9.4",
35
50
  "@types/node": "^26.1.1",
51
+ "automd": "^0.4.3",
36
52
  "bumpp": "^11.1.0",
53
+ "publint": "^0.3.25",
37
54
  "typescript": "^7.0.2",
38
- "vite-plus": "1.0.0"
55
+ "vite-plus": "^1.1.0"
39
56
  },
40
57
  "peerDependencies": {
41
58
  "@rslint/core": "^0.9.0"
@@ -47,15 +64,23 @@
47
64
  "onFail": "download"
48
65
  }
49
66
  },
67
+ "engines": {
68
+ "node": "^20.19.0 || >=22.12.0"
69
+ },
50
70
  "scripts": {
51
- "build": "vp pack",
52
- "dev": "vp pack --watch",
53
- "test": "echo Skip",
54
- "check": "vp check",
71
+ "build": "rslib",
72
+ "dev": "rslib --watch",
73
+ "test": "vp test",
55
74
  "lint": "rslint .",
56
75
  "lint:fix": "rslint --fix .",
57
- "format": "vp fmt",
58
- "typecheck": "vp check --no-fmt --no-lint",
76
+ "automd": "automd",
77
+ "format": "pnpm automd && vp fmt",
78
+ "format:check": "vp fmt --check",
79
+ "typecheck": "tsc --noEmit",
80
+ "check": "pnpm run format:check && pnpm run lint && pnpm run typecheck",
81
+ "publint": "publint",
82
+ "attw": "pnpm pack && attw heyq02-rslint-config-*.tgz --profile esm-only && rm -f heyq02-rslint-config-*.tgz",
83
+ "check:package": "pnpm run build && pnpm run publint && pnpm run attw",
59
84
  "release": "bumpp"
60
85
  }
61
86
  }
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 };