diff --git a/.dockerignore b/.dockerignore index 608a4aae..b81e86ec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -24,7 +24,6 @@ typings/ _config.yml .classpath .DS_Store -.eslintrc.json .gitattributes .gitignore .idea diff --git a/.eslintrc.json b/.eslintrc.json index 84cb01fc..3020a913 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,8 @@ "plugin:@angular-eslint/template/process-inline-templates" ], "rules": { + "@angular-eslint/component-selector": ["error", { "prefix": "rtl", "style": "kebab-case", "type": "element" }], + "@angular-eslint/directive-selector": ["error", { "style": "camelCase", "type": "attribute" }], "@angular-eslint/consistent-component-styles": "off", "@angular-eslint/prefer-on-push-component-change-detection": "off", "@angular-eslint/prefer-standalone": "off", @@ -190,8 +192,6 @@ ], "rules": { "@angular-eslint/arrow-body-style": "off", - "@angular-eslint/component-selector": ["error", { "prefix": "rtl", "style": "kebab-case", "type": "element" }], - "@angular-eslint/directive-selector": ["error", { "style": "camelCase", "type": "attribute" }], "@angular-eslint/template/accessibility-elements-content": "off", "@angular-eslint/template/accessibility-interactive-supports-focus": "off", "@angular-eslint/template/button-has-type": "off", diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 637285cf..434ebbe3 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -59,12 +59,9 @@ jobs: if: steps.cache-npm-packages.outputs.cache-hit != 'true' run: npm ci --legacy-peer-deps - - name: Lint Scripts + - name: Lint Src and Server run: npm run lint - - name: Lint Server Script - run: npm run lintServer - test: name: Test runs-on: ubuntu-latest diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..fdc25922 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "eslint.enable": true, + "eslint.validate": [ + "typescript", + "HTML" + ], + "eslint.options": { + "configFile": ".eslintrc.json" + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } +} diff --git a/angular.json b/angular.json index a6008454..25d2c300 100644 --- a/angular.json +++ b/angular.json @@ -111,16 +111,6 @@ ], "scripts": [] } - }, - "lint": { - "builder": "@angular-eslint/builder:lint", - "options": { - "eslintConfig": ".eslintrc.json", - "lintFilePatterns": [ - "src/**/*.ts", - "src/**/*.html" - ] - } } } } diff --git a/backend/controllers/cln/getInfo.js b/backend/controllers/cln/getInfo.js index 9b917173..53a9101e 100644 --- a/backend/controllers/cln/getInfo.js +++ b/backend/controllers/cln/getInfo.js @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database } from '../../utils/database.js'; import { Logger } from '../../utils/logger.js'; import { Common } from '../../utils/common.js'; import { CLWSClient } from './webSocketClient.js'; @@ -7,7 +6,6 @@ let options = null; const logger = Logger; const common = Common; const clWsClient = CLWSClient; -const databaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting Core Lightning Node Information..' }); common.logEnvVariables(req); diff --git a/backend/controllers/eclair/getInfo.js b/backend/controllers/eclair/getInfo.js index eb2ccf8b..813baa53 100644 --- a/backend/controllers/eclair/getInfo.js +++ b/backend/controllers/eclair/getInfo.js @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database } from '../../utils/database.js'; import { Logger } from '../../utils/logger.js'; import { Common } from '../../utils/common.js'; import { ECLWSClient } from './webSocketClient.js'; @@ -7,7 +6,6 @@ let options = null; const logger = Logger; const common = Common; const eclWsClient = ECLWSClient; -const databaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting Eclair Node Information..' }); common.logEnvVariables(req); diff --git a/backend/controllers/lnd/getInfo.js b/backend/controllers/lnd/getInfo.js index fbc72493..dd846ee9 100644 --- a/backend/controllers/lnd/getInfo.js +++ b/backend/controllers/lnd/getInfo.js @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database } from '../../utils/database.js'; import { Logger } from '../../utils/logger.js'; import { Common } from '../../utils/common.js'; import { LNDWSClient } from './webSocketClient.js'; @@ -7,7 +6,6 @@ let options = null; const logger = Logger; const common = Common; const lndWsClient = LNDWSClient; -const databaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting LND Node Information..' }); common.logEnvVariables(req); diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..6f5e44ba --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,11 @@ +import { FlatCompat } from '@eslint/eslintrc'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const compat = new FlatCompat({ + baseDirectory: dirname(fileURLToPath(import.meta.url)) +}); + +export default [ + ...compat.extends('./.eslintrc.json') +]; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d6fe7685..a3da83d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,6 +58,7 @@ "@angular/platform-browser": "^18.0.1", "@angular/platform-browser-dynamic": "^18.0.1", "@angular/router": "^18.0.1", + "@eslint/eslintrc": "^3.1.0", "@fortawesome/angular-fontawesome": "^0.15.0", "@fortawesome/fontawesome-svg-core": "^6.5.2", "@fortawesome/free-regular-svg-icons": "^6.5.2", diff --git a/package.json b/package.json index 3336eb40..9c1d58a1 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ "serverUbuntu": "NODE_ENV=development nodemon --watch backend --watch server ./rtl.js", "testdev": "ng test --watch=true --code-coverage", "test": "ng test --watch=false --browsers=ChromeHeadless", - "lint": "ng lint", - "lintServer": "eslint ./server/**/* --ext .ts" + "lint": "eslint" }, "private": true, "dependencies": { @@ -71,6 +70,7 @@ "@angular/platform-browser": "^18.0.1", "@angular/platform-browser-dynamic": "^18.0.1", "@angular/router": "^18.0.1", + "@eslint/eslintrc": "^3.1.0", "@fortawesome/angular-fontawesome": "^0.15.0", "@fortawesome/fontawesome-svg-core": "^6.5.2", "@fortawesome/free-regular-svg-icons": "^6.5.2", @@ -97,4 +97,4 @@ "ts-node": "^10.9.2", "typescript": "~5.4.5" } -} \ No newline at end of file +} diff --git a/server/controllers/cln/getInfo.ts b/server/controllers/cln/getInfo.ts index bdb773d9..ac311a74 100644 --- a/server/controllers/cln/getInfo.ts +++ b/server/controllers/cln/getInfo.ts @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database, DatabaseService } from '../../utils/database.js'; import { Logger, LoggerService } from '../../utils/logger.js'; import { Common, CommonService } from '../../utils/common.js'; import { CLWSClient, CLWebSocketClient } from './webSocketClient.js'; @@ -8,7 +7,6 @@ let options = null; const logger: LoggerService = Logger; const common: CommonService = Common; const clWsClient: CLWebSocketClient = CLWSClient; -const databaseService: DatabaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting Core Lightning Node Information..' }); diff --git a/server/controllers/eclair/getInfo.ts b/server/controllers/eclair/getInfo.ts index ad7a0b3f..67f6c0de 100644 --- a/server/controllers/eclair/getInfo.ts +++ b/server/controllers/eclair/getInfo.ts @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database, DatabaseService } from '../../utils/database.js'; import { Logger, LoggerService } from '../../utils/logger.js'; import { Common, CommonService } from '../../utils/common.js'; import { ECLWSClient, ECLWebSocketClient } from './webSocketClient.js'; @@ -8,7 +7,6 @@ let options = null; const logger: LoggerService = Logger; const common: CommonService = Common; const eclWsClient: ECLWebSocketClient = ECLWSClient; -const databaseService: DatabaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting Eclair Node Information..' }); diff --git a/server/controllers/lnd/getInfo.ts b/server/controllers/lnd/getInfo.ts index ad686995..658975ef 100644 --- a/server/controllers/lnd/getInfo.ts +++ b/server/controllers/lnd/getInfo.ts @@ -1,5 +1,4 @@ import request from 'request-promise'; -import { Database, DatabaseService } from '../../utils/database.js'; import { Logger, LoggerService } from '../../utils/logger.js'; import { Common, CommonService } from '../../utils/common.js'; import { LNDWSClient, LNDWebSocketClient } from './webSocketClient.js'; @@ -8,7 +7,6 @@ let options = null; const logger: LoggerService = Logger; const common: CommonService = Common; const lndWsClient: LNDWebSocketClient = LNDWSClient; -const databaseService: DatabaseService = Database; export const getInfo = (req, res, next) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'GetInfo', msg: 'Getting LND Node Information..' }); diff --git a/src/app/shared/directive/clipboard.directive.ts b/src/app/shared/directive/clipboard.directive.ts index 7f69bf6e..74e5c172 100644 --- a/src/app/shared/directive/clipboard.directive.ts +++ b/src/app/shared/directive/clipboard.directive.ts @@ -32,7 +32,6 @@ export class ClipboardDirective { try { // Allowing deprecated command for older browsers where navigator is not available. // For newer browsers where execCommand is deprecated, navigator should be available and this fallback will not be called. - // eslint-disable-next-line deprecation/deprecation const result = document.execCommand('copy'); if (result) { this.copied.emit(this.payload.toString());