Skip to content

Commit fba2d0f

Browse files
desaikdpopemattdelaneyjzslaytonLitee
authored
adds v5.0.0 related changes (#755)
* Drops support for Node 10.x, 12.x and adds 18.x (#723) * move to native `BigInt` from `JSBI` (#721) * Updates typedoc syntax to address warnings (#733) * updates test-driver to es2020 (#736) * Migrate linting from TSLint to ESLint (#737) * adds changes for resolving ion-test-driver build issue (#748) * adds changes to allow `dom.Decimal` construction from `Number` and `String` (#746) * updates uglify version * adds changes for upconverting JS value for dom collections (#749) * removes deprecated method `byteValue()` for v5.0.0 release (#750) * modifies `Struct#elements()` to return all field values (#754) --------- Co-authored-by: Matthew Pope <81593196+popematt@users.noreply.github.com> Co-authored-by: Delaney <delaneygillilan@gmail.com> Co-authored-by: Zack Slayton <zack.slayton@gmail.com> Co-authored-by: Andrey Lipatkin <400234+Litee@users.noreply.github.com>
1 parent f83fcf0 commit fba2d0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3830
-3383
lines changed

.eslintrc.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = {
2+
root: true,
3+
parser: "@typescript-eslint/parser",
4+
parserOptions: {
5+
project: "./tsconfig.lint.json",
6+
},
7+
plugins: [
8+
"@typescript-eslint",
9+
],
10+
extends: [
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
13+
"prettier", // This config turns off ESLint rules that are handled by Prettier.
14+
],
15+
rules: {
16+
"@typescript-eslint/no-unused-vars": ["off"], // Not really needed, TypeScript strict checks can be used instead.
17+
// TODO Enable and fix other useful rules like `eqeqeq`.
18+
19+
// Temporary disabled recommended rules that failed after TSLint -> ESLint migration.
20+
// TODO Enable rules back one by one and fix errors.
21+
"@typescript-eslint/ban-ts-comment": ["off"],
22+
"@typescript-eslint/ban-types": ["off"],
23+
"@typescript-eslint/explicit-module-boundary-types" : ["off"],
24+
"@typescript-eslint/no-empty-function" : ["off"],
25+
"@typescript-eslint/no-empty-interface" : ["off"],
26+
"@typescript-eslint/no-explicit-any" : ["off"],
27+
"@typescript-eslint/no-inferrable-types" : ["off"],
28+
"@typescript-eslint/no-namespace" : ["off"],
29+
"@typescript-eslint/no-non-null-assertion" : ["off"],
30+
"@typescript-eslint/no-this-alias" : ["off"],
31+
"@typescript-eslint/no-unnecessary-type-assertion": ["off"],
32+
"@typescript-eslint/no-unsafe-assignment" : ["off"],
33+
"@typescript-eslint/no-unsafe-call" : ["off"],
34+
"@typescript-eslint/no-unsafe-member-access" : ["off"],
35+
"@typescript-eslint/no-unsafe-return" : ["off"],
36+
"@typescript-eslint/prefer-regexp-exec": ["off"],
37+
"@typescript-eslint/restrict-plus-operands": ["off"],
38+
"@typescript-eslint/restrict-template-expressions": ["off"],
39+
"@typescript-eslint/unbound-method": ["off"],
40+
"prefer-const" : ["off"],
41+
},
42+
overrides: [{
43+
files: ["./test/**.*"],
44+
rules: {
45+
"@typescript-eslint/no-empty-function": ["off"],
46+
}
47+
}]
48+
};

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@ name: Node.js CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ master, v5.0.0-development ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ master, v5.0.0-development ]
88

99
jobs:
1010
build:
1111

1212
runs-on: ubuntu-latest
1313

1414
strategy:
15+
fail-fast: false
1516
matrix:
16-
node-version: [10.x, 12.x, 14.x, 16.x, 18.x]
17+
node-version: [14.x, 16.x, 18.x]
1718

1819
steps:
1920
- uses: actions/checkout@v2
2021
with:
2122
submodules: recursive
2223
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v2
24+
uses: actions/setup-node@v3
2425
with:
2526
node-version: ${{ matrix.node-version }}
2627
- run: npm install
27-
- run: npm run prettier-check
28+
- run: npm run lint
2829

2930

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ fabric.properties
104104
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
105105

106106
## Ignoring iml files breaks when using IntelliJ modules. We do not at the moment.
107-
*.iml
108-
.idea
107+
*.iml
108+
.idea
109109

110110
# modules.xml
111111
# .idea/misc.xml

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ src
1919
test
2020
test-driver
2121
tests
22-
tslint.json

Gruntfile.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ module.exports = function(grunt) {
4949
tsconfig: './test-driver/tsconfig.json'
5050
}
5151
},
52-
tslint: {
53-
all: ['src/**/*.ts', 'test/**/*.ts'],
54-
src: 'src/**/*.ts',
55-
test: 'test/**/*.ts',
52+
eslint: {
53+
target: ['src/**/*.ts', 'test/**/*.ts']
5654
},
5755
/**
5856
* Copy of generated .js files to
@@ -159,7 +157,7 @@ module.exports = function(grunt) {
159157
grunt.loadNpmTasks('grunt-contrib-uglify');
160158
grunt.loadNpmTasks('grunt-shell');
161159
grunt.loadNpmTasks('grunt-ts');
162-
grunt.loadNpmTasks('grunt-tslint');
160+
grunt.loadNpmTasks('grunt-eslint');
163161
grunt.loadNpmTasks('grunt-typedoc');
164162

165163
// Copy tasks
@@ -181,7 +179,8 @@ module.exports = function(grunt) {
181179
grunt.registerTask('mocha', ['shell:mochaWithCoverage']);
182180

183181
// Tests
184-
grunt.registerTask('test', ['mocha', 'build']); // Test via ts-node. If all goes well, build.
182+
grunt.registerTask('lint', ['eslint']);
183+
grunt.registerTask('test', ['mocha', 'eslint', 'build']); // Test via ts-node. If all goes well, build.
185184
grunt.registerTask('test:coverage', ['mocha']); // Run the tests and show coverage metrics, but do not build.
186185

187186
// Documentation

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ An implementation of [Amazon Ion](https://amazon-ion.github.io/ion-docs/) for Ja
55
[![License](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/amazon-ion/ion-js/blob/master/LICENSE)
66
[![Documentation](https://img.shields.io/badge/docs-api-green.svg)](https://amazon-ion.github.io/ion-js/api/index.html)
77

8-
This package is tested with Node JS major versions **10**, **12**, **14**, **16**, and **18**. While this library
8+
This package is tested with Node JS major versions **14**, **16**, and **18**. While this library
99
should be usable within browsers that support **ES5+**, please note that it is not currently being tested
1010
in any browser environments.
1111

@@ -15,9 +15,9 @@ You can use this library either as a Node.js module or inside an HTML page.
1515

1616
### NPM
1717

18-
1. Add `ion-js` and `jsbi` to your dependencies using `npm`
18+
1. Add `ion-js` to your dependencies using `npm`
1919
```
20-
npm install --save ion-js jsbi
20+
npm install --save ion-js
2121
```
2222
1. Use the library to read/write Ion data. Here is an example that reads Ion data from a JavaScript string:
2323
```javascript

package.json

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ion-js",
3-
"version": "4.3.1-SNAPSHOT",
3+
"version": "5.0.0-SNAPSHOT",
44
"description": "A JavaScript implementation of the Ion data interchange format",
55
"main": "dist/commonjs/es6/Ion.js",
66
"types": "dist/commonjs/es6/Ion.d.ts",
@@ -11,13 +11,12 @@
1111
"scripts": {
1212
"commit": "git-cz",
1313
"prepare": "grunt release",
14-
"test": "npm run test-jsbi4 && npm run test-jsbi3",
15-
"test-jsbi3": "npm install jsbi@3.1.1 && nyc mocha",
16-
"test-jsbi4": "npm install jsbi@4.0.0 && nyc mocha",
14+
"lint": "grunt lint && prettier --check 'src/**/*.ts'",
15+
"lint:fix": "prettier --write 'src/**/*.ts'",
16+
"test": "nyc mocha",
1717
"release": "grunt release",
1818
"test-driver": "cd test-driver && npm install",
19-
"build-test-driver": "cd test-driver && npm run build",
20-
"prettier-check": "prettier --check 'src/**/*.ts'"
19+
"build-test-driver": "cd test-driver && npm run build"
2120
},
2221
"repository": {
2322
"type": "git",
@@ -51,47 +50,47 @@
5150
"check-coverage": false
5251
},
5352
"devDependencies": {
54-
"@babel/cli": "^7.10.0",
55-
"@babel/core": "^7.10.0",
56-
"@babel/plugin-transform-object-assign": "^7.2.0",
57-
"@babel/plugin-transform-runtime": "^7.10.0",
53+
"@babel/cli": "^7.18.10",
54+
"@babel/core": "^7.19.1",
55+
"@babel/plugin-transform-object-assign": "^7.18.6",
56+
"@babel/plugin-transform-runtime": "^7.19.1",
5857
"@babel/polyfill": "^7.8.7",
5958
"@babel/preset-env": "^7.10.0",
6059
"@babel/runtime": "^7.10.0",
6160
"@istanbuljs/nyc-config-typescript": "^0.1.3",
6261
"@types/chai": "^4.2.11",
6362
"@types/mocha": "^5.2.7",
6463
"@types/node": "^12.12.42",
64+
"@typescript-eslint/eslint-plugin": "^4.33.0",
65+
"@typescript-eslint/parser": "^4.33.0",
6566
"babelify": "^10.0.0",
66-
"chai": "^4.2.0",
67-
"commitizen": "^4.1.2",
67+
"chai": "^4.3.6",
68+
"commitizen": "^4.2.5",
6869
"cz-conventional-changelog": "^3.2.0",
69-
"grunt": "^1.1.0",
70+
"eslint": "^7.32.0",
71+
"eslint-config-prettier": "^8.5.0",
72+
"grunt": "^1.5.3",
7073
"grunt-babel": "^8.0.0",
7174
"grunt-browserify": "^5.3.0",
7275
"grunt-cli": "^1.3.2",
7376
"grunt-contrib-clean": "^2.0.0",
7477
"grunt-contrib-copy": "^1.0.0",
7578
"grunt-contrib-jshint": "^2.1.0",
76-
"grunt-contrib-uglify": "^4.0.1",
79+
"grunt-contrib-uglify": "^5.2.2",
80+
"grunt-eslint": "^23.0.0",
7781
"grunt-shell": "^3.0.1",
78-
"grunt-ts": "^6.0.0-beta.21",
79-
"grunt-tslint": "^5.0.2",
82+
"grunt-ts": "^6.0.0-beta.22",
8083
"grunt-typedoc": "^0.2.4",
81-
"jsbi": "3.1.1",
8284
"mocha": "^6.2.3",
8385
"mocha-typescript": "^1.1.17",
8486
"nyc": "^14.1.1",
8587
"prettier": "2.1.2",
8688
"semantic-release": "^17.2.3",
8789
"source-map-support": "^0.5.19",
8890
"ts-node": "^8.10.1",
89-
"tslint": "^5.20.1",
90-
"typedoc": "^0.16.10",
91-
"typescript": "^3.9.3",
92-
"yargs": "^15.4.1"
93-
},
94-
"peerDependencies": {
95-
"jsbi": "^3.1.1"
91+
"typedoc": "^0.20.37",
92+
"typescript": "Mixed-in classes with functions returning `this` have TS2526 error is DTS file. Refernce issue: https://github.com/microsoft/TypeScript/issues/52687. Upgrade to a latest typescript version once this issue is resolved",
93+
"typescript": "^3.9.10",
94+
"yargs": "^17.5.1"
9695
}
9796
}

src/AbstractWriter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ export abstract class AbstractWriter implements Writer {
114114
this.writeString(reader.stringValue());
115115
break;
116116
case IonTypes.CLOB:
117-
this.writeClob(reader.byteValue());
117+
this.writeClob(reader.uInt8ArrayValue());
118118
break;
119119
case IonTypes.BLOB:
120-
this.writeBlob(reader.byteValue());
120+
this.writeBlob(reader.uInt8ArrayValue());
121121
break;
122122
case IonTypes.LIST:
123123
this.stepIn(IonTypes.LIST);

0 commit comments

Comments
 (0)