diff --git a/conf/webpack.config.ts b/conf/webpack.config.ts index d1882fd..ba8ffa2 100644 --- a/conf/webpack.config.ts +++ b/conf/webpack.config.ts @@ -38,10 +38,7 @@ module.exports = { }, resolve: { extensions: ['.ts', '.js'], - modules: [ - path.join(__dirname, '../util'), - path.join(__dirname, '../node_modules') - ], + modules: [path.join(__dirname, '../util'), path.join(__dirname, '../node_modules')], alias: { '@': path.resolve(__dirname, '../') }, diff --git a/conf/webpack.tests.config.ts b/conf/webpack.tests.config.ts index eac0919..f4e49f2 100644 --- a/conf/webpack.tests.config.ts +++ b/conf/webpack.tests.config.ts @@ -36,10 +36,7 @@ module.exports = { }, resolve: { extensions: ['.ts', '.js'], - modules: [ - path.join(__dirname, '../test'), - path.join(__dirname, '../node_modules') - ], + modules: [path.join(__dirname, '../test'), path.join(__dirname, '../node_modules')], alias: { '@': path.resolve(__dirname, '../') }, diff --git a/eslint.config.cjs b/eslint.config.cjs index 9e66ca7..45f8b84 100644 --- a/eslint.config.cjs +++ b/eslint.config.cjs @@ -30,6 +30,7 @@ const pluginNode = require('eslint-plugin-n'); const pluginPrettier = require('eslint-plugin-prettier'); const pluginPromise = require('eslint-plugin-promise'); const mochaPlugin = require('eslint-plugin-mocha'); +const tsPlugin = require('@typescript-eslint/eslint-plugin'); /* Globals @@ -70,7 +71,8 @@ module.exports = [{ 'mocha': mochaPlugin, 'n': pluginNode, 'prettier': pluginPrettier, - 'promise': pluginPromise + 'promise': pluginPromise, + '@typescript-eslint': tsPlugin }, linterOptions: { @@ -100,7 +102,17 @@ module.exports = [{ sourceType: 'module', }, rules: { - // eslint / js rules + + /* + Turn off original and add back typescript version + */ + + "no-unused-vars": 'off', + "@typescript-eslint/no-unused-vars": ["error"], + + "no-redeclare": 'off', + "@typescript-eslint/no-redeclare": "error", + 'array-callback-return': 'error', 'curly': 'error', 'eqeqeq': 'error', @@ -118,7 +130,6 @@ module.exports = [{ 'no-throw-literal': 'off', 'no-unneeded-ternary': 'error', 'no-unused-expressions': 'off', - 'no-unused-vars': 'error', 'no-useless-constructor': 'error', 'no-useless-escape': 'off', 'no-var': 'error', diff --git a/lib/format/kdbx-credentials.ts b/lib/format/kdbx-credentials.ts index 3b79d90..1c6ecd1 100644 --- a/lib/format/kdbx-credentials.ts +++ b/lib/format/kdbx-credentials.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import * as XmlUtils from '../utils/xml-utils'; import * as CryptoEngine from '../crypto/crypto-engine'; import { ProtectedValue } from '../crypto/protected-value'; diff --git a/lib/utils/xml-utils.ts b/lib/utils/xml-utils.ts index 2d208bd..434aa7f 100644 --- a/lib/utils/xml-utils.ts +++ b/lib/utils/xml-utils.ts @@ -164,7 +164,7 @@ export function getText(node: Node | null): string | undefined { if (!node?.childNodes) { return undefined; } - return node.protectedValue ? node.protectedValue.getText() : node.textContent ?? undefined; + return node.protectedValue ? node.protectedValue.getText() : (node.textContent ?? undefined); } export function setText(node: Node, text: string | undefined): void {