<|start_filename|>e2e/tests/assert.js<|end_filename|>
// @ts-check

const assert = require('chai').assert;

/**
 * @param {{ start: { line: number, offset: number }, end: { line: number, offset: number }}} span
 * @param {{ line: number, offset: number }} start
 * @param {{ line: number, offset: number }} end
 */
function assertSpan(span, start, end) {
    assertPosition(span.start, start.line, start.offset);
    assertPosition(span.end, end.line, end.offset);
};

/**
 * @param {{ line: number, offset: number }} pos
 * @param {number} line 
 * @param {number} offset
 */
function assertPosition(pos, line, offset) {
    assert.strictEqual(pos.line, line);
    assert.strictEqual(pos.offset, offset);
};

module.exports = {
    assertPosition,
    assertSpan
};

<|start_filename|>test-data/with-tslint/test.js<|end_filename|>
console.log(1 == 2)

<|start_filename|>test-data/js-disabled/test.js<|end_filename|>
console.log(1)
console.log(2)


<|start_filename|>e2e/tests/errors.test.js<|end_filename|>
// @ts-check
const { assertSpan } = require('./assert');
const assert = require('chai').assert;
const path = require('path');
const createServer = require('../server-fixture');
const { openMockFile, getFirstResponseOfType } = require('./helpers');

const tslintSource = 'tslint';

const mockFileName = path.join(__dirname, '..', 'project-fixture', 'main.ts');

const getSemanticDiagnosticsForFile = (fileContents) => {
    const server = createServer();
    openMockFile(server, mockFileName, fileContents);
    server.sendCommand('semanticDiagnosticsSync', { file: mockFileName });

    return server.close().then(_ => {
        return getFirstResponseOfType('semanticDiagnosticsSync', server);
    });
}

describe('Errors', () => {
    it('array-type', async () => {
        const errorResponse = await getSemanticDiagnosticsForFile(
            `let t: Array<string> = new Array<string>(); console.log(t);`);

        assert.isTrue(errorResponse.success);
        assert.strictEqual(errorResponse.body.length, 1);

        const [error1] = errorResponse.body;
        assert.strictEqual(error1.source, tslintSource);
        assertSpan(error1, { line: 1, offset: 8 }, { line: 1, offset: 21 });
        assert.strictEqual(error1.text, `Array type using 'Array<T>' is forbidden for simple types. Use 'T[]' instead. (array-type)`);
    });

    it('arrow-parens', async () => {
        const errorResponse = await getSemanticDiagnosticsForFile(
            `[1, 2 ].map( num => console.log(num) );`);

        assert.isTrue(errorResponse.success);
        assert.strictEqual(errorResponse.body.length, 1);

        const [error1] = errorResponse.body;
        assert.strictEqual(error1.source, tslintSource);
        assertSpan(error1, { line: 1, offset: 14 }, { line: 1, offset: 17 });
        assert.strictEqual(error1.text, `Parentheses are required around the parameters of an arrow function definition (arrow-parens)`);
    });
});


<|start_filename|>test-workspace/examples/test-javascript.js<|end_filename|>
// test a jsRule trippe equals, tripple equals quick fix is vscode-tslint contributed
   let a = 2;

    if (a == 2) {
 
    }

    [1, 2 ].map( num => console.log(num) );

<|start_filename|>test-data/with-tslint-js-config-file/tslint.js<|end_filename|>
module.exports = {
    "rules": {
        "array-type": true,
        "quotemark": 1 === 1
    }
}