Comments (29)
I see. For now, we are going to keep this one aside. We revisit this if more people ask for it.
from pint.
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.
Something like:
{
"preset": "psr12",
"indent": "\t"
"lineEnding": "\n",
"rules": {
"yoda_style": false
}
}
from pint.
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.
@robclancy I agree it probably has too much already 👍
from pint.
+1
tabs, please 😄
from pint.
Yes, please +1
from pint.
+1
tabs with 2/4 size selectable, please 🙏🏻😊
from pint.
+1
from pint.
@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.
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.
@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.
You mean a custom fixer?
from pint.
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.
+1 please ... I may prepare PR, but I am currently really busy, so don't want to be promising :)
from pint.
+1
from pint.
+1
from pint.
+1
from pint.
+1
from pint.
+1 please
from pint.
+1
from pint.
+1 please
from pint.
+1 🙏
from pint.
+1
from pint.
+1
from pint.
Then why even have configuration at all? No configuration would be better than a config with holes in it.
from pint.
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.
maybe this should fix indent, but I'm not sure how to compile or test
from pint.
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)
- No .phar file at latest release. HOT 1
- Formatting results in Implements being commented out HOT 5
- `method_chaining_indentation` rule doesn't apply correctly the first time when combined with `no_space_around_double_colon` HOT 23
- Default for nullable_type_declaration_for_default_null_value HOT 4
- Lint not correct for a switch/case with ternary operator HOT 3
- issue stages all project files with no changes HOT 2
- Weird bugs when having set binary_operator_spaces: align_single_space_minimal HOT 2
- syntax error, unexpected token "=" HOT 2
- Preset for WordPress HOT 5
- Pint fails when using new PHP 8.3 features HOT 1
- Centralized Code Style Management with HTTP Presets
- I can't create a Laravel project since Pint was upgraded to 1.14.0 HOT 1
- Can't disable Laravel fixers. HOT 2
- GitHub Issue "Documentation issue" button does not link to laravel/docs HOT 1
- Format the files using stdio HOT 3
- fully_qualified_strict_types not working with pint #2 HOT 1
- [Feature Request] --help message HOT 1
- Internal class pint rule is being overridden by Final class rule HOT 1
- More extensive exlusion/inclusion rules HOT 1
- Add pronunciation to documentation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pint.