diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..0ea19d28220 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.js] +indent_style = space + +[*.json] +indent_style = tab +indent_size = 4 diff --git a/scripts/build.js b/scripts/build.js index d7a9116dfc7..92a9003aaf8 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -6,43 +6,43 @@ let methods = []; let methodsBase = "src/methods/"; let methodFiles = fs.readdirSync(methodsBase); methodFiles.forEach(file => { - console.log(file); + console.log(file); let raw = fs.readFileSync(methodsBase + file); - let parsed = JSON.parse(raw); - methods = [ - ...methods, - ...parsed, - ]; + let parsed = JSON.parse(raw); + methods = [ + ...methods, + ...parsed, + ]; }); let schemas = {}; let schemasBase = "src/schemas/" let schemaFiles = fs.readdirSync(schemasBase); schemaFiles.forEach(file => { - console.log(file); + console.log(file); let raw = fs.readFileSync(schemasBase + file); - let parsed = JSON.parse(raw); - schemas = { - ...schemas, - ...parsed, - }; + let parsed = JSON.parse(raw); + schemas = { + ...schemas, + ...parsed, + }; }); const spec = { - openrpc: "1.2.4", - info: { - title: "Ethereum JSON-RPC Specification", - description: "A specification of the standard interface for Ethereum clients.", - license: { - name: "CC0-1.0", - url: "https://creativecommons.org/publicdomain/zero/1.0/legalcode" - }, - version: "0.0.0" - }, - methods: methods, - components: { - schemas: schemas - } + openrpc: "1.2.4", + info: { + title: "Ethereum JSON-RPC Specification", + description: "A specification of the standard interface for Ethereum clients.", + license: { + name: "CC0-1.0", + url: "https://creativecommons.org/publicdomain/zero/1.0/legalcode" + }, + version: "0.0.0" + }, + methods: methods, + components: { + schemas: schemas + } } let data = JSON.stringify(spec, null, '\t'); diff --git a/scripts/validate.js b/scripts/validate.js index 2807377f53c..c5f2efaab5d 100644 --- a/scripts/validate.js +++ b/scripts/validate.js @@ -1,7 +1,7 @@ import fs from "fs"; import { - parseOpenRPCDocument, - validateOpenRPCDocument + parseOpenRPCDocument, + validateOpenRPCDocument } from "@open-rpc/schema-utils-js"; let rawdata = fs.readFileSync("openrpc.json"); @@ -9,19 +9,19 @@ let openrpc = JSON.parse(rawdata); const error = validateOpenRPCDocument(openrpc); if (error != true) { - console.log(error.name); - console.log(error.message); - process.exit(1); + console.log(error.name); + console.log(error.message); + process.exit(1); } try { - await Promise.resolve(parseOpenRPCDocument(openrpc)); + await Promise.resolve(parseOpenRPCDocument(openrpc)); } catch(e) { - console.log(e.name); - let end = e.message.indexOf("schema in question"); - let msg = e.message.substring(0, end); - console.log(msg); - process.exit(1); + console.log(e.name); + let end = e.message.indexOf("schema in question"); + let msg = e.message.substring(0, end); + console.log(msg); + process.exit(1); } console.log("OpenRPC spec validated successfully.");