question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ava --init should respect package.json indentation

See original GitHub issue

Description

Running ava --init adds ava to my package.json but also reformats the whole file to 2 spaces instead of the 4 I have listed in my .editorconfig.

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
# and trailing whitespace removed
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,css,json}]
charset = utf-8
indent_style = space
indent_size = 4

# Matches the exact files either package.json or .travis.yml
[{.travis.yml}]
indent_style = space
indent_size = 2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Apr 16, 2017

Ah, I didn’t know that. I think it makes more sense to just preserve the existing indentation though, than specifically read .editorconfig. Could just get the indentation with detect-indent. Pull request welcome.

0reactions
sindresorhuscommented, May 13, 2017

Would it not be better to add an auto option to write-json-file?

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coping strategy for npm --save reformatting package.json
To makes matters worse, committing a change to package.json with varying indentation creates hard-to-read git diffs. Adding one dependency causes the diff look ......
Read more >
ava - npm.io
Install AVA globally and run it with --init to add AVA to your package.json . $ npm install --global ava@next $ ava --init....
Read more >
rollup.js
js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the...
Read more >
ava-init - npm
Start using ava-init in your project by running `npm i ava-init`. There are 9 other projects in the npm registry using ava-init.
Read more >
ava-ts - npm Package Health Analysis - Snyk
There are two exceptions to this however. If you use --fail-fast AVA will stop testing as soon as a failure occurs, and it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found