diff --git a/.eslintrc.js b/.eslintrc.js index 4fcd5f068..3fd3a5a61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,57 +1,43 @@ module.exports = { env: { es6: true, + es2020: true }, - extends: [ - "airbnb-base", - "airbnb-typescript/base", - "prettier", - "plugin:jsdoc/recommended", - ], - parserOptions: { - parser: "@typescript-eslint/parser", - project: "./config/tsconfig.json", - }, - plugins: ["@babel", "prettier", "prefer-import"], + extends: ['airbnb-base', 'prettier'], + plugins: ['@babel', 'prettier', 'prefer-import'], + parser: '@typescript-eslint/parser', rules: { // OFF - "node/no-unpublished-require": 0, - "import/prefer-default-export": 0, - "node/no-unsupported-features/es-syntax": 0, - "node/no-unsupported-features/es-builtins": 0, + 'import/prefer-default-export': 0, + 'node/no-unsupported-features/es-syntax': 0, + 'node/no-unsupported-features/es-builtins': 0, camelcase: 0, - "class-methods-use-this": 0, - "linebreak-style": 0, - "jsdoc/require-returns": 0, - "jsdoc/require-param": 0, - "jsdoc/require-param-type": 0, - "jsdoc/require-returns-type": 0, - "jsdoc/no-blank-blocks": 0, - "jsdoc/no-multi-asterisks": 0, - "jsdoc/tag-lines": "off", - "jsdoc/require-jsdoc": "off", - "jsdoc/no-defaults": "off", - "valid-jsdoc": "off", - "import/extensions": 0, - "new-cap": 0, - "no-param-reassign": 0, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "prefer-destructuring": 0, - "lines-between-class-members": 0, - "@typescript-eslint/lines-between-class-members": "off", - "spaced-comment": 0, + 'class-methods-use-this': 0, + 'linebreak-style': 0, + 'new-cap': 0, + 'no-param-reassign': 0, + 'no-underscore-dangle': 0, + 'no-use-before-define': 0, + 'prefer-destructuring': 0, + 'lines-between-class-members': 0, // WARN - "arrow-body-style": 1, - "no-console": ["warn", { allow: ["assert"] }], - "no-debugger": 1, - "object-shorthand": 1, - "prefer-const": 1, - "prefer-import/prefer-import-over-require": [1], - "require-await": 1, + 'prefer-import/prefer-import-over-require': [1], + 'no-console': ['warn', { allow: ['assert'] }], + 'no-debugger': 1, + 'no-unused-vars': 1, + 'arrow-body-style': 1, + 'valid-jsdoc': [ + 1, + { + requireReturnDescription: false + } + ], + 'prefer-const': 1, + 'object-shorthand': 1, + 'require-await': 1, // ERROR - "no-unused-expressions": [2, { allowTaggedTemplates: true }], - }, + 'no-unused-expressions': [2, { allowTaggedTemplates: true }] + } }; diff --git a/package.json b/package.json index e87484f5d..c1200df93 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "build:docs": "cross-env NODE_ENV=docs yarn _babel", "clean": "rm -rf lib/ dist/ coverage/ .nyc_output/ jsdoc/ test/e2e/.soroban", "docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json", + "lint": "eslint -c ./config/.eslintrc.js 'src/**/*.{ts,tsx}' && dtslint --localTs node_modules/typescript/lib types/", "test": "yarn build:test && yarn test:node && yarn test:integration && yarn test:browser", "test:e2e": "./test/e2e/initialize.sh && yarn _nyc mocha --recursive 'test/e2e/src/test-*.js'", "test:node": "yarn _nyc mocha --recursive 'test/unit/**/*.js'", diff --git a/test/.eslintrc.js b/test/.eslintrc.js index 693deb59d..d8c9b3d83 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -2,6 +2,8 @@ module.exports = { env: { mocha: true, }, + parser: "@typescript-eslint/parser", + plugins: ["@babel", "prettier", "prefer-import"], globals: { StellarSdk: true, axios: true, diff --git a/types/.eslintrc.js b/types/.eslintrc.js new file mode 100644 index 000000000..c5bdc47cb --- /dev/null +++ b/types/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + parser: "@typescript-eslint/parser", +}; diff --git a/types/tslint.json b/types/tslint.json new file mode 100644 index 000000000..f57aca3ff --- /dev/null +++ b/types/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "@definitelytyped/dtslint/dtslint.json", + "rules": { + "indent": [true, "spaces"], + "trailing-comma": [true, "always"], + "semicolon": [true, "always"] + } +} diff --git a/yarn.lock b/yarn.lock index 4c030bbc6..0b33621fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1471,7 +1471,6 @@ integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== dependencies: "@types/yargs-parser" "*" - "@typescript-eslint/eslint-plugin@^8.13.0": version "8.18.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.1.tgz#992e5ac1553ce20d0d46aa6eccd79dc36dedc805" @@ -1509,14 +1508,6 @@ "@typescript-eslint/visitor-keys" "8.18.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@7.18.0": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz#c928e7a9fc2c0b3ed92ab3112c614d6bd9951c83" - integrity sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA== - dependencies: - "@typescript-eslint/types" "7.18.0" - "@typescript-eslint/visitor-keys" "7.18.0" - "@typescript-eslint/scope-manager@8.18.1": version "8.18.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.18.1.tgz#52cedc3a8178d7464a70beffed3203678648e55b"