eslint-plugin-flawless 0.1.11 → 1.0.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 +18 -13
- package/dist/index.d.mts +82 -4
- package/dist/index.mjs +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{plugin-BvQt8gSt.mjs → plugin-DFLOyhkl.mjs} +1497 -32
- package/dist/rules/arrow-return-style/worker.d.mts +25 -0
- package/dist/rules/arrow-return-style/worker.mjs +90 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -198,19 +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
|
-
| [
|
|
204
|
-
| [jsx-shorthand-
|
|
205
|
-
| [
|
|
206
|
-
| [
|
|
207
|
-
| [
|
|
208
|
-
| [
|
|
209
|
-
| [
|
|
210
|
-
| [
|
|
211
|
-
| [
|
|
212
|
-
| [
|
|
213
|
-
| [
|
|
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 | 🔧 | |
|
|
214
219
|
|
|
215
220
|
<!-- end auto-generated rules list -->
|
|
216
221
|
|
package/dist/index.d.mts
CHANGED
|
@@ -44,6 +44,31 @@ type FlawlessRuleModule<Options extends ReadonlyArray<unknown>, MessageIds exten
|
|
|
44
44
|
createOnce: (context: RuleContextWithSourceCode<MessageIds, Options, SourceCode>) => FlawlessRuleListener;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region src/rules/arrow-return-style/rule.d.ts
|
|
48
|
+
declare const IMPLICIT = "useImplicitReturn";
|
|
49
|
+
declare const EXPLICIT = "useExplicitReturn";
|
|
50
|
+
declare const COMPLEX_EXPLICIT = "useExplicitReturnComplex";
|
|
51
|
+
type MessageIds$4 = typeof COMPLEX_EXPLICIT | typeof EXPLICIT | typeof IMPLICIT;
|
|
52
|
+
type ObjectReturnStyle = "always-explicit" | "complex-explicit" | "off";
|
|
53
|
+
type Options$6 = [{
|
|
54
|
+
/** Always use explicit returns for JSX bodies. */
|
|
55
|
+
jsxAlwaysUseExplicitReturn?: boolean;
|
|
56
|
+
/** Maximum emitted line length (tab-expanded) before requiring an explicit return. */
|
|
57
|
+
maxLen?: number;
|
|
58
|
+
/** Object property / array element count above which a literal body counts as complex. */
|
|
59
|
+
maxObjectProperties?: number;
|
|
60
|
+
/** Always use explicit returns for arrows assigned to named exports. */
|
|
61
|
+
namedExportsAlwaysUseExplicitReturn?: boolean;
|
|
62
|
+
/** When to force explicit returns for object/array literal bodies. */
|
|
63
|
+
objectReturnStyle?: ObjectReturnStyle;
|
|
64
|
+
/** Columns a tab occupies when measuring against `maxLen`. */
|
|
65
|
+
tabWidth?: number;
|
|
66
|
+
/** Consult oxfmt for boundary decisions; `printWidth` defaults to `maxLen`. */
|
|
67
|
+
useOxfmt?: boolean | {
|
|
68
|
+
printWidth?: number;
|
|
69
|
+
};
|
|
70
|
+
}];
|
|
71
|
+
//#endregion
|
|
47
72
|
//#region src/rules/jsx-shorthand-fragment/rule.d.ts
|
|
48
73
|
declare const MESSAGE_ID_NAMED = "useNamedFragment";
|
|
49
74
|
declare const MESSAGE_ID_SHORTHAND = "useShorthandFragment";
|
|
@@ -60,9 +85,41 @@ interface JsxShorthandFragmentOptions {
|
|
|
60
85
|
*/
|
|
61
86
|
readonly mode?: Mode;
|
|
62
87
|
}
|
|
63
|
-
type Options$
|
|
88
|
+
type Options$5 = [JsxShorthandFragmentOptions?];
|
|
64
89
|
type Mode = "element" | "syntax";
|
|
65
90
|
//#endregion
|
|
91
|
+
//#region src/rules/max-lines-per-function/rule.d.ts
|
|
92
|
+
/** Where a function's counted range begins. */
|
|
93
|
+
type CountFrom = "body" | "function";
|
|
94
|
+
interface MaxLinesPerFunctionOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Where the counted range begins. `"body"` (the default) counts from the
|
|
97
|
+
* line holding the body's opening brace through the line holding its closing
|
|
98
|
+
* brace, so lines spent purely on the signature — destructured parameters, a
|
|
99
|
+
* long parameter list, multi-line generics or return types, decorators — do
|
|
100
|
+
* not count against `max`. Note the opening-brace line is still counted, and
|
|
101
|
+
* it is usually also the last line of the signature (`): void {`), so exactly
|
|
102
|
+
* one signature line always remains in the total. `"function"` counts the
|
|
103
|
+
* whole function node instead, matching ESLint core.
|
|
104
|
+
*/
|
|
105
|
+
readonly countFrom?: CountFrom;
|
|
106
|
+
/**
|
|
107
|
+
* Whether immediately-invoked function expressions are measured. Off by
|
|
108
|
+
* default, matching ESLint core.
|
|
109
|
+
*/
|
|
110
|
+
readonly IIFEs?: boolean;
|
|
111
|
+
/** The maximum number of lines a function may span. */
|
|
112
|
+
readonly max?: number;
|
|
113
|
+
/** Whether lines containing only whitespace are excluded from the count. */
|
|
114
|
+
readonly skipBlankLines?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether lines consisting solely of a comment are excluded from the count.
|
|
117
|
+
* A comment trailing real code does not make its line skippable.
|
|
118
|
+
*/
|
|
119
|
+
readonly skipComments?: boolean;
|
|
120
|
+
}
|
|
121
|
+
type Options$4 = [MaxLinesPerFunctionOptions?];
|
|
122
|
+
//#endregion
|
|
66
123
|
//#region src/rules/naming-convention/utils/enums.d.ts
|
|
67
124
|
declare const Selector: {
|
|
68
125
|
readonly variable: 1;
|
|
@@ -225,13 +282,20 @@ declare const plugin: {
|
|
|
225
282
|
version: string;
|
|
226
283
|
};
|
|
227
284
|
rules: {
|
|
285
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<TSESLint.SourceCode>>;
|
|
228
286
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<TSESLint.SourceCode>>;
|
|
229
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$
|
|
287
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<TSESLint.SourceCode>>;
|
|
288
|
+
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<TSESLint.SourceCode>>;
|
|
230
289
|
"naming-convention": TSESLint.RuleModule<MessageIds$2, Options$3, PluginDocumentation, TSESLint.RuleListener> & {
|
|
231
290
|
name: string;
|
|
232
291
|
};
|
|
292
|
+
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<TSESLint.SourceCode>>;
|
|
293
|
+
"no-redundant-tsconfig-options": TSESLint.RuleModule<"redundant", [], PluginDocumentation, TSESLint.RuleListener> & {
|
|
294
|
+
name: string;
|
|
295
|
+
};
|
|
233
296
|
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<TSESLint.SourceCode>>;
|
|
234
297
|
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<TSESLint.SourceCode>>;
|
|
298
|
+
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<TSESLint.SourceCode>>;
|
|
235
299
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<TSESLint.SourceCode>>;
|
|
236
300
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<TSESLint.SourceCode>>;
|
|
237
301
|
"prefer-read-only-props": TSESLint.RuleModule<"preferReadOnlyProps", [{
|
|
@@ -262,13 +326,20 @@ declare const _default: {
|
|
|
262
326
|
version: string;
|
|
263
327
|
};
|
|
264
328
|
rules: {
|
|
329
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
|
|
265
330
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
|
|
266
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$
|
|
331
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
|
|
332
|
+
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
|
|
267
333
|
"naming-convention": import("${configDir}").RuleModule<MessageIds$2, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
268
334
|
name: string;
|
|
269
335
|
};
|
|
336
|
+
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
|
|
337
|
+
"no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
338
|
+
name: string;
|
|
339
|
+
};
|
|
270
340
|
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
|
|
271
341
|
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
342
|
+
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
|
|
272
343
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
|
|
273
344
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
|
|
274
345
|
"prefer-read-only-props": import("${configDir}").RuleModule<"preferReadOnlyProps", [{
|
|
@@ -296,13 +367,20 @@ declare const _default: {
|
|
|
296
367
|
version: string;
|
|
297
368
|
};
|
|
298
369
|
rules: {
|
|
370
|
+
"arrow-return-style": FlawlessRuleModule<Options$6, MessageIds$4, Readonly<import("${configDir}").SourceCode>>;
|
|
299
371
|
"jsx-shorthand-boolean": FlawlessRuleModule<[], "setAttributeValue", Readonly<import("${configDir}").SourceCode>>;
|
|
300
|
-
"jsx-shorthand-fragment": FlawlessRuleModule<Options$
|
|
372
|
+
"jsx-shorthand-fragment": FlawlessRuleModule<Options$5, MessageIds$3, Readonly<import("${configDir}").SourceCode>>;
|
|
373
|
+
"max-lines-per-function": FlawlessRuleModule<Options$4, "exceed", Readonly<import("${configDir}").SourceCode>>;
|
|
301
374
|
"naming-convention": import("${configDir}").RuleModule<MessageIds$2, Options$3, PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
302
375
|
name: string;
|
|
303
376
|
};
|
|
377
|
+
"no-export-default-arrow": FlawlessRuleModule<[], "disallowExportDefaultArrow", Readonly<import("${configDir}").SourceCode>>;
|
|
378
|
+
"no-redundant-tsconfig-options": import("${configDir}").RuleModule<"redundant", [], PluginDocumentation, import("${configDir}").RuleListener> & {
|
|
379
|
+
name: string;
|
|
380
|
+
};
|
|
304
381
|
"no-unnecessary-use-callback": FlawlessRuleModule<[], MessageIds$1, Readonly<import("${configDir}").SourceCode>>;
|
|
305
382
|
"no-unnecessary-use-memo": FlawlessRuleModule<[], MessageIds, Readonly<import("${configDir}").SourceCode>>;
|
|
383
|
+
"padding-after-expect-assertions": FlawlessRuleModule<[], "missingPadding", Readonly<import("${configDir}").SourceCode>>;
|
|
306
384
|
"prefer-destructuring-assignment": FlawlessRuleModule<[], "default", Readonly<import("${configDir}").SourceCode>>;
|
|
307
385
|
"prefer-parameter-destructuring": FlawlessRuleModule<Options$2, "default", Readonly<import("${configDir}").SourceCode>>;
|
|
308
386
|
"prefer-read-only-props": import("${configDir}").RuleModule<"preferReadOnlyProps", [{
|
package/dist/index.mjs
CHANGED
package/dist/oxlint.mjs
CHANGED