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

simplify dependencies #159

Merged
merged 4 commits into from
Apr 22, 2021
Merged

Conversation

jeremyVignelles
Copy link
Contributor

This PR helps reducing the number of packages downloaded and installed on a project,
when this repository is used directly or indirectly (through eslint for example).

Each commit contains a rationale about each change:

  • Removed usage of is-boolean-object
  • Removed is-number-object dependency
  • Removed the dependency on is-string
  • Removed unused dev dependencies

This package was only used once, and incorrectly.
is-boolean-object checks whether the input is `true`, `false`
or an object created with the `Boolean` constructor.
I doubt that this last case was really intended and properly supported
since the Typescript type is `boolean` (so, only true/false) and
the only code that uses the boolean is this one:

```ts
if (useWrapWord) {
```

however, `if (new Boolean(false))` yields `true`.
This library checks whether the input is a number or a Number object
(i.e. created with `new Number(5)`). I never saw anyone using the latter
syntax, and I'm not sure the 17+kB-and-10-files dependency is
really useful.

This is a breaking change since `new Number(5)` will not be allowed
anymore for column width. Does anyone really do that?

This change is in line with the typescript type annotations for the width,
which only allow `number`s to be provided.
The package tests whether the input is a string or a string object
(i.e. created with `new Object('hello')`). I'm not sure we should
support the latter syntax, especially since the string is passed
to string-width, which explicitely returns 0 if `typeof` doesn't
return `string` : https://github.com/sindresorhus/string-width/blob/89eb79aafd2b7db982dc1f5498424232d55dee53/index.js#L6

This is a breaking change in the strict sense, because the behavior
would change if such "string-object" was indeed passed as a value,
but that would result in an empty cell, so that probably doesn't matter
and avoids a dependency on a 16+kB and 10 files
@coveralls
Copy link

coveralls commented Apr 22, 2021

Pull Request Test Coverage Report for Build 302

  • 6 of 6 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 99.784%

Totals Coverage Status
Change from base Build 288: -0.001%
Covered Lines: 340
Relevant Lines: 340

💛 - Coveralls

@gajus gajus merged commit 66ff661 into gajus:master Apr 22, 2021
@gajus
Copy link
Owner

gajus commented Apr 22, 2021

🎉 This PR is included in version 6.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Apr 22, 2021
nam-hle pushed a commit to nam-hle/table that referenced this pull request Apr 23, 2021
* Removed usage of is-boolean-object

This package was only used once, and incorrectly.
is-boolean-object checks whether the input is `true`, `false`
or an object created with the `Boolean` constructor.
I doubt that this last case was really intended and properly supported
since the Typescript type is `boolean` (so, only true/false) and
the only code that uses the boolean is this one:

```ts
if (useWrapWord) {
```

however, `if (new Boolean(false))` yields `true`.

* Removed `is-number-object` dependency

This library checks whether the input is a number or a Number object
(i.e. created with `new Number(5)`). I never saw anyone using the latter
syntax, and I'm not sure the 17+kB-and-10-files dependency is
really useful.

This is a breaking change since `new Number(5)` will not be allowed
anymore for column width. Does anyone really do that?

This change is in line with the typescript type annotations for the width,
which only allow `number`s to be provided.

* Removed the dependency on `is-string`

The package tests whether the input is a string or a string object
(i.e. created with `new Object('hello')`). I'm not sure we should
support the latter syntax, especially since the string is passed
to string-width, which explicitely returns 0 if `typeof` doesn't
return `string` : https://github.com/sindresorhus/string-width/blob/89eb79aafd2b7db982dc1f5498424232d55dee53/index.js#L6

This is a breaking change in the strict sense, because the behavior
would change if such "string-object" was indeed passed as a value,
but that would result in an empty cell, so that probably doesn't matter
and avoids a dependency on a 16+kB and 10 files

* Removed unused dev dependencies
@jeremyVignelles jeremyVignelles deleted the simplify-dependencies branch May 10, 2021 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants