eslint-plugin-flawless 1.0.0 → 1.2.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 +1 -0
- package/dist/index.d.mts +53 -27
- package/dist/index.mjs +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{plugin-DFLOyhkl.mjs → plugin-K2GOCG3Z.mjs} +895 -185
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -214,6 +214,7 @@ Requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
|
214
214
|
| [prefer-parameter-destructuring](src/rules/prefer-parameter-destructuring/documentation.md) | Enforce destructuring parameters in the function signature | 🔧 | |
|
|
215
215
|
| [prefer-read-only-props](src/rules/prefer-read-only-props/documentation.md) | Enforce that function component props are read-only | 🔧 | 💭 |
|
|
216
216
|
| [purity](src/rules/purity/documentation.md) | Disallow impure calls such as `math.random` or `os.clock` during render | | |
|
|
217
|
+
| [react-namespace](src/rules/react-namespace/documentation.md) | Prefer named imports for React runtime values and the React namespace for React types | 🔧 | |
|
|
217
218
|
| [toml-sort-keys](src/rules/toml-sort-keys/documentation.md) | Enforce a configured sort order for TOML keys and tables | 🔧 | |
|
|
218
219
|
| [yaml-block-key-blank-lines](src/rules/yaml-block-key-blank-lines/documentation.md) | Enforce blank lines around top-level YAML block collection keys | 🔧 | |
|
|
219
220
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
import ts9 from "typescript";
|
|
2
3
|
import { Linter } from "eslint";
|
|
3
4
|
//#region src/util.d.ts
|
|
4
5
|
interface PluginDocumentation {
|
|
@@ -48,7 +49,7 @@ type FlawlessRuleModule<Options extends ReadonlyArray<unknown>, MessageIds exten
|
|
|
48
49
|
declare const IMPLICIT = "useImplicitReturn";
|
|
49
50
|
declare const EXPLICIT = "useExplicitReturn";
|
|
50
51
|
declare const COMPLEX_EXPLICIT = "useExplicitReturnComplex";
|
|
51
|
-
type MessageIds$
|
|
52
|
+
type MessageIds$5 = typeof COMPLEX_EXPLICIT | typeof EXPLICIT | typeof IMPLICIT;
|
|
52
53
|
type ObjectReturnStyle = "always-explicit" | "complex-explicit" | "off";
|
|
53
54
|
type Options$6 = [{
|
|
54
55
|
/** Always use explicit returns for JSX bodies. */
|
|
@@ -72,7 +73,7 @@ type Options$6 = [{
|
|
|
72
73
|
//#region src/rules/jsx-shorthand-fragment/rule.d.ts
|
|
73
74
|
declare const MESSAGE_ID_NAMED = "useNamedFragment";
|
|
74
75
|
declare const MESSAGE_ID_SHORTHAND = "useShorthandFragment";
|
|
75
|
-
type MessageIds$
|
|
76
|
+
type MessageIds$4 = typeof MESSAGE_ID_NAMED | typeof MESSAGE_ID_SHORTHAND;
|
|
76
77
|
interface JsxShorthandFragmentOptions {
|
|
77
78
|
/**
|
|
78
79
|
* The identifier used for the named fragment element in `"element"` mode
|
|
@@ -172,6 +173,7 @@ declare const Modifier: {
|
|
|
172
173
|
readonly async: 16384;
|
|
173
174
|
readonly default: 32768;
|
|
174
175
|
readonly namespace: 65536;
|
|
176
|
+
readonly constAsserted: 131072;
|
|
175
177
|
};
|
|
176
178
|
type ModifierString = keyof typeof Modifier;
|
|
177
179
|
declare const PredefinedFormat: {
|
|
@@ -184,11 +186,11 @@ declare const PredefinedFormat: {
|
|
|
184
186
|
};
|
|
185
187
|
type PredefinedFormatString = keyof typeof PredefinedFormat;
|
|
186
188
|
declare const TypeModifier: {
|
|
187
|
-
readonly boolean:
|
|
188
|
-
readonly string:
|
|
189
|
-
readonly number:
|
|
190
|
-
readonly function:
|
|
191
|
-
readonly array:
|
|
189
|
+
readonly boolean: 262144;
|
|
190
|
+
readonly string: 524288;
|
|
191
|
+
readonly number: 1048576;
|
|
192
|
+
readonly function: 2097152;
|
|
193
|
+
readonly array: 4194304;
|
|
192
194
|
};
|
|
193
195
|
type TypeModifierString = keyof typeof TypeModifier;
|
|
194
196
|
declare const UnderscoreOption: {
|
|
@@ -207,6 +209,22 @@ interface MatchRegex {
|
|
|
207
209
|
match: boolean;
|
|
208
210
|
regex: string;
|
|
209
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Object-form entry in a selector's `types` array. At least one of `name` or
|
|
214
|
+
* `returns` must be present (enforced by the rule schema).
|
|
215
|
+
*/
|
|
216
|
+
interface TypeReference {
|
|
217
|
+
/** Symbol name the value's type must resolve to. */
|
|
218
|
+
name?: string;
|
|
219
|
+
/** Module specifier the matched symbol must be declared in. */
|
|
220
|
+
from?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Matches callable types by return type: at least one call signature's
|
|
223
|
+
* return type must satisfy this nested matcher.
|
|
224
|
+
*/
|
|
225
|
+
returns?: TypeReference;
|
|
226
|
+
}
|
|
227
|
+
type TypeMatcher = TypeModifierString | TypeReference;
|
|
210
228
|
interface NamingSelector {
|
|
211
229
|
custom?: MatchRegex;
|
|
212
230
|
filter?: MatchRegex | string;
|
|
@@ -223,22 +241,22 @@ interface NamingSelector {
|
|
|
223
241
|
selector: Array<IndividualAndMetaSelectorsString> | IndividualAndMetaSelectorsString;
|
|
224
242
|
suffix?: Array<string>;
|
|
225
243
|
trailingUnderscore?: UnderscoreOptionString;
|
|
226
|
-
types?: Array<
|
|
244
|
+
types?: Array<TypeMatcher>;
|
|
227
245
|
}
|
|
228
246
|
//#endregion
|
|
229
247
|
//#region src/rules/naming-convention/rule.d.ts
|
|
230
|
-
type MessageIds$
|
|
248
|
+
type MessageIds$3 = "doesNotMatchFormat" | "doesNotMatchFormatForeignContract" | "doesNotMatchFormatTrimmed" | "doesNotMatchFormatTrimmedForeignContract" | "missingAffix" | "missingAffixForeignContract" | "missingUnderscore" | "missingUnderscoreForeignContract" | "satisfyCustom" | "satisfyCustomForeignContract" | "unexpectedUnderscore" | "unexpectedUnderscoreForeignContract";
|
|
231
249
|
type Options$3 = Array<NamingSelector>;
|
|
232
250
|
//#endregion
|
|
233
251
|
//#region src/rules/no-unnecessary-use-callback/rule.d.ts
|
|
234
252
|
declare const MESSAGE_ID_DEFAULT$1 = "default";
|
|
235
253
|
declare const MESSAGE_ID_INSIDE_USE_EFFECT$1 = "noUnnecessaryUseCallbackInsideUseEffect";
|
|
236
|
-
type MessageIds$
|
|
254
|
+
type MessageIds$2 = typeof MESSAGE_ID_DEFAULT$1 | typeof MESSAGE_ID_INSIDE_USE_EFFECT$1;
|
|
237
255
|
//#endregion
|
|
238
256
|
//#region src/rules/no-unnecessary-use-memo/rule.d.ts
|
|
239
257
|
declare const MESSAGE_ID_DEFAULT = "default";
|
|
240
258
|
declare const MESSAGE_ID_INSIDE_USE_EFFECT = "noUnnecessaryUseMemoInsideUseEffect";
|
|
241
|
-
type MessageIds = typeof MESSAGE_ID_DEFAULT | typeof MESSAGE_ID_INSIDE_USE_EFFECT;
|
|
259
|
+
type MessageIds$1 = typeof MESSAGE_ID_DEFAULT | typeof MESSAGE_ID_INSIDE_USE_EFFECT;
|
|
242
260
|
//#endregion
|
|
243
261
|
//#region src/rules/prefer-parameter-destructuring/rule.d.ts
|
|
244
262
|
type Options$2 = [{
|
|
@@ -262,6 +280,11 @@ interface PurityOptions {
|
|
|
262
280
|
}
|
|
263
281
|
type Options$1 = [PurityOptions?];
|
|
264
282
|
//#endregion
|
|
283
|
+
//#region src/rules/react-namespace/rule.d.ts
|
|
284
|
+
declare const MESSAGE_ID_RUNTIME = "runtimeNamespace";
|
|
285
|
+
declare const MESSAGE_ID_TYPE = "typeNamedImport";
|
|
286
|
+
type MessageIds = typeof MESSAGE_ID_RUNTIME | typeof MESSAGE_ID_TYPE;
|
|
287
|
+
//#endregion
|
|
265
288
|
//#region src/rules/toml-sort-keys/rule.d.ts
|
|
266
289
|
type Options = Array<SortSpec>;
|
|
267
290
|
interface SortOrderObject {
|
|
@@ -282,19 +305,19 @@ declare const plugin: {
|
|
|
282
305
|
version: string;
|
|
283
306
|
};
|
|
284
307
|
rules: {
|
|
285
|
-
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$
|
|
308
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$5, Readonly<TSESLint.SourceCode>>;
|
|
286
309
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<TSESLint.SourceCode>>;
|
|
287
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$
|
|
310
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<TSESLint.SourceCode>>;
|
|
288
311
|
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<TSESLint.SourceCode>>;
|
|
289
|
-
"naming-convention": TSESLint.RuleModule<MessageIds$
|
|
312
|
+
"naming-convention": TSESLint.RuleModule<MessageIds$3, Options$3, PluginDocumentation, TSESLint.RuleListener> & {
|
|
290
313
|
name: string;
|
|
291
314
|
};
|
|
292
315
|
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<TSESLint.SourceCode>>;
|
|
293
316
|
"no-redundant-tsconfig-options": TSESLint.RuleModule<"redundant", [], PluginDocumentation, TSESLint.RuleListener> & {
|
|
294
317
|
name: string;
|
|
295
318
|
};
|
|
296
|
-
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$
|
|
297
|
-
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<TSESLint.SourceCode>>;
|
|
319
|
+
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$2, Readonly<TSESLint.SourceCode>>;
|
|
320
|
+
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds$1, Readonly<TSESLint.SourceCode>>;
|
|
298
321
|
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<TSESLint.SourceCode>>;
|
|
299
322
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<TSESLint.SourceCode>>;
|
|
300
323
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<TSESLint.SourceCode>>;
|
|
@@ -306,6 +329,7 @@ declare const plugin: {
|
|
|
306
329
|
name: string;
|
|
307
330
|
};
|
|
308
331
|
purity: FlawlessRuleModule<Options$1, "impureCall", Readonly<TSESLint.SourceCode>>;
|
|
332
|
+
"react-namespace": FlawlessRuleModule<[], MessageIds, Readonly<TSESLint.SourceCode>>;
|
|
309
333
|
"toml-sort-keys": TSESLint.RuleModule<"unsorted", Options, PluginDocumentation, TSESLint.RuleListener> & {
|
|
310
334
|
name: string;
|
|
311
335
|
};
|
|
@@ -326,19 +350,19 @@ declare const _default: {
|
|
|
326
350
|
version: string;
|
|
327
351
|
};
|
|
328
352
|
rules: {
|
|
329
|
-
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$
|
|
353
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$5, Readonly<import("${configDir}").SourceCode>>;
|
|
330
354
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
|
|
331
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$
|
|
355
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
|
|
332
356
|
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
|
|
333
|
-
"naming-convention": import("${configDir}").RuleModule<MessageIds$
|
|
357
|
+
"naming-convention": import("${configDir}").RuleModule<MessageIds$3, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
334
358
|
name: string;
|
|
335
359
|
};
|
|
336
360
|
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
|
|
337
361
|
"no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
338
362
|
name: string;
|
|
339
363
|
};
|
|
340
|
-
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$
|
|
341
|
-
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
364
|
+
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$2, Readonly<import("${configDir}").SourceCode>>;
|
|
365
|
+
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
|
|
342
366
|
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
|
|
343
367
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
|
|
344
368
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
|
|
@@ -350,6 +374,7 @@ declare const _default: {
|
|
|
350
374
|
name: string;
|
|
351
375
|
};
|
|
352
376
|
purity: FlawlessRuleModule<Options$1, "impureCall", Readonly<import("${configDir}").SourceCode>>;
|
|
377
|
+
"react-namespace": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
353
378
|
"toml-sort-keys": import("${configDir}").RuleModule<"unsorted", Options, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
354
379
|
name: string;
|
|
355
380
|
};
|
|
@@ -367,19 +392,19 @@ declare const _default: {
|
|
|
367
392
|
version: string;
|
|
368
393
|
};
|
|
369
394
|
rules: {
|
|
370
|
-
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$
|
|
395
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$5, Readonly<import("${configDir}").SourceCode>>;
|
|
371
396
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
|
|
372
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$
|
|
397
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
|
|
373
398
|
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
|
|
374
|
-
"naming-convention": import("${configDir}").RuleModule<MessageIds$
|
|
399
|
+
"naming-convention": import("${configDir}").RuleModule<MessageIds$3, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
375
400
|
name: string;
|
|
376
401
|
};
|
|
377
402
|
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
|
|
378
403
|
"no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
379
404
|
name: string;
|
|
380
405
|
};
|
|
381
|
-
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$
|
|
382
|
-
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
406
|
+
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$2, Readonly<import("${configDir}").SourceCode>>;
|
|
407
|
+
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
|
|
383
408
|
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
|
|
384
409
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
|
|
385
410
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
|
|
@@ -391,6 +416,7 @@ declare const _default: {
|
|
|
391
416
|
name: string;
|
|
392
417
|
};
|
|
393
418
|
purity: FlawlessRuleModule<Options$1, "impureCall", Readonly<import("${configDir}").SourceCode>>;
|
|
419
|
+
"react-namespace": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
394
420
|
"toml-sort-keys": import("${configDir}").RuleModule<"unsorted", Options, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
395
421
|
name: string;
|
|
396
422
|
};
|
|
@@ -403,4 +429,4 @@ type RuleOptions = { [K in keyof RuleDefinitions]: NonNullable<RuleDefinitions[K
|
|
|
403
429
|
type Rules = { [K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]>; };
|
|
404
430
|
type RuleDefinitions = typeof plugin.rules;
|
|
405
431
|
//#endregion
|
|
406
|
-
export { RuleOptions, Rules, _default as default };
|
|
432
|
+
export { RuleOptions, Rules, type TypeMatcher, type TypeReference, _default as default };
|
package/dist/index.mjs
CHANGED
package/dist/oxlint.mjs
CHANGED