Skip to content

Commit

Permalink
feat: add rule consistent-indexed-object-style
Browse files Browse the repository at this point in the history
BREAKING CHANGE: add rule consistent-indexed-object-style
  • Loading branch information
mightyiam committed Dec 14, 2022
1 parent 80daab8 commit 2edd0af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/index.test.ts
Expand Up @@ -95,6 +95,7 @@ test('export', (t): void => {
tuples: 'ignore'
}],
'@typescript-eslint/comma-spacing': ['error', { before: false, after: true }],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Expand Up @@ -34,8 +34,8 @@ const ruleFromStandard = (name: string): Linter.RuleEntry => {
return JSON.parse(JSON.stringify(rule))
}

function fromEntries<T> (iterable: Array<[string, T]>): { [key: string]: T } {
return [...iterable].reduce<{ [key: string]: T }>((obj, [key, val]) => {
function fromEntries<T> (iterable: Array<[string, T]>): Record<string, T> {
return [...iterable].reduce<Record<string, T>>((obj, [key, val]) => {
obj[key] = val
return obj
}, {})
Expand Down Expand Up @@ -82,6 +82,7 @@ const config: Linter.Config = {
generics: 'ignore',
tuples: 'ignore'
}],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
Expand Down

0 comments on commit 2edd0af

Please sign in to comment.