THRIFT-5811: Update eslint & prettier
Client: js
Patch: Cameron Martin
This closes #3087
diff --git a/lib/ts/Gruntfile.js b/lib/ts/Gruntfile.js
index 61ab582..3e4b1c4 100644
--- a/lib/ts/Gruntfile.js
+++ b/lib/ts/Gruntfile.js
@@ -5,55 +5,57 @@
// Grunt Setup - npm install //reads the ./package.json and installs project dependencies
// Run grunt - npx grunt // uses project-local installed version of grunt (from package.json)
-module.exports = function(grunt) {
- 'use strict';
+module.exports = function (grunt) {
+ "use strict";
grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
+ pkg: grunt.file.readJSON("package.json"),
concat: {
options: {
- separator: ';'
+ separator: ";",
},
dist: {
- src: ['src/**/*.js'],
- dest: 'dist/<%= pkg.name %>.js'
- }
+ src: ["src/**/*.js"],
+ dest: "dist/<%= pkg.name %>.js",
+ },
},
shell: {
InstallThriftJS: {
- command: 'mkdir -p test/build/ts/lib; cp ../js/src/thrift.js test/build/ts/thrift.js'
+ command:
+ "mkdir -p test/build/ts/lib; cp ../js/src/thrift.js test/build/ts/thrift.js",
},
InstallThriftNodeJSDep: {
- command: 'cd ../..; npm install'
+ command: "cd ../..; npm install",
},
InstallTestLibs: {
- command: 'cd test; ant download_jslibs'
+ command: "cd test; ant download_jslibs",
},
ThriftGen: {
command: [
- 'mkdir -p test/gen-js',
- '../../compiler/cpp/thrift -gen js:ts --out test/gen-js ../../test/v0.16/ThriftTest.thrift',
- 'mkdir -p test/gen-nodejs',
- '../../compiler/cpp/thrift -gen js:node,ts --out test/gen-nodejs ../../test/v0.16/ThriftTest.thrift',
- ].join(' && ')
+ "mkdir -p test/gen-js",
+ "../../compiler/cpp/thrift -gen js:ts --out test/gen-js ../../test/v0.16/ThriftTest.thrift",
+ "mkdir -p test/gen-nodejs",
+ "../../compiler/cpp/thrift -gen js:node,ts --out test/gen-nodejs ../../test/v0.16/ThriftTest.thrift",
+ ].join(" && "),
},
ThriftBrowserifyNodeInt64: {
command: [
- './node_modules/browserify/bin/cmd.js ./node_modules/node-int64/Int64.js -s Int64 -o test/build/js/lib/Int64.js',
- './node_modules/browserify/bin/cmd.js ../nodejs/lib/thrift/int64_util.js -s Int64Util -o test/build/js/lib/Int64Util.js',
- './node_modules/browserify/bin/cmd.js ./node_modules/json-int64/index.js -s JSONInt64 -o test/build/js/lib/JSONInt64.js'
- ].join(' && ')
+ "./node_modules/browserify/bin/cmd.js ./node_modules/node-int64/Int64.js -s Int64 -o test/build/js/lib/Int64.js",
+ "./node_modules/browserify/bin/cmd.js ../nodejs/lib/thrift/int64_util.js -s Int64Util -o test/build/js/lib/Int64Util.js",
+ "./node_modules/browserify/bin/cmd.js ./node_modules/json-int64/index.js -s JSONInt64 -o test/build/js/lib/JSONInt64.js",
+ ].join(" && "),
},
ThriftGenInt64: {
- command: '../../compiler/cpp/thrift -gen js:ts -o test ../../test/Int64Test.thrift'
+ command:
+ "../../compiler/cpp/thrift -gen js:ts -o test ../../test/Int64Test.thrift",
},
ThriftTestServer: {
options: {
async: true,
execOptions: {
cwd: "./test",
- env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
- }
+ env: { NODE_PATH: "../../nodejs/lib:../../../node_modules" },
+ },
},
command: "node server_http.js",
},
@@ -61,103 +63,104 @@
options: {
execOptions: {
cwd: "./test",
- }
+ },
},
- command : "../node_modules/typescript/bin/tsc --listFiles --outDir build/ts"
+ command:
+ "../node_modules/typescript/bin/tsc --listFiles --outDir build/ts",
},
BrowserifyCompiledTS: {
command: [
"./node_modules/browserify/bin/cmd.js test/build/ts/test.js -o test/build/ts/lib/test.js --standalone test",
"./node_modules/browserify/bin/cmd.js test/build/ts/test-int64.js -o test/build/ts/lib/test-int64.js --standalone testInt64",
- ].join(" && ")
+ ].join(" && "),
},
InstallGeneratedCode: {
command: [
"mkdir -p test/build/ts",
- "cp -r test/gen-js test/build/ts"
- ].join(" && ")
+ "cp -r test/gen-js test/build/ts",
+ ].join(" && "),
},
},
qunit: {
ThriftJS: {
options: {
- urls: [
- 'http://localhost:8089/test.html'
- ],
+ urls: ["http://localhost:8089/test.html"],
puppeteer: {
headless: true,
- args: ['--no-sandbox'],
+ args: ["--no-sandbox"],
},
- }
+ },
},
ThriftJS_Int64: {
options: {
- urls: [
- 'http://localhost:8089/test-int64.html'
- ],
+ urls: ["http://localhost:8089/test-int64.html"],
puppeteer: {
headless: true,
- args: ['--no-sandbox'],
+ args: ["--no-sandbox"],
ignoreHTTPSErrors: true,
},
- }
+ },
},
},
jshint: {
// The main Thrift library file. not es6 yet :(
lib: {
- src: ['../js/src/**/*.js'],
+ src: ["../js/src/**/*.js"],
},
// The test files use es6
test: {
- src: ['Gruntfile.js', 'test/*.js'],
+ src: ["Gruntfile.js", "test/*.js"],
options: {
esversion: 6,
- }
+ },
},
gen_js_code: {
- src: ['test/gen-js/*.js'],
+ src: ["test/gen-js/*.js"],
},
gen_node_code: {
- src: ['test/gen-nodejs/*.js'],
+ src: ["test/gen-nodejs/*.js"],
options: {
node: true,
- }
+ },
},
},
});
- grunt.loadNpmTasks('grunt-contrib-jshint');
- grunt.loadNpmTasks('grunt-contrib-qunit');
- grunt.loadNpmTasks('grunt-shell-spawn');
+ grunt.loadNpmTasks("grunt-contrib-jshint");
+ grunt.loadNpmTasks("grunt-contrib-qunit");
+ grunt.loadNpmTasks("grunt-shell-spawn");
- grunt.registerTask('wait', 'Wait just one second for the server to start', function () {
- var done = this.async();
- setTimeout(function() {
- done(true);
- }, 1000);
- });
+ grunt.registerTask(
+ "wait",
+ "Wait just one second for the server to start",
+ function () {
+ var done = this.async();
+ setTimeout(function () {
+ done(true);
+ }, 1000);
+ },
+ );
- grunt.registerTask('installAndGenerate', [
- 'shell:InstallThriftJS',
- 'shell:InstallThriftNodeJSDep',
- 'shell:ThriftGen',
- 'shell:ThriftBrowserifyNodeInt64',
- 'shell:ThriftGenInt64',
- 'shell:InstallTestLibs',
- 'shell:BuildTS',
- 'shell:InstallGeneratedCode',
- 'shell:BrowserifyCompiledTS',
+ grunt.registerTask("installAndGenerate", [
+ "shell:InstallThriftJS",
+ "shell:InstallThriftNodeJSDep",
+ "shell:ThriftGen",
+ "shell:ThriftBrowserifyNodeInt64",
+ "shell:ThriftGenInt64",
+ "shell:InstallTestLibs",
+ "shell:BuildTS",
+ "shell:InstallGeneratedCode",
+ "shell:BrowserifyCompiledTS",
]);
- grunt.registerTask('test', [
- 'installAndGenerate',
- 'jshint',
- 'shell:ThriftTestServer',
- 'wait',
- 'qunit:ThriftJS',
- 'qunit:ThriftJS_Int64',
- 'shell:ThriftTestServer:kill',
+ grunt.registerTask("test", [
+ "installAndGenerate",
+ "jshint",
+ "shell:ThriftTestServer",
+ "wait",
+ "qunit:ThriftJS",
+ "qunit:ThriftJS_Int64",
+ "shell:ThriftTestServer:kill",
]);
- grunt.registerTask('default', ['test']);
+ grunt.registerTask("default", ["test"]);
};