Skip to content

Commit

Permalink
fix: improve error output
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Jun 3, 2023
1 parent 01a2f18 commit c1ad261
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions rules/sort-array-includes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { SortingNode } from '../typings'
import { AST_NODE_TYPES } from '@typescript-eslint/types'

import { createEslintRule } from '../utils/create-eslint-rule'
import { toSingleLine } from '../utils/to-single-line'
import { rangeToDiff } from '../utils/range-to-diff'
import { SortType, SortOrder } from '../typings'
import { sortNodes } from '../utils/sort-nodes'
Expand Down Expand Up @@ -143,8 +144,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
context.report({
messageId: 'unexpectedArrayIncludesOrder',
data: {
first: first.name,
second: second.name,
first: toSingleLine(first.name),
second: toSingleLine(second.name),
},
node: second.node,
fix: fixer => {
Expand Down
5 changes: 3 additions & 2 deletions rules/sort-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { SortingNode } from '../typings'
import { AST_NODE_TYPES } from '@typescript-eslint/types'

import { createEslintRule } from '../utils/create-eslint-rule'
import { toSingleLine } from '../utils/to-single-line'
import { rangeToDiff } from '../utils/range-to-diff'
import { SortType, SortOrder } from '../typings'
import { sortNodes } from '../utils/sort-nodes'
Expand Down Expand Up @@ -91,8 +92,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
context.report({
messageId: 'unexpectedEnumsOrder',
data: {
first: first.name,
second: second.name,
first: toSingleLine(first.name),
second: toSingleLine(second.name),
},
node: second.node,
fix: fixer =>
Expand Down
5 changes: 3 additions & 2 deletions rules/sort-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types'
import { minimatch } from 'minimatch'

import { createEslintRule } from '../utils/create-eslint-rule'
import { toSingleLine } from '../utils/to-single-line'
import { rangeToDiff } from '../utils/range-to-diff'
import { SortType, SortOrder } from '../typings'
import { sortNodes } from '../utils/sort-nodes'
Expand Down Expand Up @@ -129,8 +130,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
context.report({
messageId: 'unexpectedInterfacePropertiesOrder',
data: {
first: first.name,
second: second.name,
first: toSingleLine(first.name),
second: toSingleLine(second.name),
},
node: second.node,
fix: fixer =>
Expand Down
5 changes: 3 additions & 2 deletions rules/sort-map-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { SortingNode } from '../typings'
import { AST_NODE_TYPES } from '@typescript-eslint/types'

import { createEslintRule } from '../utils/create-eslint-rule'
import { toSingleLine } from '../utils/to-single-line'
import { rangeToDiff } from '../utils/range-to-diff'
import { SortType, SortOrder } from '../typings'
import { sortNodes } from '../utils/sort-nodes'
Expand Down Expand Up @@ -133,8 +134,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
context.report({
messageId: 'unexpectedMapElementsOrder',
data: {
first: first.name,
second: second.name,
first: toSingleLine(first.name),
second: toSingleLine(second.name),
},
node: second.node,
fix: fixer =>
Expand Down
5 changes: 3 additions & 2 deletions rules/sort-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { SortingNode } from '../typings'
import { AST_NODE_TYPES } from '@typescript-eslint/types'

import { createEslintRule } from '../utils/create-eslint-rule'
import { toSingleLine } from '../utils/to-single-line'
import { rangeToDiff } from '../utils/range-to-diff'
import { SortType, SortOrder } from '../typings'
import { sortNodes } from '../utils/sort-nodes'
Expand Down Expand Up @@ -162,8 +163,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
context.report({
messageId: 'unexpectedObjectsOrder',
data: {
first: first.name,
second: second.name,
first: toSingleLine(first.name),
second: toSingleLine(second.name),
},
node: second.node,
fix: fixer => {
Expand Down

0 comments on commit c1ad261

Please sign in to comment.