{"size": 2320, "ext": "js", "max_stars_repo_path": "packages/eslint-config/test/index-spec.js", "max_stars_repo_name": "terascope/teraslice", "max_stars_repo_stars_event_min_datetime": "2016-08-23T15:05:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-27T03:25:24.000Z", "max_issues_repo_path": "packages/eslint-config/test/index-spec.js", "max_issues_repo_name": "terascope/teraslice", "max_issues_repo_issues_event_min_datetime": "2015-08-13T20:00:46.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:42:02.000Z", "max_forks_repo_path": "packages/eslint-config/test/index-spec.js", "max_forks_repo_name": "terascope/teraslice", "max_forks_repo_forks_event_min_datetime": "2015-07-21T23:11:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-05T19:24:53.000Z"}
{"max_stars_count": 51, "max_issues_count": 2751, "max_forks_count": 17, "avg_line_length": 31.7808219178, "max_line_length": 107, "alphanum_fraction": 0.5051724138}
'use strict';

require('jest-extended');
const Index = require('..');

describe('ESLint Config Index', () => {
    it('should export an object of rules', () => {
        expect(Index).toHaveProperty('rules');
        expect(Index.rules).toBeObject();
    });

    it('should export js parserOptions by default', () => {
        expect(Index).toHaveProperty('parserOptions');
        expect(Index.parserOptions).toMatchObject({
            ecmaVersion: 2019,
            sourceType: 'script',
        },);
    });

    it('should export an array of configs to extends with airbnb-base', () => {
        expect(Index).toHaveProperty('extends');
        expect(Index.extends).toBeArray();
        expect(Index.extends).toContain('airbnb-base');
    });

    it('should export a list overrides with typescript and react support', () => {
        expect(Index).toHaveProperty('overrides');
        expect(Index.overrides).toBeArray();
        expect(Index.overrides[1]).toMatchObject({
            files: ['*.jsx', '*.tsx'],
            extends: ['plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'airbnb'],
            parser: '@typescript-eslint/parser',
            env: {
                jest: true,
                jasmine: false,
                node: false,
                browser: true,
            },
            parserOptions: {
                sourceType: 'module',
                ecmaFeatures: {
                    modules: true,
                    jsx: true,
                },
                useJSXTextNode: true,
            },
        });

        expect(Index.overrides[2]).toMatchObject({
            files: ['*.ts'],
            extends: ['plugin:@typescript-eslint/recommended', 'airbnb-base'],
            plugins: ['@typescript-eslint'],
            parser: '@typescript-eslint/parser',
            parserOptions: {
                sourceType: 'module',
                ecmaFeatures: {
                    modules: true,
                    jsx: false,
                },
            },
        });
    });

    it('should export an env with at least node and jest', () => {
        expect(Index).toHaveProperty('env');
        expect(Index.env).toBeObject();
        expect(Index.env).toMatchObject({
            jest: true,
            node: true
        });
    });
});
