@isentinel/eslint-config 6.0.0-beta.10 → 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 +55 -56
- package/dist/index.mjs +74 -81
- package/dist/oxlint.d.mts +44 -41
- package/dist/oxlint.mjs +114 -63
- package/package.json +3 -4
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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/
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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: [
|
|
857
|
-
rules: flawlessRules({
|
|
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
|
-
|
|
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 = {}
|
|
4053
|
-
const {
|
|
4075
|
+
async function stylistic(options = {}) {
|
|
4076
|
+
const { indent, jsx, quotes, semi } = {
|
|
4054
4077
|
...StylisticConfigDefaults,
|
|
4055
4078
|
...options
|
|
4056
4079
|
};
|
|
4057
|
-
const [
|
|
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
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
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
|
|
@@ -14179,6 +14171,7 @@ const oxlintRuleMapping = {
|
|
|
14179
14171
|
"dot-notation": "js-plugin",
|
|
14180
14172
|
"id-length": "js-plugin",
|
|
14181
14173
|
"no-dupe-args": "js-plugin",
|
|
14174
|
+
"no-loop-func": "js-plugin",
|
|
14182
14175
|
"no-octal": "js-plugin",
|
|
14183
14176
|
"no-octal-escape": "js-plugin",
|
|
14184
14177
|
"no-restricted-syntax": "js-plugin",
|
|
@@ -14522,7 +14515,6 @@ const oxlintRuleMapping = {
|
|
|
14522
14515
|
"e18e/prefer-string-fromcharcode": "js-plugin",
|
|
14523
14516
|
"e18e/prefer-timer-args": "js-plugin",
|
|
14524
14517
|
"e18e/prefer-url-canparse": "js-plugin",
|
|
14525
|
-
"arrow-style/arrow-return-style": "js-plugin",
|
|
14526
14518
|
"style/jsx-curly-brace-presence": "js-plugin",
|
|
14527
14519
|
"style/jsx-newline": "js-plugin",
|
|
14528
14520
|
"style/jsx-self-closing-comp": "js-plugin",
|
|
@@ -14543,8 +14535,10 @@ const oxlintRuleMapping = {
|
|
|
14543
14535
|
"small-rules/prefer-singular-enums": "js-plugin",
|
|
14544
14536
|
"small-rules/react-hooks-strict-return": "js-plugin",
|
|
14545
14537
|
"small-rules/strict-component-boundaries": "js-plugin",
|
|
14538
|
+
"flawless/arrow-return-style": "js-plugin",
|
|
14546
14539
|
"flawless/jsx-shorthand-boolean": "js-plugin",
|
|
14547
14540
|
"flawless/jsx-shorthand-fragment": "js-plugin",
|
|
14541
|
+
"flawless/no-export-default-arrow": "js-plugin",
|
|
14548
14542
|
"flawless/no-unnecessary-use-callback": "js-plugin",
|
|
14549
14543
|
"flawless/no-unnecessary-use-memo": "js-plugin",
|
|
14550
14544
|
"flawless/prefer-destructuring-assignment": "js-plugin",
|
|
@@ -14786,7 +14780,6 @@ const oxlintRuleMapping = {
|
|
|
14786
14780
|
* emitted as a jsPlugin requires type checking.
|
|
14787
14781
|
*/
|
|
14788
14782
|
const typeAwareJsPluginRules = /* @__PURE__ */ new Set([
|
|
14789
|
-
"arrow-style/no-export-default-arrow",
|
|
14790
14783
|
"eslint-plugin/no-property-in-node",
|
|
14791
14784
|
"jest/no-error-equal",
|
|
14792
14785
|
"jest/no-unnecessary-assertion",
|
|
@@ -15188,7 +15181,7 @@ async function isentinel(options, ...userConfigs) {
|
|
|
15188
15181
|
}), comments({
|
|
15189
15182
|
prettierOptions: prettierSettings,
|
|
15190
15183
|
stylistic: stylisticOptions
|
|
15191
|
-
}), flawless({ stylistic: stylisticOptions }), ignores(options.ignores), imports({
|
|
15184
|
+
}), flawless({ stylistic: stylisticOptions }, prettierSettings), ignores(options.ignores), imports({
|
|
15192
15185
|
stylistic: stylisticOptions,
|
|
15193
15186
|
type: projectType
|
|
15194
15187
|
}), packageJson({
|
|
@@ -15241,7 +15234,7 @@ async function isentinel(options, ...userConfigs) {
|
|
|
15241
15234
|
stylistic: stylisticOptions
|
|
15242
15235
|
}, shouldFormatLua));
|
|
15243
15236
|
}
|
|
15244
|
-
if (stylisticOptions !== false) configs.push(stylistic(stylisticOptions
|
|
15237
|
+
if (stylisticOptions !== false) configs.push(stylistic(stylisticOptions), perfectionist({
|
|
15245
15238
|
...resolveSubOptions(options, "perfectionist"),
|
|
15246
15239
|
type: projectType
|
|
15247
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
-
|
|
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' | '
|
|
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
|
@@ -7,8 +7,8 @@ import path from "node:path";
|
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import "prettier";
|
|
9
9
|
import { minVersion } from "semver";
|
|
10
|
-
import globals from "globals";
|
|
11
10
|
import { pathToFileURL } from "node:url";
|
|
11
|
+
import globals from "globals";
|
|
12
12
|
//#region src/rules/oxlint-mapping.ts
|
|
13
13
|
/**
|
|
14
14
|
* Notable rule families that intentionally stay in ESLint in hybrid mode,
|
|
@@ -17,7 +17,7 @@ import { pathToFileURL } from "node:url";
|
|
|
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,
|
|
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 = {
|
|
@@ -148,6 +148,7 @@ const oxlintRuleMapping = {
|
|
|
148
148
|
"dot-notation": "js-plugin",
|
|
149
149
|
"id-length": "js-plugin",
|
|
150
150
|
"no-dupe-args": "js-plugin",
|
|
151
|
+
"no-loop-func": "js-plugin",
|
|
151
152
|
"no-octal": "js-plugin",
|
|
152
153
|
"no-octal-escape": "js-plugin",
|
|
153
154
|
"no-restricted-syntax": "js-plugin",
|
|
@@ -491,7 +492,6 @@ const oxlintRuleMapping = {
|
|
|
491
492
|
"e18e/prefer-string-fromcharcode": "js-plugin",
|
|
492
493
|
"e18e/prefer-timer-args": "js-plugin",
|
|
493
494
|
"e18e/prefer-url-canparse": "js-plugin",
|
|
494
|
-
"arrow-style/arrow-return-style": "js-plugin",
|
|
495
495
|
"style/jsx-curly-brace-presence": "js-plugin",
|
|
496
496
|
"style/jsx-newline": "js-plugin",
|
|
497
497
|
"style/jsx-self-closing-comp": "js-plugin",
|
|
@@ -512,8 +512,10 @@ const oxlintRuleMapping = {
|
|
|
512
512
|
"small-rules/prefer-singular-enums": "js-plugin",
|
|
513
513
|
"small-rules/react-hooks-strict-return": "js-plugin",
|
|
514
514
|
"small-rules/strict-component-boundaries": "js-plugin",
|
|
515
|
+
"flawless/arrow-return-style": "js-plugin",
|
|
515
516
|
"flawless/jsx-shorthand-boolean": "js-plugin",
|
|
516
517
|
"flawless/jsx-shorthand-fragment": "js-plugin",
|
|
518
|
+
"flawless/no-export-default-arrow": "js-plugin",
|
|
517
519
|
"flawless/no-unnecessary-use-callback": "js-plugin",
|
|
518
520
|
"flawless/no-unnecessary-use-memo": "js-plugin",
|
|
519
521
|
"flawless/prefer-destructuring-assignment": "js-plugin",
|
|
@@ -755,7 +757,6 @@ const oxlintRuleMapping = {
|
|
|
755
757
|
* emitted as a jsPlugin requires type checking.
|
|
756
758
|
*/
|
|
757
759
|
const typeAwareJsPluginRules = /* @__PURE__ */ new Set([
|
|
758
|
-
"arrow-style/no-export-default-arrow",
|
|
759
760
|
"eslint-plugin/no-property-in-node",
|
|
760
761
|
"jest/no-error-equal",
|
|
761
762
|
"jest/no-unnecessary-assertion",
|
|
@@ -853,7 +854,6 @@ const oxlintJsPluginPrefixRenames = {
|
|
|
853
854
|
const oxlintJsPlugins = {
|
|
854
855
|
"@cspell": "@cspell/eslint-plugin",
|
|
855
856
|
"antfu": "eslint-plugin-antfu",
|
|
856
|
-
"arrow-style": "eslint-plugin-arrow-return-style-x",
|
|
857
857
|
"better-max-params": "eslint-plugin-better-max-params",
|
|
858
858
|
"comment-length": "eslint-plugin-comment-length",
|
|
859
859
|
"de-morgan": "eslint-plugin-de-morgan",
|
|
@@ -972,9 +972,7 @@ const GLOB_ROOT = [
|
|
|
972
972
|
];
|
|
973
973
|
const GLOB_SRC_EXT = "{,c,m}[jt]s{,x}";
|
|
974
974
|
const GLOB_SRC = "**/*.{,c,m}[jt]s{,x}";
|
|
975
|
-
const GLOB_JS = "**/*.{,c,m}js";
|
|
976
975
|
const GLOB_JSX = "**/*.{,c,m}jsx";
|
|
977
|
-
const GLOB_TS = "**/*.{,c,m}ts";
|
|
978
976
|
const GLOB_TSX = "**/*.{,c,m}tsx";
|
|
979
977
|
const GLOB_DTS = "**/*.d.{,c,m}ts";
|
|
980
978
|
const GLOB_TESTS = [
|
|
@@ -1409,6 +1407,24 @@ const NATIVE_PLUGINS = /* @__PURE__ */ new Set([
|
|
|
1409
1407
|
"vue"
|
|
1410
1408
|
]);
|
|
1411
1409
|
/**
|
|
1410
|
+
* Anchor for resolving a plugin from the consumer project, used when a plugin
|
|
1411
|
+
* is a peer dependency the consumer installs rather than one we depend on.
|
|
1412
|
+
*/
|
|
1413
|
+
const consumerAnchor = pathToFileURL(`${process.cwd()}/`).href;
|
|
1414
|
+
const specifierCache = /* @__PURE__ */ new Map();
|
|
1415
|
+
/**
|
|
1416
|
+
* Resolve a jsPlugin specifier, throwing when the package is not installed.
|
|
1417
|
+
*
|
|
1418
|
+
* @param specifier - The plugin package specifier.
|
|
1419
|
+
* @returns The absolute `file://` specifier.
|
|
1420
|
+
* @throws {Error} When the package cannot be resolved.
|
|
1421
|
+
*/
|
|
1422
|
+
function resolveJsPluginSpecifier(specifier) {
|
|
1423
|
+
const resolved = tryResolveJsPlugin(specifier);
|
|
1424
|
+
if (resolved === void 0) throw new Error(`[@isentinel/eslint-config] Cannot resolve oxlint jsPlugin "${specifier}". Install it in your project, or disable the rules that require it.`);
|
|
1425
|
+
return resolved;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1412
1428
|
* Split a canonical (ESLint-named) rule map into oxlint-native rules and
|
|
1413
1429
|
* jsPlugin rules, translating rule names via the oxlint rule mapping.
|
|
1414
1430
|
*
|
|
@@ -1445,7 +1461,7 @@ function splitOxlintRules(rules, keepUnmappedOff = false) {
|
|
|
1445
1461
|
nativePlugins.add(prefix);
|
|
1446
1462
|
} else {
|
|
1447
1463
|
const specifier = oxlintJsPlugins[prefix];
|
|
1448
|
-
if (specifier !== void 0 &&
|
|
1464
|
+
if (specifier !== void 0 && canResolveJsPlugin(specifier)) {
|
|
1449
1465
|
jsPluginRules[translated] = value;
|
|
1450
1466
|
jsPluginPrefixes.add(prefix);
|
|
1451
1467
|
}
|
|
@@ -1470,7 +1486,7 @@ function splitOxlintRules(rules, keepUnmappedOff = false) {
|
|
|
1470
1486
|
if (specifier === void 0) throw new Error(`[@isentinel/eslint-config] Unknown oxlint jsPlugin prefix: ${prefix}`);
|
|
1471
1487
|
jsPlugins.push({
|
|
1472
1488
|
name: prefix,
|
|
1473
|
-
specifier
|
|
1489
|
+
specifier: resolveJsPluginSpecifier(specifier)
|
|
1474
1490
|
});
|
|
1475
1491
|
}
|
|
1476
1492
|
return {
|
|
@@ -1510,6 +1526,49 @@ function createOxlintConfigs({ name, excludeFiles, files, globals, keepUnmappedO
|
|
|
1510
1526
|
});
|
|
1511
1527
|
return fragments;
|
|
1512
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Resolve a specifier against an optional anchor, swallowing resolution errors.
|
|
1531
|
+
*
|
|
1532
|
+
* @param specifier - The plugin package specifier.
|
|
1533
|
+
* @param anchor - The URL to resolve against, or the current module by default.
|
|
1534
|
+
* @returns The resolved URL, or `undefined` when it does not resolve.
|
|
1535
|
+
*/
|
|
1536
|
+
function resolveFrom(specifier, anchor) {
|
|
1537
|
+
try {
|
|
1538
|
+
return import.meta.resolve(specifier, anchor);
|
|
1539
|
+
} catch {
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Resolve a jsPlugin package specifier to an absolute `file://` URL.
|
|
1545
|
+
*
|
|
1546
|
+
* Oxlint resolves bare `jsPlugins` specifiers relative to the consumer's config
|
|
1547
|
+
* file, which fails under pnpm's isolated node_modules: our plugin dependencies
|
|
1548
|
+
* only exist inside our own virtual store scope, never at the consumer's root.
|
|
1549
|
+
* Resolving here (from our package first, then the consumer) and emitting an
|
|
1550
|
+
* absolute specifier makes loading independent of the consumer's layout.
|
|
1551
|
+
*
|
|
1552
|
+
* @param specifier - The plugin package specifier.
|
|
1553
|
+
* @returns The resolved specifier, or `undefined` when it resolves nowhere.
|
|
1554
|
+
*/
|
|
1555
|
+
function tryResolveJsPlugin(specifier) {
|
|
1556
|
+
const cached = specifierCache.get(specifier);
|
|
1557
|
+
if (cached !== void 0 || specifierCache.has(specifier)) return cached;
|
|
1558
|
+
const resolved = resolveFrom(specifier) ?? resolveFrom(specifier, consumerAnchor);
|
|
1559
|
+
specifierCache.set(specifier, resolved);
|
|
1560
|
+
return resolved;
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Whether a jsPlugin package can be resolved from either our package or the
|
|
1564
|
+
* consumer project.
|
|
1565
|
+
*
|
|
1566
|
+
* @param specifier - The plugin package specifier.
|
|
1567
|
+
* @returns Whether the plugin is resolvable.
|
|
1568
|
+
*/
|
|
1569
|
+
function canResolveJsPlugin(specifier) {
|
|
1570
|
+
return tryResolveJsPlugin(specifier) !== void 0;
|
|
1571
|
+
}
|
|
1513
1572
|
function mappedTarget(rule) {
|
|
1514
1573
|
return oxlintRuleMapping[rule] === "js-plugin" ? "js-plugin" : "native";
|
|
1515
1574
|
}
|
|
@@ -1522,7 +1581,7 @@ function oxlintComments({ prettierOptions = {}, stylistic = true } = {}) {
|
|
|
1522
1581
|
files: [GLOB_SRC],
|
|
1523
1582
|
jsPlugins: [{
|
|
1524
1583
|
name: "oxlint-comments",
|
|
1525
|
-
specifier: "oxlint-plugin-oxlint-comments"
|
|
1584
|
+
specifier: resolveJsPluginSpecifier("oxlint-plugin-oxlint-comments")
|
|
1526
1585
|
}],
|
|
1527
1586
|
rules: {
|
|
1528
1587
|
"oxlint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
@@ -1609,7 +1668,7 @@ function oxlintDisables({ root }) {
|
|
|
1609
1668
|
files: [GLOB_DTS],
|
|
1610
1669
|
jsPlugins: [{
|
|
1611
1670
|
name: "oxlint-comments",
|
|
1612
|
-
specifier: "oxlint-plugin-oxlint-comments"
|
|
1671
|
+
specifier: resolveJsPluginSpecifier("oxlint-plugin-oxlint-comments")
|
|
1613
1672
|
}],
|
|
1614
1673
|
rules: { "oxlint-comments/no-unlimited-disable": "off" }
|
|
1615
1674
|
},
|
|
@@ -1781,25 +1840,53 @@ function oxlintEslintPlugin(options = {}) {
|
|
|
1781
1840
|
//#endregion
|
|
1782
1841
|
//#region src/rules/flawless.ts
|
|
1783
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
|
+
/**
|
|
1784
1861
|
* Base (non-React) flawless rules shared between the ESLint and oxlint
|
|
1785
1862
|
* factories. The React flawless rules live in the react rule map; the
|
|
1786
1863
|
* type-aware `flawless/naming-convention` and the non-JS `flawless/toml-*` and
|
|
1787
1864
|
* `flawless/yaml-*` rules are configured by their own configs and stay in
|
|
1788
1865
|
* ESLint.
|
|
1789
1866
|
*
|
|
1790
|
-
* @param options - Shared stylistic options.
|
|
1867
|
+
* @param options - Shared stylistic and arrow rule options.
|
|
1791
1868
|
* @returns The rule map.
|
|
1792
1869
|
*/
|
|
1793
|
-
function flawlessRules({ stylistic = true } = {}) {
|
|
1794
|
-
|
|
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
|
+
};
|
|
1795
1877
|
}
|
|
1796
1878
|
//#endregion
|
|
1797
1879
|
//#region src/oxlint/configs/flawless.ts
|
|
1798
|
-
function oxlintFlawless({ stylistic = true } = {}) {
|
|
1880
|
+
function oxlintFlawless({ stylistic = true } = {}, prettierOptions = {}) {
|
|
1799
1881
|
return createOxlintConfigs({
|
|
1800
1882
|
name: "isentinel/flawless",
|
|
1801
|
-
files: [
|
|
1802
|
-
rules: flawlessRules({
|
|
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
|
+
})
|
|
1803
1890
|
});
|
|
1804
1891
|
}
|
|
1805
1892
|
//#endregion
|
|
@@ -2339,7 +2426,6 @@ const defaultPluginRenaming = {
|
|
|
2339
2426
|
"@isentinel/eslint-plugin-comment-length": "comment-length",
|
|
2340
2427
|
"@stylistic": "style",
|
|
2341
2428
|
"@typescript-eslint": "ts",
|
|
2342
|
-
"arrow-return-style-x": "arrow-style",
|
|
2343
2429
|
"n": "node",
|
|
2344
2430
|
"yml": "yaml"
|
|
2345
2431
|
};
|
|
@@ -2361,11 +2447,11 @@ function oxlintOxfmt(options) {
|
|
|
2361
2447
|
}
|
|
2362
2448
|
if (!jsPlugins.some((plugin) => typeof plugin !== "string" && plugin.name === "style")) jsPlugins.push({
|
|
2363
2449
|
name: "style",
|
|
2364
|
-
specifier: "@stylistic/eslint-plugin"
|
|
2450
|
+
specifier: resolveJsPluginSpecifier("@stylistic/eslint-plugin")
|
|
2365
2451
|
});
|
|
2366
2452
|
const oxfmtPlugin = {
|
|
2367
2453
|
name: "oxfmt",
|
|
2368
|
-
specifier: "eslint-plugin-oxfmt"
|
|
2454
|
+
specifier: resolveJsPluginSpecifier("eslint-plugin-oxfmt")
|
|
2369
2455
|
};
|
|
2370
2456
|
const jsFiles = oxfmtFiles?.flat() ?? ["**/*.{,c,m}js", "**/*.{,c,m}jsx"];
|
|
2371
2457
|
const tsFiles = oxfmtFiles?.flat() ?? [
|
|
@@ -3031,7 +3117,6 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
|
|
|
3031
3117
|
"antfu/consistent-list-newline": "off",
|
|
3032
3118
|
"antfu/if-newline": "off",
|
|
3033
3119
|
"antfu/top-level-function": "error",
|
|
3034
|
-
"arrow-style/no-export-default-arrow": "error",
|
|
3035
3120
|
"curly": ["error", "all"],
|
|
3036
3121
|
...jsx ? { "style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }] } : {},
|
|
3037
3122
|
"style/lines-between-class-members": ["error", { enforce: [{
|
|
@@ -3084,48 +3169,14 @@ function stylisticRules({ jsx = true, quotes = "double" } = {}) {
|
|
|
3084
3169
|
]
|
|
3085
3170
|
};
|
|
3086
3171
|
}
|
|
3087
|
-
/**
|
|
3088
|
-
* Arrow return style rule shared between the ESLint and oxlint factories.
|
|
3089
|
-
*
|
|
3090
|
-
* @param options - Shared rule options.
|
|
3091
|
-
* @returns The rule map.
|
|
3092
|
-
*/
|
|
3093
|
-
function arrowStyleRules({ arrowLength, maxLength, printWidth, usePrettier } = {}) {
|
|
3094
|
-
return { "arrow-style/arrow-return-style": ["error", {
|
|
3095
|
-
jsxAlwaysUseExplicitReturn: true,
|
|
3096
|
-
maxLen: maxLength ?? arrowLength ?? printWidth ?? 100,
|
|
3097
|
-
maxObjectProperties: 2,
|
|
3098
|
-
namedExportsAlwaysUseExplicitReturn: true,
|
|
3099
|
-
objectReturnStyle: "complex-explicit",
|
|
3100
|
-
...usePrettier ? { usePrettier } : {}
|
|
3101
|
-
}] };
|
|
3102
|
-
}
|
|
3103
3172
|
//#endregion
|
|
3104
3173
|
//#region src/oxlint/configs/stylistic.ts
|
|
3105
|
-
function oxlintStylistic(options = {}
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
usePrettier: prettierOptions
|
|
3174
|
+
function oxlintStylistic(options = {}) {
|
|
3175
|
+
return createOxlintConfigs({
|
|
3176
|
+
name: "isentinel/stylistic",
|
|
3177
|
+
files: [GLOB_SRC],
|
|
3178
|
+
rules: stylisticRules(options)
|
|
3111
3179
|
});
|
|
3112
|
-
return [
|
|
3113
|
-
...createOxlintConfigs({
|
|
3114
|
-
name: "isentinel/stylistic",
|
|
3115
|
-
files: [GLOB_SRC],
|
|
3116
|
-
rules: stylisticRules(options)
|
|
3117
|
-
}),
|
|
3118
|
-
...createOxlintConfigs({
|
|
3119
|
-
name: "isentinel/stylistic/ts",
|
|
3120
|
-
files: [GLOB_TS, GLOB_TSX],
|
|
3121
|
-
rules: arrowRules
|
|
3122
|
-
}),
|
|
3123
|
-
...createOxlintConfigs({
|
|
3124
|
-
name: "isentinel/stylistic/js",
|
|
3125
|
-
files: [GLOB_JS, GLOB_JSX],
|
|
3126
|
-
rules: arrowRules
|
|
3127
|
-
})
|
|
3128
|
-
];
|
|
3129
3180
|
}
|
|
3130
3181
|
//#endregion
|
|
3131
3182
|
//#region src/rules/test.ts
|
|
@@ -3959,7 +4010,7 @@ function isentinel(factoryOptions, ...userConfigs) {
|
|
|
3959
4010
|
if (stylisticOptions !== false) configs.push(oxlintPerfectionist({
|
|
3960
4011
|
...resolveSubOptions(options, "perfectionist"),
|
|
3961
4012
|
type: projectType
|
|
3962
|
-
}), oxlintStylistic(stylisticOptions
|
|
4013
|
+
}), oxlintStylistic(stylisticOptions));
|
|
3963
4014
|
if (enableReact !== false) {
|
|
3964
4015
|
const reactOptions = typeof enableReact === "object" ? enableReact : {};
|
|
3965
4016
|
configs.push(oxlintReact({
|
|
@@ -3984,7 +4035,7 @@ function isentinel(factoryOptions, ...userConfigs) {
|
|
|
3984
4035
|
componentExts: componentExtensions,
|
|
3985
4036
|
isInEditor,
|
|
3986
4037
|
stylistic: stylisticOptions
|
|
3987
|
-
}), oxlintFlawless({ stylistic: stylisticOptions }), oxlintComments({
|
|
4038
|
+
}), oxlintFlawless({ stylistic: stylisticOptions }, prettierSettings), oxlintComments({
|
|
3988
4039
|
prettierOptions: prettierSettings,
|
|
3989
4040
|
stylistic: stylisticOptions
|
|
3990
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.
|
|
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.
|
|
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.
|
|
135
|
+
"@isentinel/eslint-config": "6.0.0-beta.12"
|
|
137
136
|
},
|
|
138
137
|
"peerDependencies": {
|
|
139
138
|
"@vitest/eslint-plugin": "^1.6.4",
|