@mlaursen/eslint-config 12.0.6 → 12.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,14 +1,295 @@
1
- import { base } from "./base.js";
2
- import { jsxA11y } from "./jsxA11y.js";
3
- import { react } from "./react.js";
4
- import { recommended } from "./recommended.js";
5
- import { recommendedFrontend } from "./recommendedFrontend.js";
6
- import { scripts } from "./scripts.js";
7
- import { testingLibraryDom, testingLibraryReact } from "./testing-library.js";
8
- import { jest, jestDom, testing, vitest } from "./testing.js";
9
- import { typescript } from "./typescript.js";
10
- import { unicorn } from "./unicorn.js";
11
- export * from "./constants.js";
1
+ import { Linter } from 'eslint';
2
+ import reactRefreshPlugin from 'eslint-plugin-react-refresh';
3
+
4
+ /**
5
+ * @example
6
+ * ```js
7
+ * import { configs } from "@mlaursen/eslint-config";
8
+ * import { defineConfig } from "eslint/config";
9
+ *
10
+ * export default defineConfig(configs.base);
11
+ * ```
12
+ */
13
+ declare const base: Linter.Config[];
14
+
15
+ /**
16
+ * @example
17
+ * ```ts
18
+ * import { configs } from "@mlaursen/eslint-config";
19
+ * import { defineConfig } from "eslint/config";
20
+ *
21
+ * export default defineConfig(configs.jsxA11y);
22
+ * ```
23
+ */
24
+ declare const jsxA11y: Linter.Config[];
25
+
26
+ type ReactRefreshConfig = keyof typeof reactRefreshPlugin.configs;
27
+ interface ReactOptions {
28
+ /**
29
+ * Set to one of the `eslint-plugin-react-refresh` config names to enable.
30
+ *
31
+ * @example Vite
32
+ * ```js
33
+ * configs.react({
34
+ * reactRefresh: "vite",
35
+ * })
36
+ * ```
37
+ *
38
+ * @example Next.js
39
+ * ```js
40
+ * configs.react({
41
+ * reactRefresh: "next",
42
+ * })
43
+ * ```
44
+ *
45
+ * @example Recommended
46
+ * ```js
47
+ * configs.react({
48
+ * reactRefresh: "recommended",
49
+ * })
50
+ * ```
51
+ */
52
+ reactRefresh?: ReactRefreshConfig;
53
+ /**
54
+ * Set to `true` to enable the react compiler eslint rules.
55
+ *
56
+ * @defaultValue `false`
57
+ */
58
+ reactCompiler?: boolean;
59
+ }
60
+ /**
61
+ * @example
62
+ * ```ts
63
+ * import { configs } from "@mlaursen/eslint-config";
64
+ * import { defineConfig } from "eslint/config";
65
+ *
66
+ * export default defineConfig(configs.react());
67
+ *
68
+ * // or with react compiler rules enabled
69
+ * export default defineConfig(configs.react(true));
70
+ * ```
71
+ *
72
+ * Enables:
73
+ * - `eslint-plugin-react` with:
74
+ * - flat.recommended
75
+ * - flat['jsx-runtime']
76
+ * - `eslint-plugin-react-hooks` with:
77
+ * - recommended rules
78
+ * - compiler rules (if `true` is provided)
79
+ */
80
+ declare const react: (options?: ReactOptions) => Linter.Config[];
81
+
82
+ type TestFramework = "jest" | "vitest";
83
+ interface TestOptions {
84
+ /**
85
+ * @defaultValue `"vitest"`
86
+ */
87
+ testFramework?: TestFramework;
88
+ }
89
+ /**
90
+ * @example
91
+ * ```ts
92
+ * import { configs } from "@mlaursen/eslint-config";
93
+ * import { defineConfig } from "eslint/config";
94
+ *
95
+ * export default defineConfig(configs.vitest);
96
+ * ```
97
+ */
98
+ declare const vitest: Linter.Config[];
99
+ /**
100
+ * @example
101
+ * ```ts
102
+ * import { configs } from "@mlaursen/eslint-config";
103
+ * import { defineConfig } from "eslint/config";
104
+ *
105
+ * export default defineConfig(configs.jest);
106
+ * ```
107
+ */
108
+ declare const jest: Linter.Config[];
109
+ /**
110
+ * @example
111
+ * ```ts
112
+ * import { configs } from "@mlaursen/eslint-config";
113
+ * import { defineConfig } from "eslint/config";
114
+ *
115
+ * export default defineConfig([
116
+ * ...configs.jest,
117
+ * ...configs.jestDom,
118
+ * ]);
119
+ * ```
120
+ */
121
+ declare const jestDom: Linter.Config[];
122
+ /**
123
+ * @example
124
+ * ```ts
125
+ * import { configs } from "@mlaursen/eslint-config";
126
+ * import { defineConfig } from "eslint/config";
127
+ *
128
+ * export default defineConfig(configs.testing({ testFramework: "jest" }));
129
+ *
130
+ * // or
131
+ * export default defineConfig(configs.testing({ testFramework: "vitest" }));
132
+ * ```
133
+ */
134
+ declare const testing: (options?: TestOptions) => Linter.Config[];
135
+
136
+ interface TypescriptOptions {
137
+ /**
138
+ * This is required when working in monorepos or when the
139
+ * {@link strictTypeChecked} rules are enabled.
140
+ *
141
+ * @example
142
+ * ```js
143
+ * configs.recommended({
144
+ * tsconfigRootDir: import.meta.dirname,
145
+ * })
146
+ * ```
147
+ */
148
+ tsconfigRootDir?: string;
149
+ /**
150
+ * The {@link tsconfigRootDir} must be set if this is `true`.
151
+ *
152
+ * @example
153
+ * ```js
154
+ * configs.recommended({
155
+ * tsconfigRootDir: import.meta.dirname,
156
+ * strictTypeChecked: process.env.STRICT_TYPING === "true",
157
+ * })
158
+ *
159
+ * @defaultValue `false`
160
+ */
161
+ strictTypeChecked?: boolean;
162
+ }
163
+ /**
164
+ * @example
165
+ * ```ts
166
+ * import { configs, gitignore } from "@mlaursen/eslint-config";
167
+ * import { defineConfig } from "eslint/config";
168
+ *
169
+ * export default defineConfig([
170
+ * gitignore(import.meta.url),
171
+ * ...configs.typescript(),
172
+ * ]);
173
+ * ```
174
+ */
175
+ declare const typescript: (options?: TypescriptOptions) => Linter.Config[];
176
+
177
+ interface RecommendedOptions extends TypescriptOptions, TestOptions {
178
+ }
179
+ /**
180
+ * @example
181
+ * ```ts
182
+ * import { configs, gitignore } from "@mlaursen/eslint-config";
183
+ * import { defineConfig } from "eslint/config";
184
+ *
185
+ * export default defineConfig([
186
+ * gitignore(import.meta.url),
187
+ * ...configs.recommended(),
188
+ * ]);
189
+ * ```
190
+ */
191
+ declare const recommended: (options?: RecommendedOptions) => readonly Linter.Config[];
192
+
193
+ interface RecommendedFrontendOptions extends RecommendedOptions, ReactOptions {
194
+ }
195
+ /**
196
+ * @example
197
+ * ```ts
198
+ * import { configs, gitignore } from "@mlaursen/eslint-config";
199
+ * import { defineConfig } from "eslint/config";
200
+ *
201
+ * export default defineConfig([
202
+ * gitignore(import.meta.url),
203
+ * ...configs.recommendedFrontend(),
204
+ * ]);
205
+ * ```
206
+ */
207
+ declare const recommendedFrontend: (options?: RecommendedFrontendOptions) => readonly Linter.Config[];
208
+
209
+ /**
210
+ * @example
211
+ * ```ts
212
+ * import { configs } from "@mlaursen/eslint-config";
213
+ * import { defineConfig } from "eslint/config";
214
+ *
215
+ * export default defineConfig(configs.scripts);
216
+ * ```
217
+ */
218
+ declare const scripts: Linter.Config[];
219
+
220
+ /**
221
+ * @example
222
+ * ```ts
223
+ * import { configs } from "@mlaursen/eslint-config";
224
+ * import { defineConfig } from "eslint/config";
225
+ *
226
+ * export default defineConfig([
227
+ * ...configs.react,
228
+ * ...configs.jest,
229
+ * ...configs.jestDom,
230
+ * ...configs.testingLibraryReact
231
+ * ]);
232
+ * ```
233
+ *
234
+ * NOTE: Only choose this or the {@link testingLibraryDom}. Do not use
235
+ * both.
236
+ */
237
+ declare const testingLibraryReact: Linter.Config[];
238
+ /**
239
+ * @example
240
+ * ```ts
241
+ * import { configs, defineConfig } from "@mlaursen/eslint-config";
242
+ *
243
+ * export default defineConfig([
244
+ * ...configs.jest,
245
+ * ...configs.jestDom,
246
+ * ...configs.testingLibraryDom
247
+ * ]);
248
+ * ```
249
+ *
250
+ * NOTE: Only choose this or the {@link testingLibraryReact}. Do not use
251
+ * both.
252
+ */
253
+ declare const testingLibraryDom: Linter.Config[];
254
+
255
+ declare const unicorn: Linter.Config[];
256
+
257
+ declare const DEV_WARNING_PROD_ERROR: string;
258
+ /**
259
+ * This is a "temporary" workaround until autofixable rules can be disabled with
260
+ * a config option because of the "autofix + format(+ save)?" behavior. It
261
+ * should be something closer to `DEV_WARN_PROD_ERROR_AND_FIX`
262
+ */
263
+ declare const DEV_OFF_PROD_ERROR: string;
264
+ declare const BASE_NAME = "@mlaursen/eslint-config";
265
+ declare const TS_FILES: string[];
266
+ declare const TEST_FILES: string[];
267
+ declare const JSX_FILES: string[];
268
+ declare const VITE_MAIN_FILES: string[];
269
+
270
+ /**
271
+ * @example
272
+ * ```ts
273
+ * import { configs, gitignore } from "@mlaursen/eslint-config";
274
+ * import { defineConfig } from "eslint/config";
275
+ *
276
+ * export default defineConfig([gitignore(import.meta.url), ...configs.typescript]);
277
+ * ```
278
+ *
279
+ * @example .gitignore in a different folder
280
+ * ```ts
281
+ * import { configs, gitignore } from "@mlaursen/eslint-config";
282
+ * import { defineConfig } from "eslint/config";
283
+ * import { join } from "node:path";
284
+ *
285
+ * export default defineConfig([
286
+ * gitignore(join(import.meta.url, "..", "..")),
287
+ * ...configs.typescript,
288
+ * ]);
289
+ * ```
290
+ */
291
+ declare function gitignore(importMetaUrl: string): Linter.Config;
292
+
12
293
  interface EslintConfigs {
13
294
  recommended: typeof recommended;
14
295
  recommendedFrontend: typeof recommendedFrontend;
@@ -25,5 +306,7 @@ interface EslintConfigs {
25
306
  unicorn: typeof unicorn;
26
307
  vitest: typeof vitest;
27
308
  }
28
- export declare const configs: Readonly<EslintConfigs>;
29
- export { gitignore } from "./gitignore.js";
309
+ declare const configs: Readonly<EslintConfigs>;
310
+
311
+ export { BASE_NAME, DEV_OFF_PROD_ERROR, DEV_WARNING_PROD_ERROR, JSX_FILES, TEST_FILES, TS_FILES, VITE_MAIN_FILES, configs, gitignore };
312
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../types/base.d.ts","../types/jsxA11y.d.ts","../types/react.d.ts","../types/testing.d.ts","../types/typescript.d.ts","../types/recommended.d.ts","../types/recommendedFrontend.d.ts","../types/scripts.d.ts","../types/testing-library.d.ts","../types/unicorn.d.ts","../types/constants.d.ts","../types/gitignore.d.ts","../types/index.d.ts"],"mappings":";;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,IAAI,EAAE,MAAM,CAAC,MAAM;;ACTjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO,EAAE,MAAM,CAAC,MAAM;;ACRpC,KAAK,kBAAkB,gBAAgB,kBAAkB,CAAC,OAAO;AACjE,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK,aAAa,YAAY,KAAK,MAAM,CAAC,MAAM;;ACvD9D,KAAK,aAAa;AAClB,UAAU,WAAW;AACrB;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM,EAAE,MAAM,CAAC,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,IAAI,EAAE,MAAM,CAAC,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO,EAAE,MAAM,CAAC,MAAM;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO,aAAa,WAAW,KAAK,MAAM,CAAC,MAAM;;ACpD/D,UAAU,iBAAiB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU,aAAa,iBAAiB,KAAK,MAAM,CAAC,MAAM;;ACrCxE,UAAU,kBAAkB,SAAS,iBAAiB,EAAE,WAAW;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAO;AAC3B,mBAAmB,MAAM;AACzB;AACA,cAAc,OAAO,EAAE,QAAQ,CAAC,aAAa;;;;","names":[]}