Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions js/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

/** @type {import('eslint').Linter.Config} */
module.exports = {
env: {
browser: true,
Expand All @@ -25,7 +26,7 @@ module.exports = {
parserOptions: {
project: ["tsconfig.json", "tsconfig/tsconfig.bin.cjs.json"],
sourceType: "module",
ecmaVersion: 2020,
ecmaVersion: "latest",
},
plugins: ["@typescript-eslint", "jest", "unicorn"],
extends: [
Expand Down Expand Up @@ -71,6 +72,7 @@ module.exports = {
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-unused-vars": "off", // ts already takes care of this

"prefer-const": ["error", {
Expand All @@ -92,16 +94,13 @@ module.exports = {
"unicorn/empty-brace-spaces": "off",
"unicorn/no-zero-fractions": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/prefer-module": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-spread": "off",
"unicorn/filename-case": "off",
"unicorn/prefer-export-from": "off",
"unicorn/prefer-switch": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/text-encoding-identifier-case": "off",
"unicorn/prefer-top-level-await": "off",

"unicorn/consistent-destructuring": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
Expand Down
2 changes: 1 addition & 1 deletion js/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"jest.jestCommandLine": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.config.js",
"jest.autoRun": {"watch": false, "onSave": "test-src-file"},
"jest.runMode": { "type": "on-save", "testFileOnly": true },
"typescript.preferences.importModuleSpecifierEnding": "js"
}
6 changes: 3 additions & 3 deletions js/bin/file-to-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
// specific language governing permissions and limitations
// under the License.

import * as fs from 'fs';
import * as Path from 'path';
import { finished as eos } from 'stream/promises';
import * as fs from 'node:fs';
import * as Path from 'node:path';
import { finished as eos } from 'node:stream/promises';
import { RecordBatchReader, RecordBatchStreamWriter } from '../index.ts';

(async () => {
Expand Down
20 changes: 10 additions & 10 deletions js/bin/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// specific language governing permissions and limitations
// under the License.

import * as fs from 'fs';
import * as Path from 'path';
import * as fs from 'node:fs';
import * as Path from 'node:path';
import { glob } from 'glob';
import { zip } from 'ix/iterable/zip.js';
import commandLineArgs from 'command-line-args';
Expand All @@ -41,8 +41,8 @@ const argv = commandLineArgs(cliOpts(), { partial: true });
const exists = async (p: string) => {
try {
return !!(await fs.promises.stat(p));
} catch (e) { return false; }
}
} catch { return false; }
};

(async () => {

Expand All @@ -52,17 +52,17 @@ const exists = async (p: string) => {
let jsonPaths = [...(argv.json || [])];
let arrowPaths = [...(argv.arrow || [])];

if (mode === 'VALIDATE' && !jsonPaths.length) {
if (mode === 'VALIDATE' && jsonPaths.length === 0) {
[jsonPaths, arrowPaths] = await loadLocalJSONAndArrowPathsForDebugging(jsonPaths, arrowPaths);
}

if (!jsonPaths.length) { return print_usage(); }
if (jsonPaths.length === 0) { return print_usage(); }

let threw = false;

switch (mode) {
case 'VALIDATE':
for (let [jsonPath, arrowPath] of zip(jsonPaths, arrowPaths)) {
for (const [jsonPath, arrowPath] of zip(jsonPaths, arrowPaths)) {
try {
await validate(jsonPath, arrowPath);
} catch (e: any) {
Expand Down Expand Up @@ -232,7 +232,7 @@ function compareVectors(actual: Vector, expected: Vector) {

(() => {
let i = -1;
for (let [x1, x2] of zip(actual, expected)) {
for (const [x1, x2] of zip(actual, expected)) {
++i;
if (!createElementComparator(x2)(x1)) {
throw new Error(`${i}: ${x1} !== ${x2}`);
Expand All @@ -245,14 +245,14 @@ async function loadLocalJSONAndArrowPathsForDebugging(jsonPaths: string[], arrow

const sourceJSONPaths = await glob(Path.resolve(__dirname, `../test/data/json/`, `*.json`));

if (!arrowPaths.length) {
if (arrowPaths.length === 0) {
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'cpp', 'file');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'java', 'file');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'cpp', 'stream');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'java', 'stream');
}

for (let [jsonPath, arrowPath] of zip(jsonPaths, arrowPaths)) {
for (const [jsonPath, arrowPath] of zip(jsonPaths, arrowPaths)) {
console.log(`jsonPath: ${jsonPath}`);
console.log(`arrowPath: ${arrowPath}`);
}
Expand Down
10 changes: 5 additions & 5 deletions js/bin/json-to-arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
// specific language governing permissions and limitations
// under the License.

import * as fs from 'fs';
import * as Path from 'path';
import * as fs from 'node:fs';
import * as Path from 'node:path';
import commandLineArgs from 'command-line-args';
import { finished as eos } from 'stream/promises';
import { finished as eos } from 'node:stream/promises';
// @ts-ignore
import { parse as bignumJSONParse } from 'json-bignum';
import { RecordBatchReader, RecordBatchFileWriter, RecordBatchStreamWriter } from '../index.ts';
Expand All @@ -31,7 +31,7 @@ const arrowPaths = [...(argv.arrow || [])];

(async () => {

if (!jsonPaths.length || !arrowPaths.length || (jsonPaths.length !== arrowPaths.length)) {
if (jsonPaths.length === 0 || arrowPaths.length === 0 || (jsonPaths.length !== arrowPaths.length)) {
return print_usage();
}

Expand All @@ -51,7 +51,7 @@ const arrowPaths = [...(argv.arrow || [])];
await eos(jsonToArrow);
}));

return undefined;
return;
})()
.then((x) => x ?? 0, (e) => {
e && process.stderr.write(`${e}`);
Expand Down
4 changes: 2 additions & 2 deletions js/bin/print-buffer-alignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// specific language governing permissions and limitations
// under the License.

import * as fs from 'fs';
import * as Path from 'path';
import * as fs from 'node:fs';
import * as Path from 'node:path';
import { VectorLoader } from '../src/visitor/vectorloader.ts';
import { RecordBatch, AsyncMessageReader, makeData, Struct, Schema, Field } from '../index.ts';

Expand Down
6 changes: 3 additions & 3 deletions js/bin/stream-to-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
// specific language governing permissions and limitations
// under the License.

import * as fs from 'fs';
import * as path from 'path';
import { finished as eos } from 'stream/promises';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { finished as eos } from 'node:stream/promises';
import { RecordBatchReader, RecordBatchFileWriter } from '../index.ts';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions js/gulp/arrow-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import { mainExport, targetDir, observableFromStreams } from './util.js';

import gulp from 'gulp';
import path from 'path';
import path from 'node:path';
import { mkdirp } from 'mkdirp';
import * as fs from 'fs/promises';
import * as fs from 'node:fs/promises';
import gulpRename from 'gulp-rename';
import gulpReplace from 'gulp-replace';
import { memoizeTask } from './memoize-task.js';
Expand Down
10 changes: 5 additions & 5 deletions js/gulp/bundle-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import { observableFromStreams } from './util.js';
import { forkJoin as ObservableForkJoin } from 'rxjs';
import { resolve, join } from 'path';
import { readdirSync } from 'fs';
import { execSync } from 'child_process';
import { resolve, join } from 'node:path';
import { readdirSync } from 'node:fs';
import { execSync } from 'node:child_process';

import gulpEsbuild from 'gulp-esbuild';
import esbuildAlias from 'esbuild-plugin-alias';
Expand All @@ -38,8 +38,8 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import webpack from 'webpack-stream';
import named from 'vinyl-named';

import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

Expand Down
4 changes: 2 additions & 2 deletions js/gulp/closure-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import { targetDir, mainExport, esmRequire, gCCLanguageNames, publicModulePaths, observableFromStreams, shouldRunInChildProcess, spawnGulpCommandInChildProcess } from "./util.js";

import fs from 'fs';
import fs from 'node:fs';
import gulp from 'gulp';
import path from 'path';
import path from 'node:path';
import { mkdirp } from 'mkdirp';
import sourcemaps from 'gulp-sourcemaps';
import { memoizeTask } from './memoize-task.js';
Expand Down
10 changes: 5 additions & 5 deletions js/gulp/test-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
// under the License.

import { deleteAsync as del } from 'del';
import path from 'path';
import path from 'node:path';
import { mkdirp } from 'mkdirp';
import { argv } from './argv.js';
import { promisify } from 'util';
import { promisify } from 'node:util';
import { glob } from 'glob';
import child_process from 'child_process';
import child_process from 'node:child_process';
import { memoizeTask } from './memoize-task.js';
import fs from 'fs';
import fs from 'node:fs';
const readFile = promisify(fs.readFile);
import asyncDoneSync from 'async-done';
const asyncDone = promisify(asyncDoneSync);
const exec = promisify(child_process.exec);
import xml2js from 'xml2js';
const parseXML = promisify(xml2js.parseString);
import { targetAndModuleCombinations, npmPkgName } from './util.js';
import { createRequire } from 'module';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

Expand Down
4 changes: 2 additions & 2 deletions js/gulp/typescript-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import { targetDir, tsconfigName, observableFromStreams, shouldRunInChildProcess, spawnGulpCommandInChildProcess } from './util.js';

import gulp from 'gulp';
import path from 'path';
import path from 'node:path';
import tsc from 'typescript';
import ts from 'gulp-typescript';
import * as fs from 'fs/promises';
import * as fs from 'node:fs/promises';
import sourcemaps from 'gulp-sourcemaps';
import { memoizeTask } from './memoize-task.js';
import { ReplaySubject, forkJoin as ObservableForkJoin, defer as ObservableDefer } from 'rxjs';
Expand Down
12 changes: 6 additions & 6 deletions js/gulp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
// specific language governing permissions and limitations
// under the License.

import fs from 'fs';
import path from 'path';
import child_process from 'child_process';
import stream from 'stream';
import util from 'util';
import fs from 'node:fs';
import path from 'node:path';
import child_process from 'node:child_process';
import stream from 'node:stream';
import util from 'node:util';
import asyncDoneSync from 'async-done';
const pump = stream.pipeline;
import { targets, modules } from './argv.js';
import { ReplaySubject, empty as ObservableEmpty, throwError as ObservableThrow, fromEvent as ObservableFromEvent } from 'rxjs';
import { share, flatMap, takeUntil, defaultIfEmpty, mergeWith } from 'rxjs/operators';
const asyncDone = util.promisify(asyncDoneSync);
import { createRequire } from 'module';
import { createRequire } from 'node:module';
import esmRequire from './esm-require.cjs'

const require = createRequire(import.meta.url);
Expand Down
Loading