Skip to content

chore: lint custom ts/no-arrow-parameter-types#1438

Draft
Shinigami92 wants to merge 2 commits intomainfrom
chore-lint-custom-no-arrow-parameter-types
Draft

chore: lint custom ts/no-arrow-parameter-types#1438
Shinigami92 wants to merge 2 commits intomainfrom
chore-lint-custom-no-arrow-parameter-types

Conversation

@Shinigami92
Copy link
Collaborator

No description provided.

@Shinigami92 Shinigami92 added this to the vAnytime milestone Jun 13, 2025
@Shinigami92 Shinigami92 self-assigned this Jun 13, 2025
@Shinigami92 Shinigami92 added the c: chore PR that doesn't affect the runtime behavior label Jun 13, 2025
@github-actions
Copy link

github-actions bot commented Jun 13, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.39% (🎯 90%)
⬆️ +0.06%
1456 / 1559
🔵 Statements 93.4% (🎯 90%)
🟰 ±0%
1474 / 1578
🔵 Functions 94.73% (🎯 90%)
🟰 ±0%
324 / 342
🔵 Branches 87.22% (🎯 85%)
🟰 ±0%
935 / 1072
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/db.ts 78.43%
🟰 ±0%
75%
🟰 ±0%
76.92%
🟰 ±0%
78%
🟰 ±0%
90-92, 125-137, 176, 180-181
src/migrationBuilder.ts 95.49%
🟰 ±0%
62.5%
🟰 ±0%
90%
🟰 ±0%
95.49%
🟰 ±0%
835-838, 980-984
src/operations/operators/addToOperatorFamily.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/operations/operators/removeFromOperatorFamily.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/operations/schemas/createSchema.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/operations/tables/shared.ts 86.79%
🟰 ±0%
76.76%
🟰 ±0%
76.47%
🟰 ±0%
87.61%
⬆️ +0.82%
157, 241, 261, 287, 291-297, 301, 445-463
src/operations/triggers/createTrigger.ts 88.23%
🟰 ±0%
71.79%
🟰 ±0%
100%
🟰 ±0%
88.23%
🟰 ±0%
55, 68, 72, 76-78
Unchanged Files
src/index.ts 100% 100% 100% 100%
src/logger.ts 100% 100% 100% 100%
src/migration.ts 79.66% 74.07% 79.16% 79.48% 149-151, 174-187, 235-236, 301-336, 402, 429-431, 439, 457-459, 489
src/migrationOptions.ts 100% 100% 100% 100%
src/pgType.ts 100% 100% 100% 100%
src/runner.ts 76.85% 60.56% 82.6% 76.06% 209-217, 230, 283, 328, 338-341, 355, 367-369, 393, 434-445, 450-452, 473-474, 484, 486-494
src/sqlMigration.ts 83.33% 100% 80% 83.33% 57-59
src/operations/sql.ts 100% 50% 100% 100%
src/operations/casts/createCast.ts 100% 100% 100% 100%
src/operations/casts/dropCast.ts 100% 100% 100% 100%
src/operations/casts/index.ts 100% 100% 100% 100%
src/operations/domains/alterDomain.ts 100% 100% 100% 100%
src/operations/domains/createDomain.ts 100% 95.45% 100% 100%
src/operations/domains/dropDomain.ts 100% 100% 100% 100%
src/operations/domains/index.ts 100% 100% 100% 100%
src/operations/domains/renameDomain.ts 100% 100% 100% 100%
src/operations/domains/shared.ts 100% 100% 100% 100%
src/operations/extensions/createExtension.ts 100% 100% 100% 100%
src/operations/extensions/dropExtension.ts 100% 100% 100% 100%
src/operations/extensions/index.ts 100% 100% 100% 100%
src/operations/extensions/shared.ts 100% 100% 100% 100%
src/operations/functions/createFunction.ts 96.29% 92% 100% 96.29% 71-73
src/operations/functions/dropFunction.ts 100% 100% 100% 100%
src/operations/functions/index.ts 100% 100% 100% 100%
src/operations/functions/renameFunction.ts 100% 100% 100% 100%
src/operations/functions/shared.ts 100% 100% 100% 100%
src/operations/grants/grantOnSchemas.ts 100% 100% 100% 100%
src/operations/grants/grantOnTables.ts 100% 100% 100% 100%
src/operations/grants/grantRoles.ts 100% 100% 100% 100%
src/operations/grants/index.ts 100% 100% 100% 100%
src/operations/grants/revokeOnSchemas.ts 100% 100% 100% 100%
src/operations/grants/revokeOnTables.ts 100% 100% 100% 100%
src/operations/grants/revokeRoles.ts 100% 100% 100% 100%
src/operations/grants/shared.ts 100% 75% 100% 100%
src/operations/indexes/createIndex.ts 100% 100% 100% 100%
src/operations/indexes/dropIndex.ts 100% 100% 100% 100%
src/operations/indexes/index.ts 100% 100% 100% 100%
src/operations/indexes/shared.ts 100% 88.23% 100% 100%
src/operations/materializedViews/alterMaterializedView.ts 100% 100% 100% 100%
src/operations/materializedViews/createMaterializedView.ts 100% 100% 100% 100%
src/operations/materializedViews/dropMaterializedView.ts 100% 100% 100% 100%
src/operations/materializedViews/index.ts 100% 100% 100% 100%
src/operations/materializedViews/refreshMaterializedView.ts 100% 100% 100% 100%
src/operations/materializedViews/renameMaterializedView.ts 100% 100% 100% 100%
src/operations/materializedViews/renameMaterializedViewColumn.ts 100% 100% 100% 100%
src/operations/materializedViews/shared.ts 100% 83.33% 100% 100%
src/operations/operators/createOperator.ts 100% 88.88% 100% 100%
src/operations/operators/createOperatorClass.ts 100% 75% 100% 100%
src/operations/operators/createOperatorFamily.ts 100% 100% 100% 100%
src/operations/operators/dropOperator.ts 100% 100% 100% 100%
src/operations/operators/dropOperatorClass.ts 100% 100% 100% 100%
src/operations/operators/dropOperatorFamily.ts 100% 100% 100% 100%
src/operations/operators/index.ts 100% 100% 100% 100%
src/operations/operators/renameOperatorClass.ts 100% 100% 100% 100%
src/operations/operators/renameOperatorFamily.ts 100% 100% 100% 100%
src/operations/operators/shared.ts 81.81% 77.77% 100% 81.81% 24, 38
src/operations/policies/alterPolicy.ts 100% 100% 100% 100%
src/operations/policies/createPolicy.ts 100% 100% 100% 100%
src/operations/policies/dropPolicy.ts 100% 100% 100% 100%
src/operations/policies/index.ts 100% 100% 100% 100%
src/operations/policies/renamePolicy.ts 100% 100% 100% 100%
src/operations/policies/shared.ts 100% 100% 100% 100%
src/operations/roles/alterRole.ts 100% 100% 100% 100%
src/operations/roles/createRole.ts 100% 92.3% 100% 100%
src/operations/roles/dropRole.ts 100% 100% 100% 100%
src/operations/roles/index.ts 100% 100% 100% 100%
src/operations/roles/renameRole.ts 100% 100% 100% 100%
src/operations/roles/shared.ts 100% 86.66% 100% 100%
src/operations/schemas/dropSchema.ts 100% 100% 100% 100%
src/operations/schemas/index.ts 100% 100% 100% 100%
src/operations/schemas/renameSchema.ts 100% 100% 100% 100%
src/operations/sequences/alterSequence.ts 90% 83.33% 100% 90% 23
src/operations/sequences/createSequence.ts 100% 100% 100% 100%
src/operations/sequences/dropSequence.ts 100% 100% 100% 100%
src/operations/sequences/index.ts 100% 100% 100% 100%
src/operations/sequences/renameSequence.ts 100% 100% 100% 100%
src/operations/sequences/shared.ts 81.48% 83.33% 100% 81.48% 41, 43, 49, 63, 69
src/operations/tables/addColumns.ts 100% 85.71% 100% 100%
src/operations/tables/addConstraint.ts 100% 100% 100% 100%
src/operations/tables/alterColumn.ts 91.17% 81.25% 100% 91.17% 69, 76-83
src/operations/tables/alterTable.ts 100% 100% 100% 100%
src/operations/tables/createTable.ts 88% 82.14% 100% 88% 51-54, 92
src/operations/tables/dropColumns.ts 100% 100% 100% 100%
src/operations/tables/dropConstraint.ts 100% 100% 100% 100%
src/operations/tables/dropTable.ts 100% 100% 100% 100%
src/operations/tables/index.ts 100% 100% 100% 100%
src/operations/tables/renameColumn.ts 100% 100% 100% 100%
src/operations/tables/renameConstraint.ts 100% 100% 100% 100%
src/operations/tables/renameTable.ts 100% 100% 100% 100%
src/operations/triggers/dropTrigger.ts 100% 100% 100% 100%
src/operations/triggers/index.ts 100% 100% 100% 100%
src/operations/triggers/renameTrigger.ts 100% 100% 100% 100%
src/operations/triggers/shared.ts 100% 100% 100% 100%
src/operations/types/addTypeAttribute.ts 100% 100% 100% 100%
src/operations/types/addTypeValue.ts 100% 100% 100% 100%
src/operations/types/createType.ts 100% 100% 100% 100%
src/operations/types/dropType.ts 100% 100% 100% 100%
src/operations/types/dropTypeAttribute.ts 100% 100% 100% 100%
src/operations/types/index.ts 100% 100% 100% 100%
src/operations/types/renameType.ts 100% 100% 100% 100%
src/operations/types/renameTypeAttribute.ts 100% 100% 100% 100%
src/operations/types/renameTypeValue.ts 100% 100% 100% 100%
src/operations/types/setTypeAttribute.ts 100% 100% 100% 100%
src/operations/views/alterView.ts 100% 100% 100% 100%
src/operations/views/alterViewColumn.ts 100% 100% 100% 100%
src/operations/views/createView.ts 100% 100% 100% 100%
src/operations/views/dropView.ts 100% 100% 100% 100%
src/operations/views/index.ts 100% 100% 100% 100%
src/operations/views/renameView.ts 100% 100% 100% 100%
src/operations/views/shared.ts 100% 50% 100% 100%
src/utils/PgLiteral.ts 100% 100% 100% 100%
src/utils/createSchemalize.ts 96.42% 93.54% 100% 96.29% 84
src/utils/createTransformer.ts 100% 100% 100% 100%
src/utils/decamelize.ts 100% 100% 100% 100%
src/utils/escapeValue.ts 100% 100% 100% 100%
src/utils/formatLines.ts 100% 100% 100% 100%
src/utils/formatParams.ts 100% 87.5% 100% 100%
src/utils/formatPartitionColumns.ts 100% 100% 100% 100%
src/utils/getMigrationTableSchema.ts 100% 100% 100% 100%
src/utils/getSchemas.ts 100% 100% 100% 100%
src/utils/identity.ts 100% 100% 100% 100%
src/utils/index.ts 100% 100% 100% 100%
src/utils/intersection.ts 100% 100% 100% 100%
src/utils/makeComment.ts 100% 100% 100% 100%
src/utils/quote.ts 100% 100% 100% 100%
src/utils/stringIdGenerator.ts 100% 100% 100% 100%
src/utils/toArray.ts 100% 100% 100% 100%
src/utils/types.ts 100% 100% 100% 100%
Generated in workflow #3030 for commit 9d2bb6c by the Vitest Coverage Report Action

@Shinigami92
Copy link
Collaborator Author

@bradzacher @JoshuaKGoldberg Hey typescript-lint maintainers.

I'm currently working again with many trainees in my company work. There I have the issue that they write a lot code like e.g.:

const someElements = getElements()
//    ^? = any[]

someElements.filter((element: Element) => element.needed)
//                          ~~~~~~~~~ <- I don't want these arrow-parameter types

This is all over the codebase in multiple projects. (I'm new in that company)
Now I would like to create an eslint rule that explains trainees that they should think about what they are typing and where.
So instead of adding a type annotation in every arrow-callback function, they should add a type annotation to the variable or return-type.

e.g.

function getElements(): Element[] { return [] }
// or
const someElements: Element[] = getElements()

someElements.filter((element) => element.needed)
//                   ~~~~~~~ <- now gets inferred as Element 🎉 

So my question to you typescript-lint maintainers is: Are you interested in such a rule proposal?
I would battle-test it in some more repos first and next week at work.
Or is there something fundamentally that speaks against using such a rule in typescript-lint?

@JoshuaKGoldberg
Copy link

Are you interested in such a rule proposal?

I'd say in general the right next step would be to file an issue asking this in typescript-eslint. Even if the idea isn't something that lands in core, that'd give it more visibility. If you end up writing your own custom plugin that'd be a good place to mention it.

Though...

// ^? = any[]

This seems like the root problem, no? That folks are having anys in places? We generally don't add a lot of rules for situations that boil down to "there's an any and now other things are unsafe".

Also: typescript-eslint/typescript-eslint#2673 is another example of why these kinds of rules can be surprisingly difficult to write.

@Shinigami92 Shinigami92 force-pushed the chore-lint-custom-no-arrow-parameter-types branch from ecec39e to 42fe865 Compare June 16, 2025 14:36
@Shinigami92 Shinigami92 force-pushed the chore-lint-custom-no-arrow-parameter-types branch from 42fe865 to e8140f3 Compare July 4, 2025 07:19
@Shinigami92 Shinigami92 force-pushed the chore-lint-custom-no-arrow-parameter-types branch from fa37ccd to a9b74f9 Compare January 14, 2026 10:33
@Shinigami92 Shinigami92 force-pushed the chore-lint-custom-no-arrow-parameter-types branch from a9b74f9 to 9d2bb6c Compare March 17, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: chore PR that doesn't affect the runtime behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants