Coder Social home page Coder Social logo

->setIndent("\t") about pint HOT 29 CLOSED

thyseus avatar thyseus commented on May 9, 2024 12
->setIndent("\t")

from pint.

Comments (29)

nunomaduro avatar nunomaduro commented on May 9, 2024 10

I see. For now, we are going to keep this one aside. We revisit this if more people ask for it.

from pint.

robclancy avatar robclancy commented on May 9, 2024 6

I see. For now, we are going to keep this one aside. We revisit this if more people ask for it.

This right here is just very annoying. You claim to have a simplified drop in replacement yet you can't configure the main thing to do with code style. It shows once again that this should have been a preset instead of a new package, or at the very least a wrapper for a proper preset so you could use the single binary or the preset. Luckily in the JS world people just make esling plugins with their own rules (part of the reason for this package as well I guess is because php cs fixer is just not as good as eslint for this type of thing).

But FFS choosing indentation is a core fucking part of code style. Also there isn't actually "real" reasons to use spaces over tabs anymore. But there are for using tabs over spaces. prettier/prettier#7475 (comment)

Edit: not to mention this issue was closed because you don't even know how php cs fixer works. And then no re-opened when it's clear that this functionality is missing. So even if you aren't going to do this the issue should still be open.

from pint.

thyseus avatar thyseus commented on May 9, 2024 5

Something like:

{
    "preset": "psr12",
    "indent": "\t"
    "lineEnding": "\n",
    "rules": {
        "yoda_style": false
    }
}

from pint.

chrisreedio avatar chrisreedio commented on May 9, 2024 5

I really enjoyed test driving Pint but the only thing missing for me is the ability to use tabs instead of spaces.

I have a large number of repos that I manage and they all use tabs.

I completely understand the aforementioned points on less configuration is better but I would switch to Pint immediately if we could set this.

Thanks again for the hard work in bringing this open source package to the world!

from pint.

taylorotwell avatar taylorotwell commented on May 9, 2024 2

@robclancy I agree it probably has too much already 👍

from pint.

skch-dev avatar skch-dev commented on May 9, 2024 1

+1
tabs, please 😄

from pint.

MartinPL avatar MartinPL commented on May 9, 2024 1

Yes, please +1

from pint.

camiant avatar camiant commented on May 9, 2024 1

+1
tabs with 2/4 size selectable, please 🙏🏻😊

from pint.

DeQuasar avatar DeQuasar commented on May 9, 2024 1

+1

from pint.

taylorotwell avatar taylorotwell commented on May 9, 2024 1

@robclancy I don't have a strong opinion on this issue; however, please read the first line of the Pint readme:

Laravel Pint is an opinionated PHP code style fixer for minimalists.

Opinionated. The whole point of Pint was to format things how Laravel internally formats things with as close to zero configuration as possible. Of course there are lots of knobs and levers that are probably "missing" compared to php-cs-fixer. That is literally the entire point of this package. Anyone is free to just use php-cs-fixer directly if Pint is too opinionated for them or doesn't have enough customization options.

from pint.

nunomaduro avatar nunomaduro commented on May 9, 2024

You should read this section: https://github.com/laravel/pint#rules. You see rules, and how to configure them here: https://mlocati.github.io/php-cs-fixer-configurator/.

from pint.

thyseus avatar thyseus commented on May 9, 2024

@nunomaduro thanks for your reply, unfortunately the Indentation and Line Ending is not a "rule" but a independent php-cs-fixer setting. I think laravel-pint is not yet able to set Indentation and Line Ending.

from pint.

nunomaduro avatar nunomaduro commented on May 9, 2024

You mean a custom fixer?

from pint.

thyseus avatar thyseus commented on May 9, 2024

This is my .php-cs-fixer.php:

<?php

$finder = PhpCsFixer\Finder::create()
	->in(__DIR__)
	->name('*.php')
	->name('*.inc')
    ->name('*.phtml')
    ->exclude('storage');

$config = new PhpCsFixer\Config();

return $config
	->setIndent("\t")
	->setLineEnding("\n")
	->setRules([
		'@PSR12'                        => true,
		'@PhpCsFixer'                   => true,
		'binary_operator_spaces'        => false, // keep left and right area of = sign untouched
		'yoda_style'                    => false,
// ...

As you can see, rules are set via setRules(). setIndent() and setLineEnding() are separate configuration methods that needs to be called in order to configure them. We need a way to pass these values via pint.json to the underlying php-cs-fixer in my opinion.

from pint.

miskith avatar miskith commented on May 9, 2024

+1 please ... I may prepare PR, but I am currently really busy, so don't want to be promising :)

from pint.

genintho avatar genintho commented on May 9, 2024

+1

from pint.

Alpha1337k avatar Alpha1337k commented on May 9, 2024

+1

from pint.

axtg avatar axtg commented on May 9, 2024

+1

from pint.

Stiropor avatar Stiropor commented on May 9, 2024

+1

from pint.

wischerdson avatar wischerdson commented on May 9, 2024

+1 please

from pint.

leandrodiogenes avatar leandrodiogenes commented on May 9, 2024

+1

from pint.

KaloyanYosifov avatar KaloyanYosifov commented on May 9, 2024

+1 please

from pint.

danielemontecchi avatar danielemontecchi commented on May 9, 2024

+1 🙏

from pint.

mrneatly avatar mrneatly commented on May 9, 2024

+1

from pint.

 avatar commented on May 9, 2024

+1

from pint.

robclancy avatar robclancy commented on May 9, 2024

Then why even have configuration at all? No configuration would be better than a config with holes in it.

from pint.

johnbacon avatar johnbacon commented on May 9, 2024

Likewise, @chrisreedio! We've turned to using jetstreamlabs/pinte, but relying on any third-party fork has its downsides.

Real life conflicts with best intentions sometimes. I'm personally A-OK with spaces, but I can't get my engineering leadership on board, so it's turned into a dealbreaker.

from pint.

alexandertsintsadze avatar alexandertsintsadze commented on May 9, 2024

+1
image
image
image

image
maybe this should fix indent, but I'm not sure how to compile or test

from pint.

johnbacon avatar johnbacon commented on May 9, 2024

jetstreamlabs/pinte isn't updated much, so I've added tab + EOL capabilities only as a fork at johnbacon/stout.

from pint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.