eslint-plugin-flawless 0.1.12 → 1.1.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 CHANGED
@@ -198,21 +198,24 @@ pnpm eslint-docs
198
198
  💭
199
199
  Requires [type information](https://typescript-eslint.io/linting/typed-linting).
200
200
 
201
- | Name                            | Description | 🔧 | 💭 |
202
- | :-------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- | :-- | :-- |
203
- | [arrow-return-style](src/rules/arrow-return-style/documentation.md) | Enforce arrow function return style based on line length | 🔧 | |
204
- | [jsx-shorthand-boolean](src/rules/jsx-shorthand-boolean/documentation.md) | Disallow shorthand boolean JSX attributes | 🔧 | |
205
- | [jsx-shorthand-fragment](src/rules/jsx-shorthand-fragment/documentation.md) | Enforce a consistent fragment form: the shorthand `<>...</>` or a named fragment | 🔧 | |
206
- | [naming-convention](src/rules/naming-convention/documentation.md) | Enforce naming conventions for everything across a codebase | | 💭 |
207
- | [no-export-default-arrow](src/rules/no-export-default-arrow/documentation.md) | Disallow anonymous arrow functions as export default declarations | 🔧 | |
208
- | [no-unnecessary-use-callback](src/rules/no-unnecessary-use-callback/documentation.md) | Disallow unnecessary usage of 'useCallback' | | |
209
- | [no-unnecessary-use-memo](src/rules/no-unnecessary-use-memo/documentation.md) | Disallow unnecessary usage of 'useMemo' | | |
210
- | [prefer-destructuring-assignment](src/rules/prefer-destructuring-assignment/documentation.md) | Enforce destructuring assignment for component props | 🔧 | |
211
- | [prefer-parameter-destructuring](src/rules/prefer-parameter-destructuring/documentation.md) | Enforce destructuring parameters in the function signature | 🔧 | |
212
- | [prefer-read-only-props](src/rules/prefer-read-only-props/documentation.md) | Enforce that function component props are read-only | 🔧 | 💭 |
213
- | [purity](src/rules/purity/documentation.md) | Disallow impure calls such as `math.random` or `os.clock` during render | | |
214
- | [toml-sort-keys](src/rules/toml-sort-keys/documentation.md) | Enforce a configured sort order for TOML keys and tables | 🔧 | |
215
- | [yaml-block-key-blank-lines](src/rules/yaml-block-key-blank-lines/documentation.md) | Enforce blank lines around top-level YAML block collection keys | 🔧 | |
201
+ | Name                            | Description | 🔧 | 💭 |
202
+ | :-------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- | :-- | :-- |
203
+ | [arrow-return-style](src/rules/arrow-return-style/documentation.md) | Enforce arrow function return style based on line length | 🔧 | |
204
+ | [jsx-shorthand-boolean](src/rules/jsx-shorthand-boolean/documentation.md) | Disallow shorthand boolean JSX attributes | 🔧 | |
205
+ | [jsx-shorthand-fragment](src/rules/jsx-shorthand-fragment/documentation.md) | Enforce a consistent fragment form: the shorthand `<>...</>` or a named fragment | 🔧 | |
206
+ | [max-lines-per-function](src/rules/max-lines-per-function/documentation.md) | Enforce a maximum number of lines of code in a function | | |
207
+ | [naming-convention](src/rules/naming-convention/documentation.md) | Enforce naming conventions for everything across a codebase | | 💭 |
208
+ | [no-export-default-arrow](src/rules/no-export-default-arrow/documentation.md) | Disallow anonymous arrow functions as export default declarations | 🔧 | |
209
+ | [no-redundant-tsconfig-options](src/rules/no-redundant-tsconfig-options/documentation.md) | Disallow tsconfig options that redundantly re-set a value already provided by an extended config | 🔧 | |
210
+ | [no-unnecessary-use-callback](src/rules/no-unnecessary-use-callback/documentation.md) | Disallow unnecessary usage of 'useCallback' | | |
211
+ | [no-unnecessary-use-memo](src/rules/no-unnecessary-use-memo/documentation.md) | Disallow unnecessary usage of 'useMemo' | | |
212
+ | [padding-after-expect-assertions](src/rules/padding-after-expect-assertions/documentation.md) | Enforce a blank line after `expect.assertions` and `expect.hasAssertions` | 🔧 | |
213
+ | [prefer-destructuring-assignment](src/rules/prefer-destructuring-assignment/documentation.md) | Enforce destructuring assignment for component props | 🔧 | |
214
+ | [prefer-parameter-destructuring](src/rules/prefer-parameter-destructuring/documentation.md) | Enforce destructuring parameters in the function signature | 🔧 | |
215
+ | [prefer-read-only-props](src/rules/prefer-read-only-props/documentation.md) | Enforce that function component props are read-only | 🔧 | 💭 |
216
+ | [purity](src/rules/purity/documentation.md) | Disallow impure calls such as `math.random` or `os.clock` during render | | |
217
+ | [toml-sort-keys](src/rules/toml-sort-keys/documentation.md) | Enforce a configured sort order for TOML keys and tables | 🔧 | |
218
+ | [yaml-block-key-blank-lines](src/rules/yaml-block-key-blank-lines/documentation.md) | Enforce blank lines around top-level YAML block collection keys | 🔧 | |
216
219
 
217
220
  <!-- end auto-generated rules list -->
218
221
 
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 {
@@ -50,7 +51,7 @@ declare const EXPLICIT = "useExplicitReturn";
50
51
  declare const COMPLEX_EXPLICIT = "useExplicitReturnComplex";
51
52
  type MessageIds$4 = typeof COMPLEX_EXPLICIT | typeof EXPLICIT | typeof IMPLICIT;
52
53
  type ObjectReturnStyle = "always-explicit" | "complex-explicit" | "off";
53
- type Options$5 = [{
54
+ type Options$6 = [{
54
55
  /** Always use explicit returns for JSX bodies. */
55
56
  jsxAlwaysUseExplicitReturn?: boolean;
56
57
  /** Maximum emitted line length (tab-expanded) before requiring an explicit return. */
@@ -85,9 +86,41 @@ interface JsxShorthandFragmentOptions {
85
86
  */
86
87
  readonly mode?: Mode;
87
88
  }
88
- type Options$4 = [JsxShorthandFragmentOptions?];
89
+ type Options$5 = [JsxShorthandFragmentOptions?];
89
90
  type Mode = "element" | "syntax";
90
91
  //#endregion
92
+ //#region src/rules/max-lines-per-function/rule.d.ts
93
+ /** Where a function's counted range begins. */
94
+ type CountFrom = "body" | "function";
95
+ interface MaxLinesPerFunctionOptions {
96
+ /**
97
+ * Where the counted range begins. `"body"` (the default) counts from the
98
+ * line holding the body's opening brace through the line holding its closing
99
+ * brace, so lines spent purely on the signature — destructured parameters, a
100
+ * long parameter list, multi-line generics or return types, decorators — do
101
+ * not count against `max`. Note the opening-brace line is still counted, and
102
+ * it is usually also the last line of the signature (`): void {`), so exactly
103
+ * one signature line always remains in the total. `"function"` counts the
104
+ * whole function node instead, matching ESLint core.
105
+ */
106
+ readonly countFrom?: CountFrom;
107
+ /**
108
+ * Whether immediately-invoked function expressions are measured. Off by
109
+ * default, matching ESLint core.
110
+ */
111
+ readonly IIFEs?: boolean;
112
+ /** The maximum number of lines a function may span. */
113
+ readonly max?: number;
114
+ /** Whether lines containing only whitespace are excluded from the count. */
115
+ readonly skipBlankLines?: boolean;
116
+ /**
117
+ * Whether lines consisting solely of a comment are excluded from the count.
118
+ * A comment trailing real code does not make its line skippable.
119
+ */
120
+ readonly skipComments?: boolean;
121
+ }
122
+ type Options$4 = [MaxLinesPerFunctionOptions?];
123
+ //#endregion
91
124
  //#region src/rules/naming-convention/utils/enums.d.ts
92
125
  declare const Selector: {
93
126
  readonly variable: 1;
@@ -175,6 +208,22 @@ interface MatchRegex {
175
208
  match: boolean;
176
209
  regex: string;
177
210
  }
211
+ /**
212
+ * Object-form entry in a selector's `types` array. At least one of `name` or
213
+ * `returns` must be present (enforced by the rule schema).
214
+ */
215
+ interface TypeReference {
216
+ /** Symbol name the value's type must resolve to. */
217
+ name?: string;
218
+ /** Module specifier the matched symbol must be declared in. */
219
+ from?: string;
220
+ /**
221
+ * Matches callable types by return type: at least one call signature's
222
+ * return type must satisfy this nested matcher.
223
+ */
224
+ returns?: TypeReference;
225
+ }
226
+ type TypeMatcher = TypeModifierString | TypeReference;
178
227
  interface NamingSelector {
179
228
  custom?: MatchRegex;
180
229
  filter?: MatchRegex | string;
@@ -191,7 +240,7 @@ interface NamingSelector {
191
240
  selector: Array<IndividualAndMetaSelectorsString> | IndividualAndMetaSelectorsString;
192
241
  suffix?: Array<string>;
193
242
  trailingUnderscore?: UnderscoreOptionString;
194
- types?: Array<TypeModifierString>;
243
+ types?: Array<TypeMatcher>;
195
244
  }
196
245
  //#endregion
197
246
  //#region src/rules/naming-convention/rule.d.ts
@@ -250,15 +299,20 @@ declare const plugin: {
250
299
  version: string;
251
300
  };
252
301
  rules: {
253
- "arrow-return-style": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<TSESLint.SourceCode>>;
302
+ "arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<TSESLint.SourceCode>>;
254
303
  "jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<TSESLint.SourceCode>>;
255
- "jsx-shorthand-fragment": FlawlessRuleModule<Options$4, MessageIds$3, Readonly<TSESLint.SourceCode>>;
304
+ "jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<TSESLint.SourceCode>>;
305
+ "max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<TSESLint.SourceCode>>;
256
306
  "naming-convention": TSESLint.RuleModule<MessageIds$2, Options$3, PluginDocumentation, TSESLint.RuleListener> & {
257
307
  name: string;
258
308
  };
259
309
  "no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<TSESLint.SourceCode>>;
310
+ "no-redundant-tsconfig-options": TSESLint.RuleModule<"redundant", [], PluginDocumentation, TSESLint.RuleListener> & {
311
+ name: string;
312
+ };
260
313
  "no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<TSESLint.SourceCode>>;
261
314
  "no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<TSESLint.SourceCode>>;
315
+ "padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<TSESLint.SourceCode>>;
262
316
  "prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<TSESLint.SourceCode>>;
263
317
  "prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<TSESLint.SourceCode>>;
264
318
  "prefer-read-only-props": TSESLint.RuleModule<"preferReadOnlyProps", [{
@@ -289,15 +343,20 @@ declare const _default: {
289
343
  version: string;
290
344
  };
291
345
  rules: {
292
- "arrow-return-style": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
346
+ "arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
293
347
  "jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
294
- "jsx-shorthand-fragment": FlawlessRuleModule<Options$4, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
348
+ "jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
349
+ "max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
295
350
  "naming-convention": import("${configDir}").RuleModule<MessageIds$2, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
296
351
  name: string;
297
352
  };
298
353
  "no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
354
+ "no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
355
+ name: string;
356
+ };
299
357
  "no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
300
358
  "no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
359
+ "padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
301
360
  "prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
302
361
  "prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
303
362
  "prefer-read-only-props": import("${configDir}").RuleModule<"preferReadOnlyProps", [{
@@ -325,15 +384,20 @@ declare const _default: {
325
384
  version: string;
326
385
  };
327
386
  rules: {
328
- "arrow-return-style": FlawlessRuleModule<Options$5, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
387
+ "arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
329
388
  "jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
330
- "jsx-shorthand-fragment": FlawlessRuleModule<Options$4, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
389
+ "jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
390
+ "max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
331
391
  "naming-convention": import("${configDir}").RuleModule<MessageIds$2, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
332
392
  name: string;
333
393
  };
334
394
  "no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
395
+ "no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
396
+ name: string;
397
+ };
335
398
  "no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
336
399
  "no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
400
+ "padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
337
401
  "prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
338
402
  "prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
339
403
  "prefer-read-only-props": import("${configDir}").RuleModule<"preferReadOnlyProps", [{
@@ -356,4 +420,4 @@ type RuleOptions = { [K in keyof RuleDefinitions]: NonNullable<RuleDefinitions[K
356
420
  type Rules = { [K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]>; };
357
421
  type RuleDefinitions = typeof plugin.rules;
358
422
  //#endregion
359
- export { RuleOptions, Rules, _default as default };
423
+ export { RuleOptions, Rules, type TypeMatcher, type TypeReference, _default as default };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as PLUGIN_NAME } from "./plugin-DYVtpuio.mjs";
1
+ import { n as plugin, t as PLUGIN_NAME } from "./plugin-B-YWsemf.mjs";
2
2
  //#region src/configs/index.ts
3
3
  const configs = { recommended: {
4
4
  plugins: { [PLUGIN_NAME]: plugin },
package/dist/oxlint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as PLUGIN_NAME } from "./plugin-DYVtpuio.mjs";
1
+ import { n as plugin, t as PLUGIN_NAME } from "./plugin-B-YWsemf.mjs";
2
2
  import { definePlugin } from "@oxlint/plugins";
3
3
  //#region src/oxlint.ts
4
4
  /**