diff --git a/package.json b/package.json index fcfc7d5a..ee77598a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,61 @@ "build": "lerna run build" }, "devDependencies": { - "lerna": "^4.0.0" + "@types/chai": "^4.2.21", + "@types/jest": "^26.0.7", + "@types/lodash": "^4.14.136", + "@types/mocha": "^9.0.0", + "@types/node": "^16.4.3", + "@types/puppeteer": "5.4.4", + "@types/ws": "^8.2.0", + "@typescript-eslint/eslint-plugin": "^4.30.0", + "@typescript-eslint/parser": "^4.0.0", + "@xrplf/eslint-config": "^1.5.0", + "@xrplf/prettier-config": "^1.5.0", + "assert": "^2.0.0", + "buffer": "^6.0.2", + "chai": "^4.3.4", + "crypto-browserify": "^3.12.0", + "ejs": "^3.0.1", + "eslint": "^7.5.0", + "eslint-config-airbnb-base": "^14.0.0", + "eslint-config-airbnb-typescript": "^7.0.0", + "eslint-config-prettier": "^6.9.0", + "eslint-plugin-array-func": "^3.1.7", + "eslint-plugin-consistent-default-export-name": "^0.0.13", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-import": "^2.24.1", + "eslint-plugin-jest": "^23.20.0", + "eslint-plugin-jsdoc": "^36.0.0", + "eslint-plugin-mocha": "^9.0.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-tsdoc": "^0.2.14", + "eventemitter2": "^6.0.0", + "https-browserify": "^1.0.0", + "jest": "^26.0.1", + "lerna": "^4.0.0", + "mocha": "^9", + "npm-run-all": "^4.1.5", + "nyc": "^15", + "path-browserify": "1.0.1", + "prettier": "^2.3.2", + "process": "^0.11.10", + "puppeteer": "10.4.0", + "source-map-support": "^0.5.16", + "stream-browserify": "^3.0.0", + "stream-http": "3.2.0", + "ts-jest": "^26.4.4", + "ts-loader": "^9.2.5", + "ts-node": "^10.2.1", + "tslint": "^5.19.0", + "tslint-eslint-rules": "^5.4.0", + "typedoc": "^0.22.5", + "typescript": "^4.4.2", + "url": "^0.11.0", + "webpack": "^5.6.0", + "webpack-bundle-analyzer": "^4.1.0", + "webpack-cli": "^4.2.0" }, "workspaces": [ "packages/*" @@ -16,5 +70,12 @@ "engines": { "node": ">=10.0.0", "npm": ">=7.0.0 < 8.0.0" + }, + "name": "xrpl.js", + "dependencies": { + "ripple-address-codec": "file:packages/ripple-address-codec", + "ripple-binary-codec": "file:packages/ripple-binary-codec", + "ripple-keypairs": "file:packages/ripple-keypairs", + "xrpl": "file:packages/xrpl" } } diff --git a/packages/ripple-address-codec/.eslintignore b/packages/ripple-address-codec/.eslintignore new file mode 100644 index 00000000..0fc07055 --- /dev/null +++ b/packages/ripple-address-codec/.eslintignore @@ -0,0 +1,12 @@ +# Don't ever lint node_modules +node_modules + +# Don't lint build output +dist + +# don't lint nyc coverage output +coverage +.nyc_output + +# Don't lint NYC configuration +nyc.config.js diff --git a/packages/ripple-address-codec/.eslintrc.js b/packages/ripple-address-codec/.eslintrc.js new file mode 100644 index 00000000..c5fa2f64 --- /dev/null +++ b/packages/ripple-address-codec/.eslintrc.js @@ -0,0 +1,86 @@ +module.exports = { + root: true, + + parser: '@typescript-eslint/parser', // Make ESLint compatible with TypeScript + parserOptions: { + // Enable linting rules with type information from our tsconfig + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + + sourceType: 'module', // Allow the use of imports / ES modules + + ecmaFeatures: { + impliedStrict: true, // Enable global strict mode + }, + }, + + // Specify global variables that are predefined + env: { + browser: true, // Enable browser global variables + node: true, // Enable node global variables & Node.js scoping + es2020: true, // Add all ECMAScript 2020 globals and automatically set the ecmaVersion parser option to ES2020 + }, + + plugins: [], + extends: ['@xrplf/eslint-config/base'], + + rules: { + // ** TODO ** + // all of the below are turned off for now during the migration to a + // monorepo. They need to actually be addressed! + // ** + '@typescript-eslint/no-for-in-array': 'off', + '@typescript-eslint/consistent-type-assertions': 'off', + '@typescript-eslint/no-unnecessary-condition': 'off', + '@typescript-eslint/prefer-for-of': 'off', + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-magic-numbers': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/promise-function-async': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/check-param-names': 'off', + 'jsdoc/require-throws': 'off', + 'jsdoc/require-hyphen-before-param-description': 'off', + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-description-complete-sentence': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/no-types': 'off', + 'tsdoc/syntax': 'off', + 'import/no-commonjs': 'off', + 'import/order': 'off', + 'prettier/prettier': 'off', + 'no-restricted-syntax': 'off', + 'guard-for-in': 'off', + 'object-shorthand': 'off', + 'no-negated-condition': 'off', + 'no-loop-func': 'off', + 'id-length': 'off', + 'no-inline-comments': 'off', + 'max-lines-per-function': 'off', + 'max-len': 'off', + 'no-nested-ternary': 'off', + 'no-param-reassign': 'off', + 'no-bitwise': 'off', + 'multiline-comment-style': 'off', + 'id-blacklist': 'off', + 'func-names': 'off', + 'max-params': 'off', + 'prefer-template': 'off', + 'no-else-return': 'off', + }, +} diff --git a/packages/ripple-address-codec/package.json b/packages/ripple-address-codec/package.json index 9c3fb473..8fbf602d 100644 --- a/packages/ripple-address-codec/package.json +++ b/packages/ripple-address-codec/package.json @@ -22,18 +22,10 @@ "scripts": { "build": "tsc -b", "test": "jest", - "lint": "tslint -p ./", + "lint": "eslint . --ext .ts", "clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo" }, - "devDependencies": { - "@types/jest": "^27.0.2", - "@types/node": "^16.4.3", - "jest": "^26.6.3", - "ts-jest": "^26.4.4", - "tslint": "^5.19.0", - "tslint-eslint-rules": "^5.4.0", - "typescript": "^4.4.4" - }, + "prettier": "@xrplf/prettier-config", "engines": { "node": ">= 10", "npm": ">=7.0.0" diff --git a/packages/ripple-address-codec/tslint.json b/packages/ripple-address-codec/tslint.json deleted file mode 100644 index adde290b..00000000 --- a/packages/ripple-address-codec/tslint.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "extends": [ - "tslint-eslint-rules" - ], - "rules": { - "ban": [true, ["alert"]], - "no-arg": true, - "no-conditional-assignment": true, - "no-console": false, - "no-constant-condition": true, - "no-control-regex": true, - "no-debugger": true, - "no-duplicate-case": true, - "no-empty": true, - "no-empty-character-class": true, - "no-eval": true, - "no-ex-assign": true, - "no-extra-boolean-cast": true, - "no-extra-semi": true, - "no-switch-case-fall-through": true, - "no-inner-declarations": [true, "functions"], - "no-invalid-regexp": true, - "no-invalid-this": false, - "no-irregular-whitespace": true, - "ter-no-irregular-whitespace": true, - "label-position": true, - "indent": [true, "spaces", 2], - "linebreak-style": [true, "unix"], - "no-multi-spaces": true, - "no-consecutive-blank-lines": [true, 2], - "no-unused-expression": true, - "no-construct": true, - "no-duplicate-variable": true, - "no-regex-spaces": true, - "no-shadowed-variable": true, - "ter-no-sparse-arrays": true, - "no-trailing-whitespace": true, - "no-string-throw": true, - "no-unexpected-multiline": true, - "no-var-keyword": true, - "no-magic-numbers": false, - "array-bracket-spacing": [true, "never"], - "ter-arrow-body-style": false, - "ter-arrow-parens": [true, "as-needed"], - "ter-arrow-spacing": true, - "block-spacing": true, - "brace-style": [true, "1tbs", {"allowSingleLine": true}], - "variable-name": false, - "trailing-comma": [true, {"multiline": "never", "singleline": "never"}], - "cyclomatic-complexity": [false, 11], - "curly": [true, "all"], - "switch-default": false, - "eofline": true, - "triple-equals": true, - "forin": false, - "handle-callback-err": true, - "ter-max-len": [true, 120], - "new-parens": true, - "object-curly-spacing": [true, "never"], - "object-literal-shorthand": false, - "one-variable-per-declaration": [true, "ignore-for-loop"], - "ter-prefer-arrow-callback": false, - "prefer-const": true, - "object-literal-key-quotes": false, - "quotemark": [true, "single"], - "radix": true, - "semicolon": [true, "never"], - "space-in-parens": [true, "never"], - "comment-format": [true, "check-space"], - "use-isnan": true, - "valid-typeof": true - } -} diff --git a/packages/ripple-binary-codec/.eslintrc.js b/packages/ripple-binary-codec/.eslintrc.js index 82c4493c..19cc1e30 100644 --- a/packages/ripple-binary-codec/.eslintrc.js +++ b/packages/ripple-binary-codec/.eslintrc.js @@ -22,91 +22,104 @@ module.exports = { jest: true, // Add Mocha testing global variables }, - plugins: [ - '@typescript-eslint', // Add some TypeScript specific rules, and disable rules covered by the typechecker - 'import', // Add rules that help validate proper imports - 'prettier', // Allows running prettier as an ESLint rule, and reporting differences as individual linting issues - 'jest' - ], + plugins: [], + extends: ['@xrplf/eslint-config/base'], - extends: [ - // ESLint recommended rules - 'eslint:recommended', - - // Add TypeScript-specific rules, and disable rules covered by typechecker - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - - // Add rules for import/export syntax - 'plugin:import/errors', - 'plugin:import/warnings', - 'plugin:import/typescript', - - // Add rules that specifically require type information using our tsconfig - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - - // Enable Prettier for ESLint --fix, and disable rules that conflict with Prettier - 'prettier/@typescript-eslint', - 'plugin:prettier/recommended', - ], - - // rules: { - // // This rule is about explicitly using `return undefined` when a function returns any non-undefined object. - // // However, since we're using TypeScript, it will yell at us if a function is not allowed to return `undefined` in its signature, so we don't need this rule. - // "consistent-return": "off", - // }, - - overrides: [ - // Overrides for all test files - { - files: 'test/**/*.test.js', - extends: ["plugin:jest/recommended"], - rules: { - // For our Mocha test files, the pattern has been to have unnamed functions - 'func-names': 'off', - // For some test files, we shadow testing constants with function parameter names - 'no-shadow': 'off', - // Some of our test files declare helper classes with errors - 'max-classes-per-file': 'off', - // Test files are in javascript, turn off TypeScript linting. - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/no-unsafe-return': 'off', - '@typescript-eslint/unbound-method': 'off' - }, - }, - { - files: '**/*.ts', - rules: { - // Allow unused variables in our files when explicitly prepended with `_`. - '@typescript-eslint/no-unused-vars': [ - 'error', - { argsIgnorePattern: '^_' }, - ], - - '@typescript-eslint/ban-types': 'off', - - // These rules are deprecated, but we have an old config that enables it - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/ban-ts-ignore': 'off', - - // These rules are actually disabled in @xpring-eng/eslint-config-base/loose at the moment - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - "spaced-comment": ["error", "always"], - }, - }, - { - files: ['src/XRP/default-xrp-client.ts'], - rules: { - // This is actually a good rule to have enabled, but for the XRPClient, we define a helper error message class in the same file - 'max-classes-per-file': 'off', - }, - }, - ], -} \ No newline at end of file + rules: { + // ** TODO ** + // all of the below are turned off for now during the migration to a + // monorepo. They need to actually be addressed! + // ** + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/prefer-readonly': 'off', + '@typescript-eslint/no-parameter-properties': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/no-base-to-string': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/promise-function-async': 'off', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/no-magic-numbers': 'off', + '@typescript-eslint/no-useless-constructor': 'off', + '@typescript-eslint/no-unnecessary-condition': 'off', + '@typescript-eslint/consistent-type-assertions': 'off', + '@typescript-eslint/prefer-for-of': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/require-array-sort-compare': 'off', + '@typescript-eslint/prefer-includes': 'off', + '@typescript-eslint/dot-notation': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + '@typescript-eslint/no-type-alias': 'off', + '@typescript-eslint/member-ordering': 'off', + '@typescript-eslint/prefer-string-starts-ends-with': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-extraneous-class': 'off', + '@typescript-eslint/consistent-type-assertions': 'off', + 'import/unambiguous': 'off', + 'import/extensions': 'off', + 'import/prefer-default-export': 'off', + 'import/no-useless-path-segments': 'off', + 'import/no-unused-modules': 'off', + 'import/no-cycle': 'off', + 'import/order': 'off', + 'import/no-commonjs': 'off', + 'import/newline-after-import': 'off', + 'node/global-require': 'off', + 'consistent-default-export-name/default-import-match-filename': 'off', + 'prettier/prettier': 'off', + 'jsdoc/require-throws': 'off', + 'jsdoc/require-description-complete-sentence': 'off', + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/check-tag-names': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-hyphen-before-param-description': 'off', + 'jsdoc/require-description': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/check-param-names': 'off', + 'jsdoc/newline-after-description': 'off', + 'jsdoc/require-returns-check': 'off', + 'tsdoc/syntax': 'off', + 'eslint-comments/require-description': 'off', + 'eslint-comments/no-unused-disable': 'off', + 'prefer-const': 'off', + 'global-require': 'off', + 'id-length': 'off', + 'no-shadow': 'off', + 'no-bitwise': 'off', + 'spaced-comment': 'off', + 'prefer-template': 'off', + 'prefer-object-spread': 'off', + 'no-inline-comments': 'off', + 'no-plusplus': 'off', + 'new-cap': 'off', + 'id-blacklist': 'off', + 'max-lines-per-function': 'off', + 'require-unicode-regexp': 'off', + 'no-undef-init': 'off', + 'curly': 'off', + 'eqeqeq': 'off', + 'no-console': 'off', + 'max-classes-per-file': 'off', + 'operator-assignment': 'off', + 'class-methods-use-this': 'off', + 'no-else-return': 'off', + 'yoda': 'off', + 'max-depth': 'off', + 'multiline-comment-style': 'off', + 'one-var': 'off', + 'no-negated-condition': 'off', + 'radix': 'off', + 'no-nested-ternary': 'off', + 'no-useless-concat': 'off', + 'object-shorthand': 'off', + 'no-param-reassign': 'off', + }, +} diff --git a/packages/ripple-binary-codec/package.json b/packages/ripple-binary-codec/package.json index 847e0b12..790c20c8 100644 --- a/packages/ripple-binary-codec/package.json +++ b/packages/ripple-binary-codec/package.json @@ -17,22 +17,7 @@ "buffer": "5.6.0", "create-hash": "^1.2.0", "decimal.js": "^10.2.0", - "ripple-address-codec": "^4.1.1" - }, - "devDependencies": { - "@types/jest": "^26.0.7", - "@types/node": "^14.0.10", - "@typescript-eslint/eslint-plugin": "^3.2.0", - "@typescript-eslint/parser": "^3.2.0", - "eslint": "^7.7.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-import": "^2.21.1", - "eslint-plugin-jest": "^23.20.0", - "eslint-plugin-mocha": "^7.0.1", - "eslint-plugin-prettier": "^3.1.3", - "jest": "^26.0.1", - "prettier": "^2.0.4", - "typescript": "^3.9.5" + "ripple-address-codec": "file:../ripple-address-codec" }, "scripts": { "build": "tsc -b && cp ./src/enums/definitions.json ./dist/enums", @@ -51,9 +36,7 @@ "homepage": "https://github.com/XRPLF/xrpl.js/packages/ripple-binary-codec#readme", "license": "ISC", "readmeFilename": "README.md", - "prettier": { - "semi": true - }, + "prettier": "@xrplf/prettier-config", "engines": { "node": ">=10.22.0", "npm": ">=7.0.0" diff --git a/packages/ripple-binary-codec/src/types/st-object.ts b/packages/ripple-binary-codec/src/types/st-object.ts index 8de79993..c3f4ee0b 100644 --- a/packages/ripple-binary-codec/src/types/st-object.ts +++ b/packages/ripple-binary-codec/src/types/st-object.ts @@ -103,7 +103,7 @@ class STObject extends SerializedType { let handled: JsonObject | undefined = undefined; if (val && isValidXAddress(val.toString())) { handled = handleXAddress(key, val.toString()); - checkForDuplicateTags(handled, value as JsonObject); + checkForDuplicateTags(handled, value); } return Object.assign(acc, handled ?? { [key]: val }); }, {}); diff --git a/packages/ripple-binary-codec/test/binary-json.test.js b/packages/ripple-binary-codec/test/binary-json.test.js index 9487d0b8..0317d9e3 100644 --- a/packages/ripple-binary-codec/test/binary-json.test.js +++ b/packages/ripple-binary-codec/test/binary-json.test.js @@ -13,13 +13,11 @@ describe("ripple-binary-codec", function () { function makeSuite(name, entries) { describe(name, function () { entries.forEach((t, testN) => { - // eslint-disable-next-line max-len test(`${name}[${testN}] can encode ${truncateForDisplay( json(t.json) )} to ${truncateForDisplay(t.binary)}`, () => { expect(encode(t.json)).toEqual(t.binary); }); - // eslint-disable-next-line max-len test(`${name}[${testN}] can decode ${truncateForDisplay( t.binary )} to ${truncateForDisplay(json(t.json))}`, () => { diff --git a/packages/ripple-binary-codec/test/binary-parser.test.js b/packages/ripple-binary-codec/test/binary-parser.test.js index 4ac07360..1a0925ef 100644 --- a/packages/ripple-binary-codec/test/binary-parser.test.js +++ b/packages/ripple-binary-codec/test/binary-parser.test.js @@ -1,5 +1,3 @@ -/* eslint-disable func-style */ - const { coreTypes } = require("../dist/types"); const Decimal = require("decimal.js"); diff --git a/packages/ripple-binary-codec/test/binary-serializer.test.js b/packages/ripple-binary-codec/test/binary-serializer.test.js index 4eaf6ede..acc69c66 100644 --- a/packages/ripple-binary-codec/test/binary-serializer.test.js +++ b/packages/ripple-binary-codec/test/binary-serializer.test.js @@ -1,5 +1,3 @@ -/* eslint-disable func-style */ - const { binary } = require("../dist/coretypes"); const { encode, decode } = require("../dist"); const { makeParser, BytesList, BinarySerializer } = binary; @@ -139,11 +137,9 @@ function assertRecycles(blob) { function nestedObjectTests() { fixtures.whole_objects.forEach((f, i) => { - /*eslint-disable jest/expect-expect*/ test(`whole_objects[${i}]: can parse blob and dump out same blob`, () => { assertRecycles(f.blob_with_no_signing); }); - /*eslint-enable jest/expect-expect*/ }); } diff --git a/packages/ripple-keypairs/.eslintrc.js b/packages/ripple-keypairs/.eslintrc.js index 6ee802f3..73d641d5 100644 --- a/packages/ripple-keypairs/.eslintrc.js +++ b/packages/ripple-keypairs/.eslintrc.js @@ -22,54 +22,39 @@ module.exports = { mocha: true, // Add Mocha testing global variables }, - plugins: [ - '@typescript-eslint', // Add some TypeScript specific rules, and disable rules covered by the typechecker - 'import', // Add rules that help validate proper imports - 'mocha', // Add rules for writing better Mocha tests - 'prettier', // Allows running prettier as an ESLint rule, and reporting differences as individual linting issues - ], - - extends: [ - // ESLint recommended rules - 'eslint:recommended', - - // Add TypeScript-specific rules, and disable rules covered by typechecker - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - - // Add rules for import/export syntax - 'plugin:import/errors', - 'plugin:import/warnings', - 'plugin:import/typescript', - - // Add rules for Mocha-specific syntax - 'plugin:mocha/recommended', - - // Add Airbnb + TypeScript support - 'airbnb-base', - 'airbnb-typescript/base', - - // Add rules that specifically require type information using our tsconfig - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - - // Enable Prettier for ESLint --fix, and disable rules that conflict with Prettier - 'prettier/@typescript-eslint', - 'plugin:prettier/recommended', - ], + plugins: [], + extends: ['@xrplf/eslint-config/base', 'plugin:mocha/recommended'], rules: { - // Unary operators are subject to Automatic Semicolon Insertion, which can cause bugs. However, we should allow them in for loops - 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], + // ** TODO ** + // all of the below are turned off for now during the migration to a + // monorepo. They need to actually be addressed! + // ** + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-magic-numbers': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/promise-function-async': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-description': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-description-complete-sentence': 'off', + 'jsdoc/check-tag-names': 'off', + 'jsdoc/no-types': 'off', + 'tsdoc/syntax': 'off', + 'import/order': 'off', + 'eslint-comments/require-description': 'off', + 'no-shadow': 'off', + 'multiline-comment-style': 'off', }, - - overrides: [ - { - files: 'sha512.ts', - rules: { - // In general, it's more likely that & or | is a typo of && or ||, - // But for this file, we explicitly are using bitwise operators. - 'no-bitwise': 'off' - } - } - ] } diff --git a/packages/ripple-keypairs/.prettierrc.js b/packages/ripple-keypairs/.prettierrc.js deleted file mode 100644 index 824ccf27..00000000 --- a/packages/ripple-keypairs/.prettierrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - tabWidth: 2, - printWidth: 80, - singleQuote: true, - semi: false, - trailingComma: 'all', - arrowParens: 'always', -}; diff --git a/packages/ripple-keypairs/package.json b/packages/ripple-keypairs/package.json index aa1c84b4..4cdc445c 100644 --- a/packages/ripple-keypairs/package.json +++ b/packages/ripple-keypairs/package.json @@ -6,7 +6,7 @@ "build": "tsc -b", "test": "tsc -b && nyc mocha", "clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo", - "lint": "eslint . --ext .ts --fix", + "lint": "eslint . --ext .ts", "prepublish": "npm run lint && npm test" }, "files": [ @@ -21,32 +21,14 @@ "brorand": "^1.0.5", "elliptic": "^6.5.4", "hash.js": "^1.0.3", - "ripple-address-codec": "^4.0.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^16.4.3", - "@typescript-eslint/eslint-plugin": "^2.19.0", - "@typescript-eslint/parser": "^2.16.0", - "eslint": "^7.32.0", - "eslint-config-airbnb-base": "^14.0.0", - "eslint-config-airbnb-typescript": "^7.0.0", - "eslint-config-prettier": "^6.9.0", - "eslint-plugin-import": "^2.20.0", - "eslint-plugin-mocha": "^9.0.0", - "eslint-plugin-prettier": "^4.0.0", - "mocha": "^9.1.1", - "nyc": "^15.0.1", - "prettier": "^2.0.5", - "source-map-support": "^0.5.16", - "ts-node": "^10.2.1", - "typescript": "^4.0.3" + "ripple-address-codec": "file:../ripple-address-codec" }, "repository": { "type": "git", "url": "git@github.com:XRPLF/xrpl.js.git" }, "license": "ISC", + "prettier": "@xrplf/prettier-config", "engines": { "node": ">= 10", "npm": ">=7.0.0" diff --git a/packages/ripple-keypairs/src/sha512.ts b/packages/ripple-keypairs/src/Sha512.ts similarity index 87% rename from packages/ripple-keypairs/src/sha512.ts rename to packages/ripple-keypairs/src/Sha512.ts index e1d3c61b..9c916e6d 100644 --- a/packages/ripple-keypairs/src/sha512.ts +++ b/packages/ripple-keypairs/src/Sha512.ts @@ -1,5 +1,5 @@ -/* eslint-disable */ - +/* eslint-disable no-bitwise -- + * lots of bitwise operators necessary for this */ import * as hashjs from 'hash.js' import * as BigNum from 'bn.js' diff --git a/packages/ripple-keypairs/src/index.ts b/packages/ripple-keypairs/src/index.ts index 0557384d..288afddb 100644 --- a/packages/ripple-keypairs/src/index.ts +++ b/packages/ripple-keypairs/src/index.ts @@ -97,7 +97,6 @@ const ed25519 = { }, } -// eslint-disable-next-line @typescript-eslint/no-explicit-any function select(algorithm): any { const methods = { 'ecdsa-secp256k1': secp256k1, ed25519 } return methods[algorithm] diff --git a/packages/ripple-keypairs/src/secp256k1.ts b/packages/ripple-keypairs/src/secp256k1.ts index 09341721..f9f7c1d0 100644 --- a/packages/ripple-keypairs/src/secp256k1.ts +++ b/packages/ripple-keypairs/src/secp256k1.ts @@ -1,7 +1,5 @@ -/* eslint-disable */ - import * as elliptic from 'elliptic' -import Sha512 from './sha512' +import Sha512 from './Sha512' const secp256k1 = elliptic.ec('secp256k1') diff --git a/packages/xrpl/.eslintrc.js b/packages/xrpl/.eslintrc.js index 54a90a3c..42ce4d9f 100644 --- a/packages/xrpl/.eslintrc.js +++ b/packages/xrpl/.eslintrc.js @@ -75,6 +75,11 @@ module.exports = { { files: ['test/**/*.ts'], rules: { + // Because this project is managed by lerna, dev dependencies are + // hoisted and do not appear in the package.json. + 'import/no-extraneous-dependencies': 'off', + 'node/no-extraneous-import': 'off', + // We have lots of magic numbers in tests '@typescript-eslint/no-magic-numbers': 'off', @@ -90,14 +95,6 @@ module.exports = { // We need to mess with internal things to generate certain testing situations '@typescript-eslint/no-unsafe-member-access': 'off', - // We need to be able to import xrpl-local - 'node/no-extraneous-import': [ - 'error', - { - allowModules: ['xrpl-local'], - }, - ], - // Tests are already in 2 callbacks, so max 3 is pretty restrictive 'max-nested-callbacks': 'off', diff --git a/packages/xrpl/package.json b/packages/xrpl/package.json index 58bf0eea..3ac6f971 100644 --- a/packages/xrpl/package.json +++ b/packages/xrpl/package.json @@ -24,60 +24,14 @@ "bip39": "^3.0.4", "https-proxy-agent": "^5.0.0", "lodash": "^4.17.4", - "ripple-address-codec": "^4.1.1", - "ripple-binary-codec": "^1.1.3", - "ripple-keypairs": "^1.0.3", + "ripple-address-codec": "file:../ripple-address-codec", + "ripple-binary-codec": "file:../ripple-binary-codec", + "ripple-keypairs": "file:../ripple-keypairs", "ws": "^8.2.2" }, "resolutions": { "elliptic": "^6.5.4" }, - "devDependencies": { - "@types/chai": "^4.2.21", - "@types/lodash": "^4.14.136", - "@types/mocha": "^9.0.0", - "@types/node": "^16.4.3", - "@types/puppeteer": "5.4.4", - "@types/ws": "^8.2.0", - "@typescript-eslint/eslint-plugin": "^4.30.0", - "@typescript-eslint/parser": "^4.0.0", - "@xrplf/eslint-config": "^1.5.0", - "@xrplf/prettier-config": "^1.5.0", - "assert": "^2.0.0", - "buffer": "^6.0.2", - "chai": "^4.3.4", - "crypto-browserify": "^3.12.0", - "ejs": "^3.0.1", - "eslint": "^7.5.0", - "eslint-plugin-array-func": "^3.1.7", - "eslint-plugin-consistent-default-export-name": "^0.0.13", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-import": "^2.24.1", - "eslint-plugin-jsdoc": "^36.0.0", - "eslint-plugin-mocha": "^9.0.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-tsdoc": "^0.2.14", - "eventemitter2": "^6.0.0", - "https-browserify": "^1.0.0", - "mocha": "^9", - "npm-run-all": "^4.1.5", - "nyc": "^15", - "path-browserify": "1.0.1", - "prettier": "^2.3.2", - "process": "^0.11.10", - "puppeteer": "10.4.0", - "stream-browserify": "^3.0.0", - "stream-http": "3.2.0", - "ts-loader": "^9.2.5", - "ts-node": "^10.2.1", - "typedoc": "^0.22.5", - "typescript": "^4.4.2", - "url": "^0.11.0", - "webpack": "^5.6.0", - "webpack-bundle-analyzer": "^4.1.0", - "webpack-cli": "^4.2.0" - }, "scripts": { "build": "run-s build:lib build:snippets build:web", "build:snippets": "tsc --build ./snippets/tsconfig.json",