Skip to content

Node.js based forum software built for the modern web

test: eslint for tests

Barış Soner Uşaklıf864a5a4aced
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 16d7765a5a..dd39fc1544 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -2,8 +2,11 @@
import serverConfig from 'eslint-config-nodebb';
import publicConfig from 'eslint-config-nodebb/public';
+import commonRules from 'eslint-config-nodebb/common';
import { defineConfig } from 'eslint/config';
+import stylisticJs from '@stylistic/eslint-plugin-js'
+import js from '@eslint/js';
import globals from 'globals';
export default defineConfig([
@@ -30,6 +33,11 @@ export default defineConfig([
},
// tests
{
+ plugins: {
+ js,
+ '@stylistic/js': stylisticJs,
+ },
+ extends: ['js/recommended'],
files: ['test/**/*.js'],
languageOptions: {
ecmaVersion: 2020,
@@ -44,12 +52,13 @@ export default defineConfig([
after: 'readonly',
afterEach: 'readonly',
},
- },
+ },
rules: {
- 'no-unused-vars': 'off',
+ ...commonRules,
+ 'no-unused-vars': 'off',
'no-prototype-builtins': 'off',
}
- },
+ },
...publicConfig,
...serverConfig
]);
diff --git a/install/package.json b/install/package.json
index 0b552cc350..6847b63b3c 100644
--- a/install/package.json
+++ b/install/package.json
@@ -163,7 +163,7 @@
"coveralls": "3.1.1",
"@eslint/js": "9.25.1",
"@stylistic/eslint-plugin-js": "4.2.0",
- "eslint-config-nodebb": "1.1.3",
+ "eslint-config-nodebb": "1.1.4",
"eslint-plugin-import": "2.31.0",
"grunt": "1.6.1",
"grunt-contrib-watch": "1.1.0",
diff --git a/test/topics/thumbs.js b/test/topics/thumbs.js
index ad674a5ba0..afc13e5b22 100644
--- a/test/topics/thumbs.js
+++ b/test/topics/thumbs.js
@@ -244,7 +244,7 @@ describe('Topic thumbs', () => {
it('should also work with UUIDs', async () => {
await topics.thumbs.associate({
id: uuid,
- path: `/files/test.png`
+ path: `/files/test.png`,
});
await topics.thumbs.delete(uuid, '/files/test.png');
@@ -268,13 +268,6 @@ describe('Topic thumbs', () => {
assert.strictEqual(await file.exists(thumbPaths[0]), true);
});
- // it('should handle an array of relative paths', async () => {
- // await topics.thumbs.associate({ id: 1, path: thumbPaths[0] });
- // await topics.thumbs.associate({ id: 1, path: thumbPaths[1] });
-
- // await topics.thumbs.delete(1, [relativeThumbPaths[0], relativeThumbPaths[1]]);
- // });
-
it('should have no more thumbs left', async () => {
const associated = await db.isSortedSetMembers(`topic:1:thumbs`, [relativeThumbPaths[0], relativeThumbPaths[1]]);
assert.strictEqual(associated.some(Boolean), false);
diff --git a/test/utils.js b/test/utils.js
index 637ab4ab31..353ab3f83a 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -285,6 +285,7 @@ describe('Utility Methods', () => {
});
it('should return passed in value if invalid', (done) => {
+ // eslint-disable-next-line no-loss-of-precision
const bigInt = -111111111111111111;
const result = utils.toISOString(bigInt);
assert.equal(bigInt, result);