@isentinel/eslint-config 6.0.0-beta.11 → 6.0.0-beta.12

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.mts CHANGED
@@ -667,14 +667,6 @@ interface MainRuleDefaults {
667
667
  "arrow-spacing": {
668
668
  "*": "off";
669
669
  };
670
- "arrow-style/arrow-return-style": {
671
- "*": {
672
- "severityOnly": "error";
673
- };
674
- };
675
- "arrow-style/no-export-default-arrow": {
676
- "*": "error";
677
- };
678
670
  "babel/object-curly-spacing": {
679
671
  "*": "off";
680
672
  };
@@ -852,6 +844,14 @@ interface MainRuleDefaults {
852
844
  "ignore": ["eslint-enable"];
853
845
  }];
854
846
  };
847
+ "flawless/arrow-return-style": {
848
+ "*": {
849
+ "severityOnly": "error";
850
+ };
851
+ };
852
+ "flawless/no-export-default-arrow": {
853
+ "*": "error";
854
+ };
855
855
  "flawless/prefer-parameter-destructuring": {
856
856
  "*": ["warn", {
857
857
  "allowSideEffectReordering": true;
@@ -6317,16 +6317,6 @@ interface RuleOptions {
6317
6317
  * @deprecated
6318
6318
  */
6319
6319
  'arrow-spacing'?: Linter.RuleEntry<ArrowSpacing>;
6320
- /**
6321
- * Enforce consistent arrow function return style based on length, multiline expressions, JSX usage, and export context
6322
- * @see https://github.com/christopher-buss/eslint-plugin-arrow-return-style-x/blob/v1.2.6/src/rules/arrow-return-style/documentation.md
6323
- */
6324
- 'arrow-style/arrow-return-style'?: Linter.RuleEntry<ArrowStyleArrowReturnStyle>;
6325
- /**
6326
- * Disallow anonymous arrow functions as export default declarations
6327
- * @see https://github.com/christopher-buss/eslint-plugin-arrow-return-style-x/blob/v1.2.6/src/rules/no-export-default-arrow/documentation.md
6328
- */
6329
- 'arrow-style/no-export-default-arrow'?: Linter.RuleEntry<[]>;
6330
6320
  /**
6331
6321
  * Set a max param number for your constructors, functions, methods etc.
6332
6322
  */
@@ -6834,59 +6824,69 @@ interface RuleOptions {
6834
6824
  * @see https://github.com/eslint-community/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/unique-test-case-names.md
6835
6825
  */
6836
6826
  'eslint-plugin/unique-test-case-names'?: Linter.RuleEntry<[]>;
6827
+ /**
6828
+ * Enforce arrow function return style based on line length
6829
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/arrow-return-style/documentation.md
6830
+ */
6831
+ 'flawless/arrow-return-style'?: Linter.RuleEntry<FlawlessArrowReturnStyle>;
6837
6832
  /**
6838
6833
  * Disallow shorthand boolean JSX attributes
6839
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/jsx-shorthand-boolean/documentation.md
6834
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/jsx-shorthand-boolean/documentation.md
6840
6835
  */
6841
6836
  'flawless/jsx-shorthand-boolean'?: Linter.RuleEntry<[]>;
6842
6837
  /**
6843
6838
  * Enforce a consistent fragment form: the shorthand `<>...</>` or a named fragment
6844
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/jsx-shorthand-fragment/documentation.md
6839
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/jsx-shorthand-fragment/documentation.md
6845
6840
  */
6846
6841
  'flawless/jsx-shorthand-fragment'?: Linter.RuleEntry<FlawlessJsxShorthandFragment>;
6847
6842
  /**
6848
6843
  * Enforce naming conventions for everything across a codebase
6849
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/naming-convention/documentation.md
6844
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/naming-convention/documentation.md
6850
6845
  */
6851
6846
  'flawless/naming-convention'?: Linter.RuleEntry<FlawlessNamingConvention>;
6847
+ /**
6848
+ * Disallow anonymous arrow functions as export default declarations
6849
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-export-default-arrow/documentation.md
6850
+ */
6851
+ 'flawless/no-export-default-arrow'?: Linter.RuleEntry<[]>;
6852
6852
  /**
6853
6853
  * Disallow unnecessary usage of 'useCallback'
6854
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/no-unnecessary-use-callback/documentation.md
6854
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-unnecessary-use-callback/documentation.md
6855
6855
  */
6856
6856
  'flawless/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
6857
6857
  /**
6858
6858
  * Disallow unnecessary usage of 'useMemo'
6859
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/no-unnecessary-use-memo/documentation.md
6859
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-unnecessary-use-memo/documentation.md
6860
6860
  */
6861
6861
  'flawless/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
6862
6862
  /**
6863
6863
  * Enforce destructuring assignment for component props
6864
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-destructuring-assignment/documentation.md
6864
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-destructuring-assignment/documentation.md
6865
6865
  */
6866
6866
  'flawless/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
6867
6867
  /**
6868
6868
  * Enforce destructuring parameters in the function signature
6869
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-parameter-destructuring/documentation.md
6869
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-parameter-destructuring/documentation.md
6870
6870
  */
6871
6871
  'flawless/prefer-parameter-destructuring'?: Linter.RuleEntry<FlawlessPreferParameterDestructuring>;
6872
6872
  /**
6873
6873
  * Enforce that function component props are read-only
6874
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-read-only-props/documentation.md
6874
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-read-only-props/documentation.md
6875
6875
  */
6876
6876
  'flawless/prefer-read-only-props'?: Linter.RuleEntry<FlawlessPreferReadOnlyProps>;
6877
6877
  /**
6878
6878
  * Disallow impure calls such as `math.random` or `os.clock` during render
6879
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/purity/documentation.md
6879
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/purity/documentation.md
6880
6880
  */
6881
6881
  'flawless/purity'?: Linter.RuleEntry<FlawlessPurity>;
6882
6882
  /**
6883
6883
  * Enforce a configured sort order for TOML keys and tables
6884
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/toml-sort-keys/documentation.md
6884
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/toml-sort-keys/documentation.md
6885
6885
  */
6886
6886
  'flawless/toml-sort-keys'?: Linter.RuleEntry<FlawlessTomlSortKeys>;
6887
6887
  /**
6888
6888
  * Enforce blank lines around top-level YAML block collection keys
6889
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/yaml-block-key-blank-lines/documentation.md
6889
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/yaml-block-key-blank-lines/documentation.md
6890
6890
  */
6891
6891
  'flawless/yaml-block-key-blank-lines'?: Linter.RuleEntry<[]>;
6892
6892
  /**
@@ -16224,18 +16224,6 @@ type ArrowSpacing = [] | [{
16224
16224
  before?: boolean;
16225
16225
  after?: boolean;
16226
16226
  }];
16227
- // ----- arrow-style/arrow-return-style -----
16228
- type ArrowStyleArrowReturnStyle = [] | [{
16229
- jsxAlwaysUseExplicitReturn?: boolean;
16230
- maxLen?: number;
16231
- maxObjectProperties?: number;
16232
- namedExportsAlwaysUseExplicitReturn?: boolean;
16233
- objectReturnStyle?: ("always-explicit" | "complex-explicit" | "off");
16234
- usePrettier?: (boolean | {
16235
- [k: string]: unknown | undefined;
16236
- } | null);
16237
- [k: string]: unknown | undefined;
16238
- }];
16239
16227
  // ----- better-max-params/better-max-params -----
16240
16228
  type BetterMaxParamsBetterMaxParams = [] | [({
16241
16229
  func?: number;
@@ -16431,6 +16419,18 @@ type EslintPluginRequireTestCaseName = [] | [{
16431
16419
  type EslintPluginTestCasePropertyOrdering = [] | [unknown[]];
16432
16420
  // ----- eslint-plugin/test-case-shorthand-strings -----
16433
16421
  type EslintPluginTestCaseShorthandStrings = [] | [("as-needed" | "never" | "consistent" | "consistent-as-needed")];
16422
+ // ----- flawless/arrow-return-style -----
16423
+ type FlawlessArrowReturnStyle = [] | [{
16424
+ jsxAlwaysUseExplicitReturn?: boolean;
16425
+ maxLen?: number;
16426
+ maxObjectProperties?: number;
16427
+ namedExportsAlwaysUseExplicitReturn?: boolean;
16428
+ objectReturnStyle?: ("always-explicit" | "complex-explicit" | "off");
16429
+ tabWidth?: number;
16430
+ useOxfmt?: (boolean | {
16431
+ printWidth?: number;
16432
+ });
16433
+ }];
16434
16434
  // ----- flawless/jsx-shorthand-fragment -----
16435
16435
  type FlawlessJsxShorthandFragment = [] | [{
16436
16436
  fragmentName?: string;
@@ -26207,7 +26207,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
26207
26207
  onlyEquality?: boolean;
26208
26208
  }];
26209
26209
  // Names of all the configs
26210
- type ConfigNames = 'isentinel/eslint/comments' | 'isentinel/eslint/comments/src' | 'isentinel/e18e/rules' | 'isentinel/eslint-plugin/setup' | 'isentinel/eslint-plugin/rules' | 'isentinel/flawless/setup' | 'isentinel/flawless/rules' | 'isentinel/flawless/rules-type-aware' | 'isentinel/gitignore' | 'isentinel/ignores' | 'isentinel/imports/rules' | 'isentinel/imports/game' | 'isentinel/javascript/setup' | 'isentinel/javascript/rules' | 'isentinel/jsdoc/setup' | 'isentinel/jsdoc' | 'isentinel/jsonc/setup' | 'isentinel/jsonc/rules' | 'isentinel/markdown/setup' | 'isentinel/markdown/processor' | 'isentinel/markdown/parser' | 'isentinel/markdown/disables' | 'isentinel/naming/setup' | 'isentinel/naming/ts/rules-type-aware' | 'isentinel/naming/tsx/rules-type-aware' | 'isentinel/node/rules' | 'isentinel/oxfmt/setup' | 'isentinel/oxfmt/javascript' | 'isentinel/oxfmt/typescript' | 'isentinel/oxfmt/css' | 'isentinel/oxfmt/scss' | 'isentinel/oxfmt/less' | 'isentinel/oxfmt/html' | 'isentinel/oxfmt/markdown' | 'isentinel/oxfmt/graphql' | 'isentinel/oxfmt/json' | 'isentinel/oxfmt/yaml' | 'isentinel/package-json/setup' | 'isentinel/package-json' | 'isentinel/package-json/root' | 'isentinel/perfectionist/setup' | 'isentinel/perfectionist' | 'isentinel/perfectionist/jsx' | 'isentinel/pnpm/setup' | 'isentinel/pnpm/package-json' | 'isentinel/pnpm/pnpm-workspace-yaml' | 'isentinel/promise' | 'isentinel/react/setup' | 'isentinel/react/setup/naming' | 'isentinel/react/rules' | 'isentinel/react/type-aware-rules' | 'isentinel/roblox/setup' | 'isentinel/roblox/parser' | 'isentinel/roblox/type-aware-parser' | 'isentinel/roblox' | 'isentinel/roblox/rules-type-aware' | 'isentinel/roblox/format-lua/setup' | 'isentinel/roblox/format-lua' | 'isentinel/small-rules/setup' | 'isentinel/small-rules' | 'isentinel/sonarjs' | 'isentinel/spelling/setup' | 'isentinel/spelling' | 'isentinel/stylistic/setup' | 'isentinel/stylistic' | 'isentinel/stylistic/ts' | 'isentinel/stylistic/js' | 'isentinel/stylistic/markdown-code' | 'isentinel/test/jest/setup' | 'isentinel/test/jest/rules' | 'isentinel/test/vitest/setup' | 'isentinel/test/vitest/rules' | 'isentinel/toml/setup' | 'isentinel/toml/rules' | 'isentinel/typescript/setup' | 'isentinel/typescript/parser' | 'isentinel/typescript/type-aware-parser' | 'isentinel/typescript/rules' | 'isentinel/typescript/rules-type-aware' | 'isentinel/typescript/erasable-syntax-only' | 'isentinel/unicorn/setup' | 'isentinel/unicorn/rules' | 'isentinel/unicorn/root' | 'isentinel/yaml/setup' | 'isentinel/yaml/rules';
26210
+ type ConfigNames = 'isentinel/eslint/comments' | 'isentinel/eslint/comments/src' | 'isentinel/e18e/rules' | 'isentinel/eslint-plugin/setup' | 'isentinel/eslint-plugin/rules' | 'isentinel/flawless/setup' | 'isentinel/flawless/rules' | 'isentinel/flawless/markdown-code' | 'isentinel/flawless/rules-type-aware' | 'isentinel/gitignore' | 'isentinel/ignores' | 'isentinel/imports/rules' | 'isentinel/imports/game' | 'isentinel/javascript/setup' | 'isentinel/javascript/rules' | 'isentinel/jsdoc/setup' | 'isentinel/jsdoc' | 'isentinel/jsonc/setup' | 'isentinel/jsonc/rules' | 'isentinel/markdown/setup' | 'isentinel/markdown/processor' | 'isentinel/markdown/parser' | 'isentinel/markdown/disables' | 'isentinel/naming/setup' | 'isentinel/naming/ts/rules-type-aware' | 'isentinel/naming/tsx/rules-type-aware' | 'isentinel/node/rules' | 'isentinel/oxfmt/setup' | 'isentinel/oxfmt/javascript' | 'isentinel/oxfmt/typescript' | 'isentinel/oxfmt/css' | 'isentinel/oxfmt/scss' | 'isentinel/oxfmt/less' | 'isentinel/oxfmt/html' | 'isentinel/oxfmt/markdown' | 'isentinel/oxfmt/graphql' | 'isentinel/oxfmt/json' | 'isentinel/oxfmt/yaml' | 'isentinel/package-json/setup' | 'isentinel/package-json' | 'isentinel/package-json/root' | 'isentinel/perfectionist/setup' | 'isentinel/perfectionist' | 'isentinel/perfectionist/jsx' | 'isentinel/pnpm/setup' | 'isentinel/pnpm/package-json' | 'isentinel/pnpm/pnpm-workspace-yaml' | 'isentinel/promise' | 'isentinel/react/setup' | 'isentinel/react/setup/naming' | 'isentinel/react/rules' | 'isentinel/react/type-aware-rules' | 'isentinel/roblox/setup' | 'isentinel/roblox/parser' | 'isentinel/roblox/type-aware-parser' | 'isentinel/roblox' | 'isentinel/roblox/rules-type-aware' | 'isentinel/roblox/format-lua/setup' | 'isentinel/roblox/format-lua' | 'isentinel/small-rules/setup' | 'isentinel/small-rules' | 'isentinel/sonarjs' | 'isentinel/spelling/setup' | 'isentinel/spelling' | 'isentinel/stylistic/setup' | 'isentinel/stylistic' | 'isentinel/test/jest/setup' | 'isentinel/test/jest/rules' | 'isentinel/test/vitest/setup' | 'isentinel/test/vitest/rules' | 'isentinel/toml/setup' | 'isentinel/toml/rules' | 'isentinel/typescript/setup' | 'isentinel/typescript/parser' | 'isentinel/typescript/type-aware-parser' | 'isentinel/typescript/rules' | 'isentinel/typescript/rules-type-aware' | 'isentinel/typescript/erasable-syntax-only' | 'isentinel/unicorn/setup' | 'isentinel/unicorn/rules' | 'isentinel/unicorn/root' | 'isentinel/yaml/setup' | 'isentinel/yaml/rules';
26211
26211
  //#endregion
26212
26212
  //#region src/eslint/configs/comments.d.ts
26213
26213
  declare function comments({ prettierOptions, stylistic }?: OptionsFormatters & OptionsStylistic): Promise<Array<TypedFlatConfigItem>>;
@@ -26226,8 +26226,17 @@ declare function e18e({ files, ignores, isInEditor, modernization, type, moduleR
26226
26226
  //#region src/eslint/configs/eslint-plugin.d.ts
26227
26227
  declare function eslintPlugin({ files, overrides }?: OptionsFiles & OptionsOverrides): Promise<Array<TypedFlatConfigItem>>;
26228
26228
  //#endregion
26229
+ //#region src/eslint/configs/oxfmt.d.ts
26230
+ declare function oxfmt(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverrides & {
26231
+ formatters?: OptionsFormatters | true;
26232
+ oxfmtConfigOptions?: OxfmtOptions;
26233
+ oxfmtOptions?: OxfmtOptions;
26234
+ oxlint?: boolean;
26235
+ prettierOptions?: Options;
26236
+ }): Promise<Array<TypedFlatConfigItem>>;
26237
+ //#endregion
26229
26238
  //#region src/eslint/configs/flawless.d.ts
26230
- declare function flawless(options?: OptionsOverridesTypeAware & OptionsStylistic & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes): Promise<Array<TypedFlatConfigItem>>;
26239
+ declare function flawless(options?: OptionsOverridesTypeAware & OptionsStylistic & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes, prettierOptions?: PrettierOptions): Promise<Array<TypedFlatConfigItem>>;
26231
26240
  //#endregion
26232
26241
  //#region src/eslint/configs/gitignore.d.ts
26233
26242
  interface GitignoreOptions {
@@ -26269,15 +26278,6 @@ declare function node({ files, ignores }?: OptionsFiles & {
26269
26278
  ignores?: Array<string>;
26270
26279
  }): Promise<Array<TypedFlatConfigItem>>;
26271
26280
  //#endregion
26272
- //#region src/eslint/configs/oxfmt.d.ts
26273
- declare function oxfmt(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverrides & {
26274
- formatters?: OptionsFormatters | true;
26275
- oxfmtConfigOptions?: OxfmtOptions;
26276
- oxfmtOptions?: OxfmtOptions;
26277
- oxlint?: boolean;
26278
- prettierOptions?: Options;
26279
- }): Promise<Array<TypedFlatConfigItem>>;
26280
- //#endregion
26281
26281
  //#region src/eslint/configs/package-json.d.ts
26282
26282
  declare function packageJson({ roblox, stylistic, type }?: OptionsHasRoblox & OptionsProjectType & OptionsStylistic): Promise<Array<TypedFlatConfigItem>>;
26283
26283
  //#endregion
@@ -26367,7 +26367,7 @@ declare function spelling(options?: OptionsComponentExtensions & OptionsFiles &
26367
26367
  //#endregion
26368
26368
  //#region src/eslint/configs/stylistic.d.ts
26369
26369
  declare const StylisticConfigDefaults: StylisticConfig;
26370
- declare function stylistic$1(options?: StylisticConfig, prettierOptions?: PrettierOptions): Promise<Array<TypedFlatConfigItem>>;
26370
+ declare function stylistic$1(options?: StylisticConfig): Promise<Array<TypedFlatConfigItem>>;
26371
26371
  //#endregion
26372
26372
  //#region src/eslint/configs/test.d.ts
26373
26373
  declare function test({ files, isInEditor, jest, overrides, roblox: isRoblox, stylistic, type, vitest }?: OptionsFiles & OptionsHasRoblox & OptionsIsInEditor & OptionsOverrides & OptionsProjectType & OptionsStylistic & OptionsTestFramework): Promise<Array<TypedFlatConfigItem>>;
@@ -26503,7 +26503,7 @@ interface OptionsFormatters {
26503
26503
  /**
26504
26504
  * Custom options for Prettier.
26505
26505
  *
26506
- * Used for arrow-return-style-x and as a migration source for oxfmt
26506
+ * Used for flawless/arrow-return-style and as a migration source for oxfmt
26507
26507
  * options.
26508
26508
  */
26509
26509
  prettierOptions?: Options;
@@ -26611,7 +26611,7 @@ interface OptionsTypeScriptErasableOnly {
26611
26611
  erasableOnly?: boolean;
26612
26612
  }
26613
26613
  type StylisticConfig = Pick<StylisticCustomizeOptions, "indent" | "jsx" | "quotes" | "semi"> & {
26614
- arrowLength?: number;
26614
+ maxLen?: number;
26615
26615
  };
26616
26616
  interface OptionsHasRoblox {
26617
26617
  roblox?: boolean;
@@ -27088,7 +27088,6 @@ declare const defaultPluginRenaming: {
27088
27088
  "@isentinel/eslint-plugin-comment-length": string;
27089
27089
  "@stylistic": string;
27090
27090
  "@typescript-eslint": string;
27091
- "arrow-return-style-x": string;
27092
27091
  n: string;
27093
27092
  yml: string;
27094
27093
  };
package/dist/index.mjs CHANGED
@@ -826,26 +826,53 @@ async function eslintPlugin({ files = [GLOB_SRC], overrides = {} } = {}) {
826
826
  //#endregion
827
827
  //#region src/rules/flawless.ts
828
828
  /**
829
+ * Arrow return style rule on its own, for the Markdown code block override
830
+ * where only the line width differs.
831
+ *
832
+ * @param options - Shared rule options.
833
+ * @returns The rule map.
834
+ */
835
+ function arrowStyleRules({ maxLen, maxLength, printWidth, tabWidth } = {}) {
836
+ return { "flawless/arrow-return-style": ["error", {
837
+ jsxAlwaysUseExplicitReturn: true,
838
+ maxLen: maxLength ?? maxLen ?? printWidth ?? 100,
839
+ maxObjectProperties: 2,
840
+ namedExportsAlwaysUseExplicitReturn: true,
841
+ objectReturnStyle: "complex-explicit",
842
+ ...tabWidth !== void 0 ? { tabWidth } : {},
843
+ ...printWidth !== void 0 ? { useOxfmt: { printWidth } } : {}
844
+ }] };
845
+ }
846
+ /**
829
847
  * Base (non-React) flawless rules shared between the ESLint and oxlint
830
848
  * factories. The React flawless rules live in the react rule map; the
831
849
  * type-aware `flawless/naming-convention` and the non-JS `flawless/toml-*` and
832
850
  * `flawless/yaml-*` rules are configured by their own configs and stay in
833
851
  * ESLint.
834
852
  *
835
- * @param options - Shared stylistic options.
853
+ * @param options - Shared stylistic and arrow rule options.
836
854
  * @returns The rule map.
837
855
  */
838
- function flawlessRules({ stylistic = true } = {}) {
839
- return { ...stylistic !== false ? { "flawless/prefer-parameter-destructuring": "warn" } : {} };
856
+ function flawlessRules({ stylistic = true, ...arrowOptions } = {}) {
857
+ if (stylistic === false) return {};
858
+ return {
859
+ "flawless/no-export-default-arrow": "error",
860
+ "flawless/prefer-parameter-destructuring": "warn",
861
+ ...arrowStyleRules(arrowOptions)
862
+ };
840
863
  }
841
864
  //#endregion
842
865
  //#region src/eslint/configs/flawless.ts
843
- async function flawless(options = {}) {
866
+ async function flawless(options = {}, prettierOptions = {}) {
844
867
  const { overridesTypeAware = {}, stylistic = true, typeAware = true } = options;
845
868
  const eslintPluginFlawless = await interopDefault(import("eslint-plugin-flawless"));
846
869
  const filesTypeAware = [GLOB_TS, GLOB_TSX];
847
870
  const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.d.{,c,m}ts"];
848
871
  const isTypeAware = (typeAware ? getTsConfig(options.tsconfigPath) : void 0) !== void 0;
872
+ const stylisticOptions = typeof stylistic === "object" ? stylistic : {};
873
+ const printWidth = typeof prettierOptions.printWidth === "number" ? prettierOptions.printWidth : void 0;
874
+ const tabWidth = typeof prettierOptions.tabWidth === "number" ? prettierOptions.tabWidth : void 0;
875
+ const typeAwareRules = { "flawless/prefer-read-only-props": "error" };
849
876
  return [
850
877
  {
851
878
  name: "isentinel/flawless/setup",
@@ -853,15 +880,29 @@ async function flawless(options = {}) {
853
880
  },
854
881
  {
855
882
  name: "isentinel/flawless/rules",
856
- files: [GLOB_TS],
857
- rules: flawlessRules({ stylistic })
883
+ files: [GLOB_SRC],
884
+ rules: flawlessRules({
885
+ maxLen: stylisticOptions.maxLen,
886
+ printWidth,
887
+ stylistic,
888
+ tabWidth
889
+ })
858
890
  },
891
+ ...stylistic !== false ? [{
892
+ name: "isentinel/flawless/markdown-code",
893
+ files: [GLOB_MARKDOWN_CODE],
894
+ rules: arrowStyleRules({
895
+ maxLength: Number(prettierOptions["jsdocPrintWidth"]) || 80,
896
+ printWidth,
897
+ tabWidth
898
+ })
899
+ }] : [],
859
900
  ...isTypeAware ? [{
860
901
  name: "isentinel/flawless/rules-type-aware",
861
902
  files: filesTypeAware,
862
903
  ignores: ignoresTypeAware,
863
904
  rules: {
864
- "flawless/prefer-read-only-props": "error",
905
+ ...typeAwareRules,
865
906
  ...overridesTypeAware
866
907
  }
867
908
  }] : []
@@ -2055,7 +2096,6 @@ const defaultPluginRenaming = {
2055
2096
  "@isentinel/eslint-plugin-comment-length": "comment-length",
2056
2097
  "@stylistic": "style",
2057
2098
  "@typescript-eslint": "ts",
2058
- "arrow-return-style-x": "arrow-style",
2059
2099
  "n": "node",
2060
2100
  "yml": "yaml"
2061
2101
  };
@@ -3972,7 +4012,6 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
3972
4012
  "antfu/consistent-list-newline": "off",
3973
4013
  "antfu/if-newline": "off",
3974
4014
  "antfu/top-level-function": "error",
3975
- "arrow-style/no-export-default-arrow": "error",
3976
4015
  "curly": ["error", "all"],
3977
4016
  ...jsx ? { "style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }] } : {},
3978
4017
  "style/lines-between-class-members": ["error", { enforce: [{
@@ -4025,22 +4064,6 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
4025
4064
  ]
4026
4065
  };
4027
4066
  }
4028
- /**
4029
- * Arrow return style rule shared between the ESLint and oxlint factories.
4030
- *
4031
- * @param options - Shared rule options.
4032
- * @returns The rule map.
4033
- */
4034
- function arrowStyleRules({ arrowLength, maxLength, printWidth, usePrettier } = {}) {
4035
- return { "arrow-style/arrow-return-style": ["error", {
4036
- jsxAlwaysUseExplicitReturn: true,
4037
- maxLen: maxLength ?? arrowLength ?? printWidth ?? 100,
4038
- maxObjectProperties: 2,
4039
- namedExportsAlwaysUseExplicitReturn: true,
4040
- objectReturnStyle: "complex-explicit",
4041
- ...usePrettier ? { usePrettier } : {}
4042
- }] };
4043
- }
4044
4067
  //#endregion
4045
4068
  //#region src/eslint/configs/stylistic.ts
4046
4069
  const StylisticConfigDefaults = {
@@ -4049,16 +4072,12 @@ const StylisticConfigDefaults = {
4049
4072
  quotes: "double",
4050
4073
  semi: true
4051
4074
  };
4052
- async function stylistic(options = {}, prettierOptions = {}) {
4053
- const { arrowLength, indent, jsx, quotes, semi } = {
4075
+ async function stylistic(options = {}) {
4076
+ const { indent, jsx, quotes, semi } = {
4054
4077
  ...StylisticConfigDefaults,
4055
4078
  ...options
4056
4079
  };
4057
- const [pluginArrowReturnStyle, pluginStylistic, pluginAntfu] = await Promise.all([
4058
- interopDefault(import("eslint-plugin-arrow-return-style-x")),
4059
- interopDefault(import("@stylistic/eslint-plugin")),
4060
- interopDefault(import("eslint-plugin-antfu"))
4061
- ]);
4080
+ const [pluginStylistic, pluginAntfu] = await Promise.all([interopDefault(import("@stylistic/eslint-plugin")), interopDefault(import("eslint-plugin-antfu"))]);
4062
4081
  const config = pluginStylistic.configs.customize({
4063
4082
  indent,
4064
4083
  jsx,
@@ -4066,52 +4085,25 @@ async function stylistic(options = {}, prettierOptions = {}) {
4066
4085
  quotes,
4067
4086
  semi
4068
4087
  });
4069
- function createArrowStyleRule(_, maxLength) {
4070
- return arrowStyleRules({
4071
- arrowLength,
4072
- maxLength,
4073
- printWidth: typeof prettierOptions.printWidth === "number" ? prettierOptions.printWidth : void 0,
4074
- usePrettier: prettierOptions
4075
- });
4076
- }
4077
- return [
4078
- {
4079
- name: "isentinel/stylistic/setup",
4080
- plugins: {
4081
- "antfu": pluginAntfu,
4082
- "arrow-style": pluginArrowReturnStyle,
4083
- "style": pluginStylistic
4084
- }
4085
- },
4086
- {
4087
- name: "isentinel/stylistic",
4088
- files: [GLOB_SRC],
4089
- rules: {
4090
- ...config.rules,
4091
- ...stylisticRules({
4092
- indent,
4093
- jsx,
4094
- quotes,
4095
- semi
4096
- })
4097
- }
4098
- },
4099
- {
4100
- name: "isentinel/stylistic/ts",
4101
- files: [GLOB_TS, GLOB_TSX],
4102
- rules: { ...createArrowStyleRule("oxc-ts") }
4103
- },
4104
- {
4105
- name: "isentinel/stylistic/js",
4106
- files: [GLOB_JS, GLOB_JSX],
4107
- rules: { ...createArrowStyleRule("oxc") }
4108
- },
4109
- {
4110
- name: "isentinel/stylistic/markdown-code",
4111
- files: [GLOB_MARKDOWN_CODE],
4112
- rules: { ...createArrowStyleRule("oxc", Number(prettierOptions["jsdocPrintWidth"]) || 80) }
4088
+ return [{
4089
+ name: "isentinel/stylistic/setup",
4090
+ plugins: {
4091
+ antfu: pluginAntfu,
4092
+ style: pluginStylistic
4113
4093
  }
4114
- ];
4094
+ }, {
4095
+ name: "isentinel/stylistic",
4096
+ files: [GLOB_SRC],
4097
+ rules: {
4098
+ ...config.rules,
4099
+ ...stylisticRules({
4100
+ indent,
4101
+ jsx,
4102
+ quotes,
4103
+ semi
4104
+ })
4105
+ }
4106
+ }];
4115
4107
  }
4116
4108
  //#endregion
4117
4109
  //#region src/rules/test.ts
@@ -14523,7 +14515,6 @@ const oxlintRuleMapping = {
14523
14515
  "e18e/prefer-string-fromcharcode": "js-plugin",
14524
14516
  "e18e/prefer-timer-args": "js-plugin",
14525
14517
  "e18e/prefer-url-canparse": "js-plugin",
14526
- "arrow-style/arrow-return-style": "js-plugin",
14527
14518
  "style/jsx-curly-brace-presence": "js-plugin",
14528
14519
  "style/jsx-newline": "js-plugin",
14529
14520
  "style/jsx-self-closing-comp": "js-plugin",
@@ -14544,8 +14535,10 @@ const oxlintRuleMapping = {
14544
14535
  "small-rules/prefer-singular-enums": "js-plugin",
14545
14536
  "small-rules/react-hooks-strict-return": "js-plugin",
14546
14537
  "small-rules/strict-component-boundaries": "js-plugin",
14538
+ "flawless/arrow-return-style": "js-plugin",
14547
14539
  "flawless/jsx-shorthand-boolean": "js-plugin",
14548
14540
  "flawless/jsx-shorthand-fragment": "js-plugin",
14541
+ "flawless/no-export-default-arrow": "js-plugin",
14549
14542
  "flawless/no-unnecessary-use-callback": "js-plugin",
14550
14543
  "flawless/no-unnecessary-use-memo": "js-plugin",
14551
14544
  "flawless/prefer-destructuring-assignment": "js-plugin",
@@ -14787,7 +14780,6 @@ const oxlintRuleMapping = {
14787
14780
  * emitted as a jsPlugin requires type checking.
14788
14781
  */
14789
14782
  const typeAwareJsPluginRules = /* @__PURE__ */ new Set([
14790
- "arrow-style/no-export-default-arrow",
14791
14783
  "eslint-plugin/no-property-in-node",
14792
14784
  "jest/no-error-equal",
14793
14785
  "jest/no-unnecessary-assertion",
@@ -15189,7 +15181,7 @@ async function isentinel(options, ...userConfigs) {
15189
15181
  }), comments({
15190
15182
  prettierOptions: prettierSettings,
15191
15183
  stylistic: stylisticOptions
15192
- }), flawless({ stylistic: stylisticOptions }), ignores(options.ignores), imports({
15184
+ }), flawless({ stylistic: stylisticOptions }, prettierSettings), ignores(options.ignores), imports({
15193
15185
  stylistic: stylisticOptions,
15194
15186
  type: projectType
15195
15187
  }), packageJson({
@@ -15242,7 +15234,7 @@ async function isentinel(options, ...userConfigs) {
15242
15234
  stylistic: stylisticOptions
15243
15235
  }, shouldFormatLua));
15244
15236
  }
15245
- if (stylisticOptions !== false) configs.push(stylistic(stylisticOptions, prettierSettings), perfectionist({
15237
+ if (stylisticOptions !== false) configs.push(stylistic(stylisticOptions), perfectionist({
15246
15238
  ...resolveSubOptions(options, "perfectionist"),
15247
15239
  type: projectType
15248
15240
  }));
package/dist/oxlint.d.mts CHANGED
@@ -287,11 +287,6 @@ interface OxlintMainRuleDefaults {
287
287
  "arrow-body-style": {
288
288
  "*": "off";
289
289
  };
290
- "arrow-style/arrow-return-style": {
291
- "*": {
292
- "severityOnly": "error";
293
- };
294
- };
295
290
  "better-max-params/better-max-params": {
296
291
  "*": ["error", {
297
292
  "func": 4;
@@ -429,6 +424,14 @@ interface OxlintMainRuleDefaults {
429
424
  "initialized": "never";
430
425
  }];
431
426
  };
427
+ "flawless/arrow-return-style": {
428
+ "*": {
429
+ "severityOnly": "error";
430
+ };
431
+ };
432
+ "flawless/no-export-default-arrow": {
433
+ "*": "error";
434
+ };
432
435
  "flawless/prefer-parameter-destructuring": {
433
436
  "*": "warn";
434
437
  };
@@ -3534,16 +3537,6 @@ interface RuleOptions {
3534
3537
  * @deprecated
3535
3538
  */
3536
3539
  'arrow-spacing'?: Linter.RuleEntry<ArrowSpacing>;
3537
- /**
3538
- * Enforce consistent arrow function return style based on length, multiline expressions, JSX usage, and export context
3539
- * @see https://github.com/christopher-buss/eslint-plugin-arrow-return-style-x/blob/v1.2.6/src/rules/arrow-return-style/documentation.md
3540
- */
3541
- 'arrow-style/arrow-return-style'?: Linter.RuleEntry<ArrowStyleArrowReturnStyle>;
3542
- /**
3543
- * Disallow anonymous arrow functions as export default declarations
3544
- * @see https://github.com/christopher-buss/eslint-plugin-arrow-return-style-x/blob/v1.2.6/src/rules/no-export-default-arrow/documentation.md
3545
- */
3546
- 'arrow-style/no-export-default-arrow'?: Linter.RuleEntry<[]>;
3547
3540
  /**
3548
3541
  * Set a max param number for your constructors, functions, methods etc.
3549
3542
  */
@@ -4051,59 +4044,69 @@ interface RuleOptions {
4051
4044
  * @see https://github.com/eslint-community/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/unique-test-case-names.md
4052
4045
  */
4053
4046
  'eslint-plugin/unique-test-case-names'?: Linter.RuleEntry<[]>;
4047
+ /**
4048
+ * Enforce arrow function return style based on line length
4049
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/arrow-return-style/documentation.md
4050
+ */
4051
+ 'flawless/arrow-return-style'?: Linter.RuleEntry<FlawlessArrowReturnStyle>;
4054
4052
  /**
4055
4053
  * Disallow shorthand boolean JSX attributes
4056
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/jsx-shorthand-boolean/documentation.md
4054
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/jsx-shorthand-boolean/documentation.md
4057
4055
  */
4058
4056
  'flawless/jsx-shorthand-boolean'?: Linter.RuleEntry<[]>;
4059
4057
  /**
4060
4058
  * Enforce a consistent fragment form: the shorthand `<>...</>` or a named fragment
4061
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/jsx-shorthand-fragment/documentation.md
4059
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/jsx-shorthand-fragment/documentation.md
4062
4060
  */
4063
4061
  'flawless/jsx-shorthand-fragment'?: Linter.RuleEntry<FlawlessJsxShorthandFragment>;
4064
4062
  /**
4065
4063
  * Enforce naming conventions for everything across a codebase
4066
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/naming-convention/documentation.md
4064
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/naming-convention/documentation.md
4067
4065
  */
4068
4066
  'flawless/naming-convention'?: Linter.RuleEntry<FlawlessNamingConvention>;
4067
+ /**
4068
+ * Disallow anonymous arrow functions as export default declarations
4069
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-export-default-arrow/documentation.md
4070
+ */
4071
+ 'flawless/no-export-default-arrow'?: Linter.RuleEntry<[]>;
4069
4072
  /**
4070
4073
  * Disallow unnecessary usage of 'useCallback'
4071
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/no-unnecessary-use-callback/documentation.md
4074
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-unnecessary-use-callback/documentation.md
4072
4075
  */
4073
4076
  'flawless/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
4074
4077
  /**
4075
4078
  * Disallow unnecessary usage of 'useMemo'
4076
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/no-unnecessary-use-memo/documentation.md
4079
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/no-unnecessary-use-memo/documentation.md
4077
4080
  */
4078
4081
  'flawless/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
4079
4082
  /**
4080
4083
  * Enforce destructuring assignment for component props
4081
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-destructuring-assignment/documentation.md
4084
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-destructuring-assignment/documentation.md
4082
4085
  */
4083
4086
  'flawless/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
4084
4087
  /**
4085
4088
  * Enforce destructuring parameters in the function signature
4086
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-parameter-destructuring/documentation.md
4089
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-parameter-destructuring/documentation.md
4087
4090
  */
4088
4091
  'flawless/prefer-parameter-destructuring'?: Linter.RuleEntry<FlawlessPreferParameterDestructuring>;
4089
4092
  /**
4090
4093
  * Enforce that function component props are read-only
4091
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/prefer-read-only-props/documentation.md
4094
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/prefer-read-only-props/documentation.md
4092
4095
  */
4093
4096
  'flawless/prefer-read-only-props'?: Linter.RuleEntry<FlawlessPreferReadOnlyProps>;
4094
4097
  /**
4095
4098
  * Disallow impure calls such as `math.random` or `os.clock` during render
4096
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/purity/documentation.md
4099
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/purity/documentation.md
4097
4100
  */
4098
4101
  'flawless/purity'?: Linter.RuleEntry<FlawlessPurity>;
4099
4102
  /**
4100
4103
  * Enforce a configured sort order for TOML keys and tables
4101
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/toml-sort-keys/documentation.md
4104
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/toml-sort-keys/documentation.md
4102
4105
  */
4103
4106
  'flawless/toml-sort-keys'?: Linter.RuleEntry<FlawlessTomlSortKeys>;
4104
4107
  /**
4105
4108
  * Enforce blank lines around top-level YAML block collection keys
4106
- * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.11/src/rules/yaml-block-key-blank-lines/documentation.md
4109
+ * @see https://github.com/christopher-buss/eslint-plugin-flawless/blob/v0.1.12/src/rules/yaml-block-key-blank-lines/documentation.md
4107
4110
  */
4108
4111
  'flawless/yaml-block-key-blank-lines'?: Linter.RuleEntry<[]>;
4109
4112
  /**
@@ -13441,18 +13444,6 @@ type ArrowSpacing = [] | [{
13441
13444
  before?: boolean;
13442
13445
  after?: boolean;
13443
13446
  }];
13444
- // ----- arrow-style/arrow-return-style -----
13445
- type ArrowStyleArrowReturnStyle = [] | [{
13446
- jsxAlwaysUseExplicitReturn?: boolean;
13447
- maxLen?: number;
13448
- maxObjectProperties?: number;
13449
- namedExportsAlwaysUseExplicitReturn?: boolean;
13450
- objectReturnStyle?: ("always-explicit" | "complex-explicit" | "off");
13451
- usePrettier?: (boolean | {
13452
- [k: string]: unknown | undefined;
13453
- } | null);
13454
- [k: string]: unknown | undefined;
13455
- }];
13456
13447
  // ----- better-max-params/better-max-params -----
13457
13448
  type BetterMaxParamsBetterMaxParams = [] | [({
13458
13449
  func?: number;
@@ -13648,6 +13639,18 @@ type EslintPluginRequireTestCaseName = [] | [{
13648
13639
  type EslintPluginTestCasePropertyOrdering = [] | [unknown[]];
13649
13640
  // ----- eslint-plugin/test-case-shorthand-strings -----
13650
13641
  type EslintPluginTestCaseShorthandStrings = [] | [("as-needed" | "never" | "consistent" | "consistent-as-needed")];
13642
+ // ----- flawless/arrow-return-style -----
13643
+ type FlawlessArrowReturnStyle = [] | [{
13644
+ jsxAlwaysUseExplicitReturn?: boolean;
13645
+ maxLen?: number;
13646
+ maxObjectProperties?: number;
13647
+ namedExportsAlwaysUseExplicitReturn?: boolean;
13648
+ objectReturnStyle?: ("always-explicit" | "complex-explicit" | "off");
13649
+ tabWidth?: number;
13650
+ useOxfmt?: (boolean | {
13651
+ printWidth?: number;
13652
+ });
13653
+ }];
13651
13654
  // ----- flawless/jsx-shorthand-fragment -----
13652
13655
  type FlawlessJsxShorthandFragment = [] | [{
13653
13656
  fragmentName?: string;
@@ -23531,7 +23534,7 @@ interface OptionsFormatters {
23531
23534
  /**
23532
23535
  * Custom options for Prettier.
23533
23536
  *
23534
- * Used for arrow-return-style-x and as a migration source for oxfmt
23537
+ * Used for flawless/arrow-return-style and as a migration source for oxfmt
23535
23538
  * options.
23536
23539
  */
23537
23540
  prettierOptions?: Options;
@@ -23639,7 +23642,7 @@ interface OptionsTypeScriptErasableOnly {
23639
23642
  erasableOnly?: boolean;
23640
23643
  }
23641
23644
  type StylisticConfig = Pick<StylisticCustomizeOptions, "indent" | "jsx" | "quotes" | "semi"> & {
23642
- arrowLength?: number;
23645
+ maxLen?: number;
23643
23646
  };
23644
23647
  //#endregion
23645
23648
  //#region src/eslint/types.d.ts
@@ -32001,7 +32004,7 @@ type OxlintCommentsRequireDescription = [] | [{
32001
32004
  ignore?: ("oxlint-disable" | "oxlint-disable-line" | "oxlint-disable-next-line" | "oxlint-enable")[];
32002
32005
  }];
32003
32006
  /** JsPlugin prefixes whose rules keep their ESLint-side names in oxlint configs. */
32004
- type OxlintKeptJsPluginPrefix = '@cspell' | 'antfu' | 'arrow-style' | 'better-max-params' | 'comment-length' | 'de-morgan' | 'e18e' | 'erasable-syntax-only' | 'eslint-plugin' | 'flawless' | 'oxfmt' | 'perfectionist' | 'react-jsx' | 'react-naming-convention' | 'roblox' | 'sentinel' | 'small-rules' | 'sonar' | 'style' | 'ts' | 'unused-imports';
32007
+ type OxlintKeptJsPluginPrefix = '@cspell' | 'antfu' | 'better-max-params' | 'comment-length' | 'de-morgan' | 'e18e' | 'erasable-syntax-only' | 'eslint-plugin' | 'flawless' | 'oxfmt' | 'perfectionist' | 'react-jsx' | 'react-naming-convention' | 'roblox' | 'sentinel' | 'small-rules' | 'sonar' | 'style' | 'ts' | 'unused-imports';
32005
32008
  /** JsPlugin rules whose oxlint names match the ESLint-side names. */
32006
32009
  type OxlintKeptJsPluginRuleOptions = { [K in keyof RuleOptions as K extends `${OxlintKeptJsPluginPrefix}/${string}` ? K : never]: RuleOptions[K]; };
32007
32010
  /** All rules known to the oxlint factory, keyed by canonical oxlint rule name. */
package/dist/oxlint.mjs CHANGED
@@ -17,7 +17,7 @@ import globals from "globals";
17
17
  const staysInEslint = {
18
18
  "e18e/* (optionally type-aware)": "Four e18e rules (prefer-array-at, prefer-array-to-reversed, prefer-array-to-sorted, prefer-spread-syntax) run without type information but detect more with it, so they stay in ESLint (see optionallyTypeAwareRules); the rest run in oxlint as a jsPlugin",
19
19
  "eslint-comments/*": "Lints eslint-disable directives, which only exist in ESLint-linted code; oxlint-comments covers oxlint directives",
20
- "flawless/naming-convention": "Type-aware custom rule; oxlint jsPlugins have no type information. The syntax-only flawless rules (prefer-parameter-destructuring, the react jsx-shorthand-*, purity, no-unnecessary-use-*, prefer-destructuring-assignment) are mapped and run in oxlint. flawless/toml-* and flawless/yaml-* lint non-JS files and stay in ESLint",
20
+ "flawless/naming-convention": "Type-aware custom rule; oxlint jsPlugins have no type information. The syntax-only flawless rules (arrow-return-style, no-export-default-arrow, prefer-parameter-destructuring, the react jsx-shorthand-*, purity, no-unnecessary-use-*, prefer-destructuring-assignment) are mapped and run in oxlint. flawless/toml-* and flawless/yaml-* lint non-JS files and stay in ESLint",
21
21
  "flawless/prefer-read-only-props": "Type-aware custom rule; oxlint jsPlugins have no type information",
22
22
  "format-lua/*": "Oxlint cannot lint Lua files",
23
23
  "jest/* (type-aware)": "Four type-aware jest rules stay in ESLint (see typeAwareJsPluginRules); the rest run in oxlint via eslint-plugin-jest as a jsPlugin (renamed jest-js, since oxlint reserves the native jest prefix), which honors settings.jest.globalPackage = @rbxts/jest-globals (the NATIVE oxlint jest plugin does not, https://github.com/oxc-project/oxc/issues/23290)",
@@ -25,7 +25,7 @@ const staysInEslint = {
25
25
  "react/* (type-aware)": "The @eslint-react type-aware rules (no-implicit-children/key/ref, no-leaked-conditional-rendering, no-unused-props) need type information but do NOT declare requiresTypeChecking, so the metadata-based parity test cannot catch them; they are excluded manually and stay in ESLint",
26
26
  "roblox/* (type-aware)": "Type-aware custom rules (lua-truthiness etc.); oxlint jsPlugins have no type information",
27
27
  "sentinel/explicit-size-check": "Type-aware custom rule; oxlint jsPlugins have no type information",
28
- "type-aware jsPlugin rules": "Rules whose meta.docs.requiresTypeChecking is true crash or silently no-op under oxlint's jsPlugin runtime (no type information): sonar/no-async-constructor, sonar/no-ignored-return, sonar/no-incompatible-assertion-types, sonar/no-redundant-optional, sonar/no-try-promise, sonar/prefer-immediate-return, unicorn/no-non-function-verb-prefix, arrow-style/no-export-default-arrow, eslint-plugin/no-property-in-node, jest/no-error-equal, jest/no-unnecessary-assertion, jest/unbound-method, jest/valid-expect-with-promise",
28
+ "type-aware jsPlugin rules": "Rules whose meta.docs.requiresTypeChecking is true crash or silently no-op under oxlint's jsPlugin runtime (no type information): sonar/no-async-constructor, sonar/no-ignored-return, sonar/no-incompatible-assertion-types, sonar/no-redundant-optional, sonar/no-try-promise, sonar/prefer-immediate-return, unicorn/no-non-function-verb-prefix, eslint-plugin/no-property-in-node, jest/no-error-equal, jest/no-unnecessary-assertion, jest/unbound-method, jest/valid-expect-with-promise",
29
29
  "unicorn/no-unsafe-string-replacement": "False positives under oxlint's jsPlugin scope analysis (template-literal replacements are not resolved)"
30
30
  };
31
31
  const oxlintRuleMapping = {
@@ -492,7 +492,6 @@ const oxlintRuleMapping = {
492
492
  "e18e/prefer-string-fromcharcode": "js-plugin",
493
493
  "e18e/prefer-timer-args": "js-plugin",
494
494
  "e18e/prefer-url-canparse": "js-plugin",
495
- "arrow-style/arrow-return-style": "js-plugin",
496
495
  "style/jsx-curly-brace-presence": "js-plugin",
497
496
  "style/jsx-newline": "js-plugin",
498
497
  "style/jsx-self-closing-comp": "js-plugin",
@@ -513,8 +512,10 @@ const oxlintRuleMapping = {
513
512
  "small-rules/prefer-singular-enums": "js-plugin",
514
513
  "small-rules/react-hooks-strict-return": "js-plugin",
515
514
  "small-rules/strict-component-boundaries": "js-plugin",
515
+ "flawless/arrow-return-style": "js-plugin",
516
516
  "flawless/jsx-shorthand-boolean": "js-plugin",
517
517
  "flawless/jsx-shorthand-fragment": "js-plugin",
518
+ "flawless/no-export-default-arrow": "js-plugin",
518
519
  "flawless/no-unnecessary-use-callback": "js-plugin",
519
520
  "flawless/no-unnecessary-use-memo": "js-plugin",
520
521
  "flawless/prefer-destructuring-assignment": "js-plugin",
@@ -756,7 +757,6 @@ const oxlintRuleMapping = {
756
757
  * emitted as a jsPlugin requires type checking.
757
758
  */
758
759
  const typeAwareJsPluginRules = /* @__PURE__ */ new Set([
759
- "arrow-style/no-export-default-arrow",
760
760
  "eslint-plugin/no-property-in-node",
761
761
  "jest/no-error-equal",
762
762
  "jest/no-unnecessary-assertion",
@@ -854,7 +854,6 @@ const oxlintJsPluginPrefixRenames = {
854
854
  const oxlintJsPlugins = {
855
855
  "@cspell": "@cspell/eslint-plugin",
856
856
  "antfu": "eslint-plugin-antfu",
857
- "arrow-style": "eslint-plugin-arrow-return-style-x",
858
857
  "better-max-params": "eslint-plugin-better-max-params",
859
858
  "comment-length": "eslint-plugin-comment-length",
860
859
  "de-morgan": "eslint-plugin-de-morgan",
@@ -973,9 +972,7 @@ const GLOB_ROOT = [
973
972
  ];
974
973
  const GLOB_SRC_EXT = "{,c,m}[jt]s{,x}";
975
974
  const GLOB_SRC = "**/*.{,c,m}[jt]s{,x}";
976
- const GLOB_JS = "**/*.{,c,m}js";
977
975
  const GLOB_JSX = "**/*.{,c,m}jsx";
978
- const GLOB_TS = "**/*.{,c,m}ts";
979
976
  const GLOB_TSX = "**/*.{,c,m}tsx";
980
977
  const GLOB_DTS = "**/*.d.{,c,m}ts";
981
978
  const GLOB_TESTS = [
@@ -1843,25 +1840,53 @@ function oxlintEslintPlugin(options = {}) {
1843
1840
  //#endregion
1844
1841
  //#region src/rules/flawless.ts
1845
1842
  /**
1843
+ * Arrow return style rule on its own, for the Markdown code block override
1844
+ * where only the line width differs.
1845
+ *
1846
+ * @param options - Shared rule options.
1847
+ * @returns The rule map.
1848
+ */
1849
+ function arrowStyleRules({ maxLen, maxLength, printWidth, tabWidth } = {}) {
1850
+ return { "flawless/arrow-return-style": ["error", {
1851
+ jsxAlwaysUseExplicitReturn: true,
1852
+ maxLen: maxLength ?? maxLen ?? printWidth ?? 100,
1853
+ maxObjectProperties: 2,
1854
+ namedExportsAlwaysUseExplicitReturn: true,
1855
+ objectReturnStyle: "complex-explicit",
1856
+ ...tabWidth !== void 0 ? { tabWidth } : {},
1857
+ ...printWidth !== void 0 ? { useOxfmt: { printWidth } } : {}
1858
+ }] };
1859
+ }
1860
+ /**
1846
1861
  * Base (non-React) flawless rules shared between the ESLint and oxlint
1847
1862
  * factories. The React flawless rules live in the react rule map; the
1848
1863
  * type-aware `flawless/naming-convention` and the non-JS `flawless/toml-*` and
1849
1864
  * `flawless/yaml-*` rules are configured by their own configs and stay in
1850
1865
  * ESLint.
1851
1866
  *
1852
- * @param options - Shared stylistic options.
1867
+ * @param options - Shared stylistic and arrow rule options.
1853
1868
  * @returns The rule map.
1854
1869
  */
1855
- function flawlessRules({ stylistic = true } = {}) {
1856
- return { ...stylistic !== false ? { "flawless/prefer-parameter-destructuring": "warn" } : {} };
1870
+ function flawlessRules({ stylistic = true, ...arrowOptions } = {}) {
1871
+ if (stylistic === false) return {};
1872
+ return {
1873
+ "flawless/no-export-default-arrow": "error",
1874
+ "flawless/prefer-parameter-destructuring": "warn",
1875
+ ...arrowStyleRules(arrowOptions)
1876
+ };
1857
1877
  }
1858
1878
  //#endregion
1859
1879
  //#region src/oxlint/configs/flawless.ts
1860
- function oxlintFlawless({ stylistic = true } = {}) {
1880
+ function oxlintFlawless({ stylistic = true } = {}, prettierOptions = {}) {
1861
1881
  return createOxlintConfigs({
1862
1882
  name: "isentinel/flawless",
1863
- files: [GLOB_TS],
1864
- rules: flawlessRules({ stylistic })
1883
+ files: [GLOB_SRC],
1884
+ rules: flawlessRules({
1885
+ maxLen: (typeof stylistic === "object" ? stylistic : {}).maxLen,
1886
+ printWidth: typeof prettierOptions["printWidth"] === "number" ? prettierOptions["printWidth"] : void 0,
1887
+ stylistic,
1888
+ tabWidth: typeof prettierOptions["tabWidth"] === "number" ? prettierOptions["tabWidth"] : void 0
1889
+ })
1865
1890
  });
1866
1891
  }
1867
1892
  //#endregion
@@ -2401,7 +2426,6 @@ const defaultPluginRenaming = {
2401
2426
  "@isentinel/eslint-plugin-comment-length": "comment-length",
2402
2427
  "@stylistic": "style",
2403
2428
  "@typescript-eslint": "ts",
2404
- "arrow-return-style-x": "arrow-style",
2405
2429
  "n": "node",
2406
2430
  "yml": "yaml"
2407
2431
  };
@@ -3093,7 +3117,6 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
3093
3117
  "antfu/consistent-list-newline": "off",
3094
3118
  "antfu/if-newline": "off",
3095
3119
  "antfu/top-level-function": "error",
3096
- "arrow-style/no-export-default-arrow": "error",
3097
3120
  "curly": ["error", "all"],
3098
3121
  ...jsx ? { "style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }] } : {},
3099
3122
  "style/lines-between-class-members": ["error", { enforce: [{
@@ -3146,48 +3169,14 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
3146
3169
  ]
3147
3170
  };
3148
3171
  }
3149
- /**
3150
- * Arrow return style rule shared between the ESLint and oxlint factories.
3151
- *
3152
- * @param options - Shared rule options.
3153
- * @returns The rule map.
3154
- */
3155
- function arrowStyleRules({ arrowLength, maxLength, printWidth, usePrettier } = {}) {
3156
- return { "arrow-style/arrow-return-style": ["error", {
3157
- jsxAlwaysUseExplicitReturn: true,
3158
- maxLen: maxLength ?? arrowLength ?? printWidth ?? 100,
3159
- maxObjectProperties: 2,
3160
- namedExportsAlwaysUseExplicitReturn: true,
3161
- objectReturnStyle: "complex-explicit",
3162
- ...usePrettier ? { usePrettier } : {}
3163
- }] };
3164
- }
3165
3172
  //#endregion
3166
3173
  //#region src/oxlint/configs/stylistic.ts
3167
- function oxlintStylistic(options = {}, prettierOptions = {}) {
3168
- const { arrowLength } = options;
3169
- const arrowRules = arrowStyleRules({
3170
- arrowLength,
3171
- printWidth: typeof prettierOptions["printWidth"] === "number" ? prettierOptions["printWidth"] : void 0,
3172
- usePrettier: prettierOptions
3174
+ function oxlintStylistic(options = {}) {
3175
+ return createOxlintConfigs({
3176
+ name: "isentinel/stylistic",
3177
+ files: [GLOB_SRC],
3178
+ rules: stylisticRules(options)
3173
3179
  });
3174
- return [
3175
- ...createOxlintConfigs({
3176
- name: "isentinel/stylistic",
3177
- files: [GLOB_SRC],
3178
- rules: stylisticRules(options)
3179
- }),
3180
- ...createOxlintConfigs({
3181
- name: "isentinel/stylistic/ts",
3182
- files: [GLOB_TS, GLOB_TSX],
3183
- rules: arrowRules
3184
- }),
3185
- ...createOxlintConfigs({
3186
- name: "isentinel/stylistic/js",
3187
- files: [GLOB_JS, GLOB_JSX],
3188
- rules: arrowRules
3189
- })
3190
- ];
3191
3180
  }
3192
3181
  //#endregion
3193
3182
  //#region src/rules/test.ts
@@ -4021,7 +4010,7 @@ function isentinel(factoryOptions, ...userConfigs) {
4021
4010
  if (stylisticOptions !== false) configs.push(oxlintPerfectionist({
4022
4011
  ...resolveSubOptions(options, "perfectionist"),
4023
4012
  type: projectType
4024
- }), oxlintStylistic(stylisticOptions, prettierSettings));
4013
+ }), oxlintStylistic(stylisticOptions));
4025
4014
  if (enableReact !== false) {
4026
4015
  const reactOptions = typeof enableReact === "object" ? enableReact : {};
4027
4016
  configs.push(oxlintReact({
@@ -4046,7 +4035,7 @@ function isentinel(factoryOptions, ...userConfigs) {
4046
4035
  componentExts: componentExtensions,
4047
4036
  isInEditor,
4048
4037
  stylistic: stylisticOptions
4049
- }), oxlintFlawless({ stylistic: stylisticOptions }), oxlintComments({
4038
+ }), oxlintFlawless({ stylistic: stylisticOptions }, prettierSettings), oxlintComments({
4050
4039
  prettierOptions: prettierSettings,
4051
4040
  stylistic: stylisticOptions
4052
4041
  }), oxlintDisables({ root: rootGlobs }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isentinel/eslint-config",
3
- "version": "6.0.0-beta.11",
3
+ "version": "6.0.0-beta.12",
4
4
  "description": "iSentinel's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config",
@@ -63,11 +63,10 @@
63
63
  "eslint-flat-config-utils": "3.2.0",
64
64
  "eslint-merge-processors": "2.0.0",
65
65
  "eslint-plugin-antfu": "3.2.3",
66
- "eslint-plugin-arrow-return-style-x": "1.2.6",
67
66
  "eslint-plugin-better-max-params": "1.0.0",
68
67
  "eslint-plugin-comment-length": "2.3.1",
69
68
  "eslint-plugin-de-morgan": "2.1.3",
70
- "eslint-plugin-flawless": "0.1.11",
69
+ "eslint-plugin-flawless": "0.1.12",
71
70
  "eslint-plugin-format-lua": "2.0.0",
72
71
  "eslint-plugin-import-lite": "0.6.0",
73
72
  "eslint-plugin-jsdoc": "63.0.13",
@@ -133,7 +132,7 @@
133
132
  "typescript": "6.0.3",
134
133
  "unplugin-unused": "0.5.7",
135
134
  "vitest": "4.1.10",
136
- "@isentinel/eslint-config": "6.0.0-beta.11"
135
+ "@isentinel/eslint-config": "6.0.0-beta.12"
137
136
  },
138
137
  "peerDependencies": {
139
138
  "@vitest/eslint-plugin": "^1.6.4",