Skip to content

Commit f3731e1

Browse files
committed
Moved to eslint 9.8, small code fixes
1 parent 90faf29 commit f3731e1

6 files changed

+317
-53
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

eslint.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const { configs } = require('@eslint/js');
2+
const jest = require('eslint-plugin-jest');
3+
4+
module.exports = [
5+
configs.recommended,
6+
{
7+
languageOptions: {
8+
ecmaVersion: 'latest',
9+
sourceType: 'commonjs',
10+
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' }
11+
},
12+
rules: {
13+
semi: 'error',
14+
quotes: ['error', 'single'],
15+
indent: ['error', 4, { 'SwitchCase': 1 }],
16+
'no-unused-vars':
17+
[
18+
'warn',
19+
{
20+
'varsIgnorePattern': '^_',
21+
'args': 'after-used',
22+
'argsIgnorePattern': '^_'
23+
}
24+
]
25+
},
26+
ignores: ['coverage/']
27+
},
28+
{
29+
files: ['test/*.js'],
30+
...jest.configs['flat/recommended'],
31+
rules: {
32+
...jest.configs['flat/recommended'].rules
33+
}
34+
}
35+
];

mongoose-encrypted-string.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const SchemaType = require('mongoose').SchemaType
1+
const SchemaType = require('mongoose').SchemaType;
22
const sc = require('@tsmx/string-crypto');
33

44
class EncryptedString extends SchemaType {
55
constructor(key, options) {
6-
options.get = (v) => { return sc.decrypt(v, { key: EncryptedString.options.key, passNull: true }); }
7-
options.set = (v) => { return sc.encrypt(v, { key: EncryptedString.options.key, passNull: true }); }
6+
options.get = (v) => { return sc.decrypt(v, { key: EncryptedString.options.key, passNull: true }); };
7+
options.set = (v) => { return sc.encrypt(v, { key: EncryptedString.options.key, passNull: true }); };
88
super(key, options, 'EncryptedString');
99
}
1010

@@ -14,11 +14,11 @@ class EncryptedString extends SchemaType {
1414

1515
static options = {
1616
key: null
17-
}
17+
};
1818

1919
}
2020

2121
module.exports.registerEncryptedString = function (mongoose, key) {
2222
EncryptedString.options.key = key;
2323
mongoose.Schema.Types.EncryptedString = EncryptedString;
24-
}
24+
};

0 commit comments

Comments
 (0)