-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: make xo happy #145
fix: make xo happy #145
Conversation
You need to update XO for this. Please also always run |
done |
index.d.ts
Outdated
@@ -21,7 +21,7 @@ export type ColorSupportLevel = 0 | 1 | 2 | 3; | |||
/** | |||
Detect whether the terminal supports color. | |||
*/ | |||
export interface ColorSupport { | |||
export type ColorSupport = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the same. What was the XO error message about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the same. What was the XO error message about?
Use a type instead of an interface. @typescript-eslint/consistent-type-definitions
browser.js
Outdated
@@ -3,7 +3,7 @@ | |||
const level = (() => { | |||
if (navigator.userAgentData) { | |||
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'); | |||
if (brand?.version > 93) { | |||
if (brand && brand.version > 93) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this fixes or improves anything, what was the XO error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this fixes or improves anything, what was the XO error?
Error - Optional chainings are not supported until Node.js 14.0.0. The configured version range is '^12.17.0 || ^14.13 || >=16.0.0'. (n/no-unsupported-features/es-syntax)
index.js
Outdated
@@ -3,7 +3,7 @@ import os from 'node:os'; | |||
import tty from 'node:tty'; | |||
|
|||
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js | |||
function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) { | |||
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this as an improvement. What was the XO error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this as an improvement. What was the XO error?
line 6, col 46, Error - Optional chainings are not supported until Node.js 14.0.0. The configured version range is '^12.17.0 || ^14.13 || >=16.0.0'. (n/no-unsupported-features/es-syntax)
line 6, col 53, Error - Nullish coalescing operators are not supported until Node.js 14.0.0. The configured version range is '^12.17.0 || ^14.13 || >=16.0.0'. (n/no-unsupported-features/es-syntax)
@@ -141,6 +141,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { | |||
case 'iTerm.app': { | |||
return version >= 3 ? 3 : 2; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this an error?
Error - Missing braces in case clause. (unicorn/switch-case-braces)
Maybe we can try using esbuild. |
index.test-d.ts
Outdated
import type {Options, ColorInfo} from './index.d'; | ||
import supportsColor, {createSupportsColor} from './index.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a single import
Just downgrade XO to the last version that supports Node.js 12. I don't want to do a major release right now. I prefer to wait a few months until we can target Node.js 16. |
done |
fix:
from https://github.com/chalk/chalk/actions/runs/3638940747/jobs/6142101330