Skip to content

Commit

Permalink
build: Added JS eslint checks also for test code
Browse files Browse the repository at this point in the history
  • Loading branch information
cederberg committed Mar 17, 2024
1 parent d950258 commit 2fa8b04
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"overrides": [
{
"files": [
"src/plugin/**/*.mjs"
"src/plugin/**/*.mjs",
"test/src/js/**/*.mjs"
],
"parserOptions": {
"ecmaVersion": 2020,
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test-html:
npx html-validate 'doc/*.html' 'src/plugin/*/files/index.tmpl'

test-js:
npx eslint src/plugin --ext '.js,.cjs,.mjs,.html,.tmpl' \
npx eslint src/plugin test/src/js --ext '.js,.cjs,.mjs,.html,.tmpl' \
--ignore-pattern 'src/plugin/legacy/**/*.js' \
--ignore-pattern '**/*.min.js' \
--ignore-pattern '**/MochiKit.js'
Expand Down
2 changes: 1 addition & 1 deletion test/src/js/loader-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export async function resolve(specifier, context, nextResolve) {
let url = `../../../src/plugin/system/files/js/${specifier}`;
specifier = new URL(url, import.meta.url).href;
}
return await nextResolve(specifier, context);
return await nextResolve(specifier, context);
}
5 changes: 4 additions & 1 deletion test/src/js/rapidcontext/data.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ test('data.map()', () => {
assert.strictEqual(typeof(getFolderIds), 'function');
assert.deepEqual(getFolderIds(null), []);
assert.deepEqual(getFolderIds([{ folder: { id: 42 } }, {}, null]), [42, undefined, undefined]);
assert.deepEqual(getFolderIds({ a: { folder: { id: 42 } }, b: {}, c: null }), { a: 42, b: undefined, c: undefined });
assert.deepEqual(
getFolderIds({ a: { folder: { id: 42 } }, b: {}, c: null }),
{ a: 42, b: undefined, c: undefined }
);
});

test('data.uniq()', () => {
Expand Down

0 comments on commit 2fa8b04

Please sign in to comment.