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

Remove assert module from source #101

Merged
merged 1 commit into from
Apr 30, 2019
Merged

Conversation

EvanHahn
Copy link
Contributor

This removes the assert module from source and replaces it with if (...) { throw new Error(...) }. This has a few benefits:

  • When we switch ESLint, some of our code will error because we don't have consistent returns in some of our functions. This fixes those issues to ease the transition.
  • Reduces the size of the browser build because we don't need to include the assert module. Shaves off 12 KB from the minified build (from 72,458 bytes to 60,0280).
  • Though Browserify shims the assert module just fine, it removes a subtle difference between the browser build and Node.

This is arguably a breaking change because we're now throwing regular Errors instead of assert.AssertionErrors, but I would argue that this is safe.

This removes the `assert` module from source and replaces it with
`if (...) { throw new Error(...) }`. This has a few benefits:

* Reduces the size of the browser build because we don't need to include
  the `assert` module. Shaves off 12 KB from the minified build (from
  72,458 bytes to 60,0280).
* When we switch ESLint, some of our code will error because we [don't
  have consistent returns][1] in some of our functions. This fixes those
  issues to ease the transition.

This is arguably a breaking change because we're now throwing regular
`Error`s instead of `assert.AssertionError`s, but I would argue that
this is safe.

[1]: https://eslint.org/docs/rules/consistent-return
@EvanHahn EvanHahn requested review from jbbakst and kasrak April 30, 2019 15:44
@EvanHahn EvanHahn merged commit 8182446 into master Apr 30, 2019
@EvanHahn EvanHahn deleted the remove_assert_module_from_source branch April 30, 2019 18:31
EvanHahn pushed a commit that referenced this pull request Jul 9, 2019
This switches us from JSHint to ESLint, improving the quality and
consistency of our code. (We also use ESLint elsewhere at Airtable.)

To break down this change:

* We made several cleanups before this commit to ease the transition.
  See [#95][1], [#96][2], [#97][3], [#98][4], [#99][5], [#101][6] (and a
  fix in [#107][7]), [#105][8], [#109][9], [#118][10], [#119][11],
  [#120][12]
* Installed `eslint`
* Add `.eslintrc.json` and `.eslintignore` (and a slightly-different
  `.eslintrc.json` in `test`)
* Remove JSHint. Involved uninstalling the package, removing it from the
  gruntfile, and removing `jshint ignore`s.
* Update the `lint` task in `package.json`
* Update `return` into `return void 0` for consistent returns in
  `callbackToPromise`
* Add one `// eslint-disable-line` comment in a single test file
* Run `eslint --fix .`, automatically fixing all of the remaining
  warnings and errors

[1]: #95
[2]: #96
[3]: #97
[4]: #98
[5]: #99
[6]: #101
[7]: #107
[8]: #105
[9]: #109
[10]: #118
[11]: #119
[12]: #120
EvanHahn pushed a commit that referenced this pull request Jul 10, 2019
This switches us from JSHint to ESLint, improving the quality and
consistency of our code. (We also use ESLint elsewhere at Airtable.)

To break down this change:

* We made several cleanups before this commit to ease the transition.
  See [#95][1], [#96][2], [#97][3], [#98][4], [#99][5], [#101][6] (and a
  fix in [#107][7]), [#105][8], [#109][9], [#118][10], [#119][11],
  [#120][12]
* Install `eslint`
* Add `.eslintrc.json` and `.eslintignore` (and a slightly-different
  `.eslintrc.json` in `test`)
* Remove JSHint. Involved uninstalling the package, removing it from the
  gruntfile, and removing `jshint ignore`s.
* Update the `lint` task in `package.json`
* Update `return` into `return void 0` for consistent returns in
  `callbackToPromise`
* Add one `// eslint-disable-line` comment in a single test file
* Run `eslint --fix .`, automatically fixing all of the remaining
  warnings and errors

[1]: #95
[2]: #96
[3]: #97
[4]: #98
[5]: #99
[6]: #101
[7]: #107
[8]: #105
[9]: #109
[10]: #118
[11]: #119
[12]: #120
PeterPan627 added a commit to PeterPan627/airtable.js that referenced this pull request May 28, 2023
This switches us from JSHint to ESLint, improving the quality and
consistency of our code. (We also use ESLint elsewhere at Airtable.)

To break down this change:

* We made several cleanups before this commit to ease the transition.
  See [#95][1], [#96][2], [#97][3], [#98][4], [#99][5], [#101][6] (and a
  fix in [#107][7]), [#105][8], [#109][9], [#118][10], [#119][11],
  [#120][12]
* Install `eslint`
* Add `.eslintrc.json` and `.eslintignore` (and a slightly-different
  `.eslintrc.json` in `test`)
* Remove JSHint. Involved uninstalling the package, removing it from the
  gruntfile, and removing `jshint ignore`s.
* Update the `lint` task in `package.json`
* Update `return` into `return void 0` for consistent returns in
  `callbackToPromise`
* Add one `// eslint-disable-line` comment in a single test file
* Run `eslint --fix .`, automatically fixing all of the remaining
  warnings and errors

[1]: Airtable/airtable.js#95
[2]: Airtable/airtable.js#96
[3]: Airtable/airtable.js#97
[4]: Airtable/airtable.js#98
[5]: Airtable/airtable.js#99
[6]: Airtable/airtable.js#101
[7]: Airtable/airtable.js#107
[8]: Airtable/airtable.js#105
[9]: Airtable/airtable.js#109
[10]: Airtable/airtable.js#118
[11]: Airtable/airtable.js#119
[12]: Airtable/airtable.js#120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants