Skip to content

Commit

Permalink
Apply patches
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Jul 20, 2023
1 parent 8616bc0 commit 3891467
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 317 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"@types/eslint": "~8.44.0",
"@types/json-schema": "~7.0.12",
"@types/node": "~20.4.2",
"@typescript-eslint/eslint-plugin": "~6.1.0",
"@typescript-eslint/parser": "~6.1.0",
"@typescript-eslint/eslint-plugin": "~5.62.0",
"@typescript-eslint/parser": "~5.62.0",
"change-case": "~4.1.2",
"eslint": "~8.45.0",
"eslint-config-prettier": "~8.8.0",
Expand Down
281 changes: 104 additions & 177 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git b/src/rules/typescript-eslint/array-type.d.ts a/src/rules/typescript-eslint/array-type.d.ts
index 98cd312..fe661fc 100644
--- b/src/rules/typescript-eslint/array-type.d.ts
+++ a/src/rules/typescript-eslint/array-type.d.ts
diff --git a/src/rules/typescript-eslint/array-type.d.ts b/src/rules/typescript-eslint/array-type.d.ts
index 98cd312..e40ebb3 100644
--- a/src/rules/typescript-eslint/array-type.d.ts
+++ b/src/rules/typescript-eslint/array-type.d.ts
@@ -3,12 +3,16 @@ import type { RuleConfig } from '../rule-config';
/**
* Option.
Expand All @@ -17,7 +17,7 @@ index 98cd312..fe661fc 100644
* Options.
*/
-export type ArrayTypeOptions = ArrayTypeOption;
+export type ArrayTypeOptions = [ArrayTypeOption?];
+export type ArrayTypeOptions = [ArrayTypeOption];

/**
* Require consistently using either `T[]` or `Array<T>` for arrays.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git b/src/rules/typescript-eslint/ban-ts-comment.d.ts a/src/rules/typescript-eslint/ban-ts-comment.d.ts
index 111f9c9..5d489f8 100644
--- b/src/rules/typescript-eslint/ban-ts-comment.d.ts
+++ a/src/rules/typescript-eslint/ban-ts-comment.d.ts
diff --git a/src/rules/typescript-eslint/ban-ts-comment.d.ts b/src/rules/typescript-eslint/ban-ts-comment.d.ts
index 111f9c9..6015012 100644
--- a/src/rules/typescript-eslint/ban-ts-comment.d.ts
+++ b/src/rules/typescript-eslint/ban-ts-comment.d.ts
@@ -3,12 +3,42 @@ import type { RuleConfig } from '../rule-config';
/**
* Option.
Expand Down Expand Up @@ -43,7 +43,7 @@ index 111f9c9..5d489f8 100644
* Options.
*/
-export type BanTsCommentOptions = BanTsCommentOption;
+export type BanTsCommentOptions = [BanTsCommentOption?];
+export type BanTsCommentOptions = [BanTsCommentOption];

/**
* Disallow `@ts-<directive>` comments or require descriptions after directives.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git b/src/rules/typescript-eslint/explicit-member-accessibility.d.ts a/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
diff --git a/src/rules/typescript-eslint/explicit-member-accessibility.d.ts b/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
index b585e26..1711d51 100644
--- b/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
+++ a/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
--- a/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
+++ b/src/rules/typescript-eslint/explicit-member-accessibility.d.ts
@@ -3,13 +3,24 @@ import type { RuleConfig } from '../rule-config';
/**
* Option.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git b/src/rules/typescript-eslint/lines-between-class-members.d.ts a/src/rules/typescript-eslint/lines-between-class-members.d.ts
diff --git a/src/rules/typescript-eslint/lines-between-class-members.d.ts b/src/rules/typescript-eslint/lines-between-class-members.d.ts
index 46caad7..afdd87e 100644
--- b/src/rules/typescript-eslint/lines-between-class-members.d.ts
+++ a/src/rules/typescript-eslint/lines-between-class-members.d.ts
--- a/src/rules/typescript-eslint/lines-between-class-members.d.ts
+++ b/src/rules/typescript-eslint/lines-between-class-members.d.ts
@@ -1,16 +1,23 @@
+import type {
+ LinesBetweenClassMembersConfig as BaseConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git b/src/rules/typescript-eslint/parameter-properties.d.ts a/src/rules/typescript-eslint/parameter-properties.d.ts
diff --git a/src/rules/typescript-eslint/parameter-properties.d.ts b/src/rules/typescript-eslint/parameter-properties.d.ts
index 6b0f176..591a9a4 100644
--- b/src/rules/typescript-eslint/parameter-properties.d.ts
+++ a/src/rules/typescript-eslint/parameter-properties.d.ts
--- a/src/rules/typescript-eslint/parameter-properties.d.ts
+++ b/src/rules/typescript-eslint/parameter-properties.d.ts
@@ -3,12 +3,37 @@ import type { RuleConfig } from '../rule-config';
/**
* Option.
Expand Down

This file was deleted.

This file was deleted.

21 changes: 15 additions & 6 deletions scripts/generate-rule-files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ import { RuleFile } from './src/rule-file';

const __dirname: string = fileURLToPath(new URL('.', import.meta.url));

interface FailedRule {
ruleName: string;
err: unknown;
}

/**
* Generate the `index.d.ts` file for the plugin's rules that will re-export all rules.
*/
async function generateRuleIndexFile(
pluginDirectory: string,
{ rules, name }: Plugin,
failedRules: string[],
failedRules: FailedRule[],
): Promise<void> {
if (!rules) {
throw new Error(
Expand All @@ -28,7 +33,8 @@ async function generateRuleIndexFile(
}

const generatedRules: string[] = Object.keys(rules).filter(
(ruleName) => !failedRules.includes(ruleName),
(ruleName) =>
!failedRules.some((failedRule) => failedRule.ruleName === ruleName),
);

/**
Expand Down Expand Up @@ -68,7 +74,7 @@ async function generateRuleIndexFile(
*/
function printGenerationReport(
rules: Array<[string, Rule.RuleModule]>,
failedRules: string[],
failedRules: FailedRule[],
): void {
const msg: string = ` ✅ Generated ${
rules.length - failedRules.length
Expand All @@ -78,6 +84,9 @@ function printGenerationReport(

if (failedRules.length) {
logger.log(logger.colors.red(` ❌ Failed ${failedRules.length} rules`));
failedRules.forEach(({ ruleName, err }) => {
logger.log(logger.colors.red(` - ${ruleName}: ${String(err)}`));
});
}

logger.log('');
Expand All @@ -89,8 +98,8 @@ function printGenerationReport(
async function generateRulesFiles(
plugin: Plugin,
pluginDirectory: string,
): Promise<{ failedRules: string[] }> {
const failedRules: string[] = [];
): Promise<{ failedRules: FailedRule[] }> {
const failedRules: FailedRule[] = [];

const pluginRules: PluginRules | undefined = plugin.rules;
if (!pluginRules) {
Expand All @@ -114,7 +123,7 @@ async function generateRulesFiles(
ruleFile.writeGeneratedContent();
ruleFile.applyPatch();
} catch (err) {
failedRules.push(ruleName);
failedRules.push({ ruleName, err });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/rules/typescript-eslint/array-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ArrayTypeOption {
/**
* Options.
*/
export type ArrayTypeOptions = [ArrayTypeOption?];
export type ArrayTypeOptions = [ArrayTypeOption];

/**
* Require consistently using either `T[]` or `Array<T>` for arrays.
Expand Down
2 changes: 1 addition & 1 deletion src/rules/typescript-eslint/ban-ts-comment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface BanTsCommentOption {
/**
* Options.
*/
export type BanTsCommentOptions = [BanTsCommentOption?];
export type BanTsCommentOptions = [BanTsCommentOption];

/**
* Disallow `@ts-<directive>` comments or require descriptions after directives.
Expand Down
1 change: 1 addition & 0 deletions src/rules/typescript-eslint/no-extra-parens.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type NoExtraParensOption =
'all',
{
conditionalAssign?: boolean;
ternaryOperandBinaryExpressions?: boolean;
nestedBinaryExpressions?: boolean;
returnAssign?: boolean;
ignoreJSX?: 'none' | 'all' | 'single-line' | 'multi-line';
Expand Down
11 changes: 9 additions & 2 deletions src/rules/typescript-eslint/prefer-nullish-coalescing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ import type { RuleConfig } from '../rule-config';
* Option.
*/
export interface PreferNullishCoalescingOption {
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
ignoreConditionalTests?: boolean;
ignoreTernaryTests?: boolean;
ignoreMixedLogicalExpressions?: boolean;
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
ignorePrimitives?: {
bigint?: boolean;
boolean?: boolean;
number?: boolean;
string?: boolean;
[k: string]: any;
};
ignoreTernaryTests?: boolean;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/rules/unicorn/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { EscapeCaseRule } from './escape-case';
import type { ExpiringTodoCommentsRule } from './expiring-todo-comments';
import type { ExplicitLengthCheckRule } from './explicit-length-check';
import type { FilenameCaseRule } from './filename-case';
import type { ImportIndexRule } from './import-index';
import type { ImportStyleRule } from './import-style';
import type { NewForBuiltinsRule } from './new-for-builtins';
import type { NoAbusiveEslintDisableRule } from './no-abusive-eslint-disable';
Expand Down Expand Up @@ -87,6 +88,7 @@ import type { PreferModuleRule } from './prefer-module';
import type { PreferNativeCoercionFunctionsRule } from './prefer-native-coercion-functions';
import type { PreferNegativeIndexRule } from './prefer-negative-index';
import type { PreferNodeAppendRule } from './prefer-node-append';
import type { PreferNodeProtocolRule } from './prefer-node-protocol';
import type { PreferNodeRemoveRule } from './prefer-node-remove';
import type { PreferNumberPropertiesRule } from './prefer-number-properties';
import type { PreferObjectFromEntriesRule } from './prefer-object-from-entries';
Expand Down Expand Up @@ -206,6 +208,7 @@ export type UnicornRules = BetterRegexRule &
PreferModuleRule &
PreferNativeCoercionFunctionsRule &
PreferNegativeIndexRule &
PreferNodeProtocolRule &
PreferNumberPropertiesRule &
PreferObjectFromEntriesRule &
PreferOptionalCatchBindingRule &
Expand Down Expand Up @@ -234,6 +237,7 @@ export type UnicornRules = BetterRegexRule &
TemplateIndentRule &
TextEncodingIdentifierCaseRule &
ThrowNewErrorRule &
ImportIndexRule &
NoArrayInstanceofRule &
NoFnReferenceInIteratorRule &
NoReduceRule &
Expand Down

0 comments on commit 3891467

Please sign in to comment.