Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Record instead of index signatures #409

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-monkeys-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/eslint-plugin': major
---

Change the @typescript-eslint/consistent-indexed-object-style rule to use default error settings, aka Record over index signature
5 changes: 1 addition & 4 deletions packages/eslint-plugin/lib/config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,7 @@ module.exports = {
// Requires that private members are marked as readonly if they're never modified outside of the constructor
'@typescript-eslint/prefer-readonly': 'off',
// This rule enforces a consistent way to define records.
'@typescript-eslint/consistent-indexed-object-style': [
'error',
'index-signature',
],
'@typescript-eslint/consistent-indexed-object-style': 'error',
// Disallows unnecessary constraints on generic types
'@typescript-eslint/no-unnecessary-type-constraint': 'error',

Expand Down
2 changes: 1 addition & 1 deletion packages/images/optimize.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export function svgOptions(): {[key: string]: unknown};
export function svgOptions(): Record<string, unknown>;
4 changes: 2 additions & 2 deletions packages/typescript-configs/definitions/styles.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
declare module '*.scss' {
const classNames: {[key: string]: string};
const classNames: Record<string, string>;
export default classNames;
}

declare module '*.css' {
const classNames: {[key: string]: string};
const classNames: Record<string, string>;
export default classNames;
}