Skip to content

Commit 214ba33

Browse files
committed
fix: revert regression caused by eslint
1 parent 7ea8395 commit 214ba33

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default [
2828
'react/jsx-tag-spacing': 'off',
2929
'unicorn/no-array-reduce': 'off',
3030
'unicorn/prefer-array-find': 'off',
31+
'unicorn/prefer-math-min-max': 'off',
3132
'unicorn/prefer-module': 'off',
3233
},
3334
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"author": "Salesforce",
66
"bugs": "https://github.com/oclif/table/issues",
77
"dependencies": {
8-
"@oclif/core": "^4",
98
"@types/react": "^18.3.12",
109
"change-case": "^5.4.4",
1110
"cli-truncate": "^4.0.0",
@@ -19,6 +18,7 @@
1918
"devDependencies": {
2019
"@commitlint/config-conventional": "^19",
2120
"@eslint/compat": "^1.2.6",
21+
"@oclif/core": "^4",
2222
"@oclif/prettier-config": "^0.2.1",
2323
"@oclif/test": "^4.1.8",
2424
"@types/chai": "^4.3.16",

src/table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
*/
4242
function determineWidthToUse<T>(columns: Column<T>[], maxWidth: number, width: number | undefined): number {
4343
const tableWidth = columns.map((c) => c.width).reduce((a, b) => a + b, 0) + columns.length + 1
44-
return width ?? Math.max(tableWidth, maxWidth)
44+
return width ?? (tableWidth < maxWidth ? maxWidth : tableWidth)
4545
}
4646

4747
function determineTruncatePosition(overflow: Overflow): 'start' | 'middle' | 'end' {

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export function getColumns<T extends Record<string, unknown>>(config: Config<T>,
135135

136136
const minWidth = calcMinWidth(largestColumn)
137137
const difference = tableWidth - maxWidth
138-
const newWidth = Math.max(largestColumn.width - difference, minWidth)
138+
const newWidth = largestColumn.width - difference < minWidth ? minWidth : largestColumn.width - difference
139139
largestColumn.width = newWidth
140140
tableWidth = calculateTableWidth(widths)
141141
seen.add(largestColumn.key)

yarn.lock

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@
350350
integrity sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==
351351

352352
"@oclif/core@^4":
353-
version "4.2.5"
354-
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.2.5.tgz#6b51e1db17272204b2431fee3eba93a21d59ebbe"
355-
integrity sha512-bdXOojq8GaPnWnDgVOw030JlUROJEiDLXiV3XUUGUQDEp6YpVQvEYLIrUsEvyfASU3z3FGg3DC9k0kprcOYdhw==
353+
version "4.2.6"
354+
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.2.6.tgz#f2f1696be03a815a4c391504312f90fce29fbb4e"
355+
integrity sha512-agk1Tlm7qMemWx+qq5aNgkYwX2JCkoVP4M0ruFveJrarmdUPbKZTMW1j/eg8lNKZh1sp68ytZyKhYXYEfRPcww==
356356
dependencies:
357357
ansi-escapes "^4.3.2"
358-
ansis "^3.9.0"
358+
ansis "^3.10.0"
359359
clean-stack "^3.0.1"
360360
cli-spinners "^2.9.2"
361361
debug "^4.4.0"
@@ -939,9 +939,9 @@ assertion-error@^1.1.0:
939939
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
940940

941941
async@^3.2.3:
942-
version "3.2.5"
943-
resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66"
944-
integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==
942+
version "3.2.6"
943+
resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce"
944+
integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==
945945

946946
auto-bind@^5.0.1:
947947
version "5.0.1"
@@ -2201,7 +2201,18 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
22012201
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
22022202
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
22032203

2204-
fast-glob@^3.2.9, fast-glob@^3.3.2:
2204+
fast-glob@^3.2.9:
2205+
version "3.3.3"
2206+
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818"
2207+
integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==
2208+
dependencies:
2209+
"@nodelib/fs.stat" "^2.0.2"
2210+
"@nodelib/fs.walk" "^1.2.3"
2211+
glob-parent "^5.1.2"
2212+
merge2 "^1.3.0"
2213+
micromatch "^4.0.8"
2214+
2215+
fast-glob@^3.3.2:
22052216
version "3.3.2"
22062217
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
22072218
integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==

0 commit comments

Comments
 (0)