{"size": 870, "ext": "js", "max_stars_repo_path": "packages/plugin-eslint/lib/move-putout-to-end-of-extends/index.js", "max_stars_repo_name": "Hans5958/putout", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/plugin-eslint/lib/move-putout-to-end-of-extends/index.js", "max_issues_repo_name": "Hans5958/putout", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/plugin-eslint/lib/move-putout-to-end-of-extends/index.js", "max_forks_repo_name": "Hans5958/putout", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.5135135135, "max_line_length": 84, "alphanum_fraction": 0.5287356322}
'use strict';

const {getExtends} = require('../get-extends');

module.exports.report = () => '"putout" should be in the end of the "extends" list';

module.exports.match = () => ({
    '__putout_processor_json(__a)': ({__a}) => {
        const elements = getExtends(__a);
        
        if (!elements.length)
            return false;
        
        const [first] = elements;
        const {value} = first;
        
        const includesPutout = value.includes('putout');
        
        if (elements.length === 1 && includesPutout)
            return false;
        
        return includesPutout;
    },
});

module.exports.replace = () => ({
    '__putout_processor_json(__a)': ({__a}, path) => {
        const elements = getExtends(__a);
        
        const first = elements.shift();
        elements.push(first);
        
        return path;
    },
});

