Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.4 KB
Raw Blame
const assert = require('node:assert/strict');
const { test: nodeTest } = require('node:test');
// Do not fall back to the separately installed repository-root toolchain.
const { ESLint } = require('../node_modules/eslint');

// The browser suite's permissive config does not validate rule options. Use
// real rules here so an incompatible transitive AJV cannot silently pass CI.
const eslint = new ESLint({
    overrideConfigFile: true,
    overrideConfig: {
        languageOptions: { ecmaVersion: 2022 },
        rules: {
            'no-undef': 'error',
            'eqeqeq': ['error', 'always'],
        },
    },
});

nodeTest('installed ESLint accepts valid JavaScript with rule options', async () => {
    const [result] = await eslint.lintText('const answer = 42; answer === 42;');

    assert.equal(result.errorCount, 0);
    assert.deepEqual(result.messages, []);
});

nodeTest('installed ESLint rejects an undefined identifier', async () => {
    const [result] = await eslint.lintText('missingValue;');

    assert.equal(result.errorCount, 1);
    assert.equal(result.fatalErrorCount, 0);
    assert.equal(result.messages[0].ruleId, 'no-undef');
});

nodeTest('installed ESLint enforces a rule with validated options', async () => {
    const [result] = await eslint.lintText('const answer = 42; answer == 42;');

    assert.equal(result.errorCount, 1);
    assert.equal(result.fatalErrorCount, 0);
    assert.equal(result.messages[0].ruleId, 'eqeqeq');
});