Skip to content

Commit b091b1f

Browse files
committed
fixes
1 parent e4982f3 commit b091b1f

File tree

2 files changed

+5
-29
lines changed

2 files changed

+5
-29
lines changed

packages/migrations/src/actions/2025.03.26T00-00-00.graphql-eslint.v4.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default {
1515
if (v3Config && typeof v3Config === 'object') {
1616
const v4Config = migrateConfig(v3Config as any as Record<string, RuleStruct>);
1717

18-
console.log('after', JSON.stringify(v4Config, null, 2));
1918
await connection.query(
2019
sql`UPDATE schema_policy_config SET config = ${sql.json(v4Config)} WHERE resource_type = ${resource_type} AND resource_id = ${resource_id}`,
2120
);
@@ -71,12 +70,6 @@ function migrateRuleConfig(ruleName: string, options: any) {
7170
options: alphabetize(options),
7271
};
7372
}
74-
case 'require-description': {
75-
return {
76-
ruleName: 'require-description',
77-
options: requireDescription(options),
78-
};
79-
}
8073
case 'no-case-insensitive-enum-values-duplicates': {
8174
return {
8275
ruleName: 'unique-enum-value-names',
@@ -92,6 +85,10 @@ function migrateRuleConfig(ruleName: string, options: any) {
9285
}
9386
}
9487

88+
/**
89+
* "alphabetize" changed "values" to a boolean instead of an array. If the array has value (can be only 1), we replace it with "true".
90+
* Otherwise, "false".
91+
*/
9592
function alphabetize(cfgSource: any) {
9693
const cfg = JSON.parse(JSON.stringify(cfgSource));
9794

@@ -105,21 +102,3 @@ function alphabetize(cfgSource: any) {
105102

106103
return cfg;
107104
}
108-
109-
function requireDescription(cfgSource: any) {
110-
const cfg = JSON.parse(JSON.stringify(cfgSource));
111-
112-
if ('rootField' in cfg) {
113-
if (typeof cfg.rootField === 'boolean' && cfg.rootField === false) {
114-
cfg.rootField = undefined;
115-
}
116-
}
117-
118-
if ('types' in cfg) {
119-
if (typeof cfg.types === 'boolean' && cfg.types === false) {
120-
cfg.types = undefined;
121-
}
122-
}
123-
124-
return cfg;
125-
}

packages/migrations/test/2025.03.26T00-00-00.policy-eslint-v4-upgrade.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const TEST_CASES: Array<{ in: any; out: any }> = [
198198
1,
199199
{
200200
types: true,
201+
rootField: false,
201202
FieldDefinition: false,
202203
EnumTypeDefinition: false,
203204
DirectiveDefinition: false,
@@ -210,10 +211,6 @@ const TEST_CASES: Array<{ in: any; out: any }> = [
210211
'require-deprecation-reason': [1],
211212
},
212213
},
213-
{
214-
in: { 'require-description': [1, { types: false }] },
215-
out: { 'require-description': [1, {}] },
216-
},
217214
];
218215

219216
await describe('migration: policy upgrade: graphql-eslint v3 -> v4', async () => {

0 commit comments

Comments
 (0)