How to use the putout.parseOptions function in putout

To help you get started, we’ve selected a few putout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderaiser / putout / packages / babel-plugin-putout / src / index.js View on Github external
Program(path, {filename, opts}) {
                const options = parseOptions({
                    filename,
                    options: opts,
                });
                
                transform(
                    path.container,
                    code,
                    options,
                );
            },
        },
github coderaiser / putout / packages / eslint-plugin-putout / lib / putout / putout.spec.js View on Github external
'use strict';

const rule = require('./putout');
const {RuleTester} = require('eslint');

const putout = require('putout');
const options = putout.parseOptions();
const {rules} = options;

const ruleTester = new RuleTester({
    parserOptions: {
        ecmaVersion: 2019,
    },
});

ruleTester.run('putout', rule, {
    valid: [{
        options: [{
            ...options,
            rules: {
                ...rules,
                'remove-unused-variables': false,
                'strict-mode': false,
github coderaiser / putout / packages / eslint-plugin-putout / lib / putout / putout.js View on Github external
Program(node) {
                const name = context.getFilename();
                const options = getContextOptions(context);
                const resultOptions = parseOptions({
                    name,
                    options,
                });
                
                if (ignores(cwd, name, resultOptions))
                    return;
                
                const text = context
                    .getSourceCode()
                    .getText(node);
                
                const ast = parse(text);
                const places = findPlaces(ast, text, resultOptions);
                
                for (const {rule, message, position} of places) {
                    context.report({