Skip to content

Commit

Permalink
refactor(lint): fix linting errors
Browse files Browse the repository at this point in the history
fix errors thrown by linter
  • Loading branch information
Aetherinox committed Dec 23, 2024
1 parent f560372 commit 5d049f4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
5 changes: 1 addition & 4 deletions conf/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '../')
},
Expand Down
5 changes: 1 addition & 4 deletions conf/webpack.tests.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '../')
},
Expand Down
17 changes: 14 additions & 3 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,7 +71,8 @@ module.exports = [{
'mocha': mochaPlugin,
'n': pluginNode,
'prettier': pluginPrettier,
'promise': pluginPromise
'promise': pluginPromise,
'@typescript-eslint': tsPlugin
},

linterOptions: {
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
1 change: 1 addition & 0 deletions lib/format/kdbx-credentials.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/xml-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5d049f4

Please sign in to comment.