Comments (6)
Hey!
These are desired behaviors. In the "Example 1" we prefer whitespace formatting of prettier before standard's rules. This is whole point of prettier-standard. Not sure how I can help here :/
As for the second example, for the same reason you'd need to use eslint-disable-next-line
from prettier-standard.
@sheerun thanks.
Is it not common (nor suggested) to both use prettier-standard
(for formatting) & run standard
(for linting)
(from the README):
While standard is a linter, prettier-standard is a formatter.
For example, I want to use the linter to catch things like unused variables, not handling errors, etc. What is the recommended way to achieve this?
from prettier-standard.
You need to disable whitespace checking in your .eslintrc, something like so:
{
"rules": {
"indent": "off"
}
}
from prettier-standard.
Gotcha, thanks for that. One thing I'm a little unclear about:
- Is adding this line to
.eslintrc
meant to tell thestandard
CLI to ignore the indent rule? Or is it tellingprettier-standard
to ignore the indent rule? I would expect it to be the latter.
Either way, as I'm trying this it doesn't seem to be working:
- add .eslintrc with
{"rules": {"indent": "off"}}
- Using Example 1
- Run
standard --fix
(fixes whitespace so standard is happy) - Run
prettier-standard
- whitespace gets fixed according toprettier
's rules, so now standard is no longer happy
Using: standard (10.0.3) prettier-standard (7.0.3)
I made a repo here demonstrating the above example: https://github.com/dylanjha/sample-prettier-standard, there is a .eslintrc
file in the root directory. If anyone pulls this down you can run:
yarn lint
(standard passes)yarn format-prettier
yarn lint
(standard fails)
Thank you for taking the time, appreciate the help. Cheers 🍻
from prettier-standard.
both eslint and prettier-standard will respect that .eslintrc (but prettier-standard ignores any non-fixable rules, and indentation is probably one of them).
I'm not sure that standard
respects .eslintrc, you probably need to use https://github.com/standard/eslint-config-standard instead
Also prettier-standard should be run before eslint/standard
Hope you manage to fix your setup
from prettier-standard.
Gotcha, thanks sheerun. In my example prettier-standard is fixing indentation rules, but it is ignoring the .eslintrc config. Never got to the bottom of that, but that ended up not being a blocker for me. In case anyone finds this thread, I managed fixing my setup by doing this:
- no .eslintrc
Pre commit hook:
- run
prettier-standard
(this will edit whitespace stuff + all the other prettier rules) - run
standard --fix
(this will edit whitespace stuff again to make it compliant with standard, it will fail if there are any non-fixable standard rules being broken)
On CI:
- run
standard
to lint for StandardJS compliance.
from prettier-standard.
Related Issues (20)
- Issue with the parser argument HOT 3
- Extra semi-colon added before destructuring assignment HOT 3
- not catching no-implicit-any HOT 22
- lint by default HOT 8
- Can't resolve typescript type HOT 1
- Errors while linting TypeScript HOT 12
- ternary expression formatting raises an error in standard HOT 2
- Included packages? HOT 2
- there is a format question in typescript file HOT 1
- Allow overriding `parser` option in `.eslintrc`
- Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0 HOT 2
- Feature Request: loglevel output control
- Stuck saving with 'Format On Save' enabled HOT 1
- Error: You must provide patterns to match outside of git repository HOT 2
- is it possible upgrade to eslint 7?
- How do I send a custom CLI option to eslint?
- Dependency deprecation warning in Node 16+
- Security Vulnerabilities after including prettier standard
- Where I have to put .prettierrc for customization?
- This project is abandoned 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 prettier-standard.