{"action":"created","issue":{"url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/184","repository_url":"https://api.github.com/repos/Unibeautify/unibeautify","labels_url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/184/comments","events_url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/184/events","html_url":"https://github.com/Unibeautify/unibeautify/issues/184","id":362034929,"node_id":"MDU6SXNzdWUzNjIwMzQ5Mjk=","number":184,"title":"Option to extend another unibeautify config","user":{"login":"muuvmuuv","id":11534760,"node_id":"MDQ6VXNlcjExNTM0NzYw","avatar_url":"https://avatars3.githubusercontent.com/u/11534760?v=4","gravatar_id":"","url":"https://api.github.com/users/muuvmuuv","html_url":"https://github.com/muuvmuuv","followers_url":"https://api.github.com/users/muuvmuuv/followers","following_url":"https://api.github.com/users/muuvmuuv/following{/other_user}","gists_url":"https://api.github.com/users/muuvmuuv/gists{/gist_id}","starred_url":"https://api.github.com/users/muuvmuuv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muuvmuuv/subscriptions","organizations_url":"https://api.github.com/users/muuvmuuv/orgs","repos_url":"https://api.github.com/users/muuvmuuv/repos","events_url":"https://api.github.com/users/muuvmuuv/events{/privacy}","received_events_url":"https://api.github.com/users/muuvmuuv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-20T06:23:39Z","updated_at":"2018-09-21T02:31:07Z","closed_at":null,"author_association":"NONE","body":"Some projects like webpack or TSLint have the ability to extend their config file. So we could have a different file in a subdirectory that extends or overrides parts of the one found in the root of a project.\r\n\r\n```\r\nProject\r\n├── .unibeautifyrc.json\r\n├── app\r\n│   └── .unibeautifyrc.json\r\n└── server\r\n    ├── .eslintrc.json\r\n    └── .unibeautifyrc.json\r\n```\r\n\r\n.unibeautifyrc.json @ root\r\n\r\n```json\r\n{\r\n  \"*\": {\r\n    \"indent_size\": \"2\",\r\n    \"indent_style\": \"space\"\r\n  },\r\n  \"JSON\": {\r\n    \"beautifiers\": [\"Pretty Diff\"],\r\n    \"indent_size\": \"2\",\r\n    \"indent_style\": \"space\"\r\n  }\r\n}\r\n```\r\n\r\n.unibeautifyrc.json @ app\r\n\r\n<!-- The following code block was formatted with Prettier. If this is not desired, please change this comment to `prettier-github disable`. A copy of your original code block is included below in case you want to restore it.\nLearn more about Prettier GitHub at https://github.com/jgierer12/prettier-github\n\n{\r\n    \"extend\": \"../.unibeautifyrc.json\",\r\n    \"TypeScript\": {\r\n        \"indent_style\": \"tabs\"\r\n    }\r\n}\r\n\n-->\n```json\r\n{\r\n  \"extend\": \"../.unibeautifyrc.json\",\r\n  \"TypeScript\": {\r\n    \"indent_style\": \"tabs\"\r\n  }\r\n}\r\n```\r\n\r\n.unibeautifyrc.json @ server\r\n\r\n**EDIT**: as @lassik said, it would be nice if it just looks a dir up when no file name is specified\r\n\r\n<!-- The following code block was formatted with Prettier. If this is not desired, please change this comment to `prettier-github disable`. A copy of your original code block is included below in case you want to restore it.\nLearn more about Prettier GitHub at https://github.com/jgierer12/prettier-github\n\n{\r\n    \"extend\": \"..\",\r\n    \"JavaScript\": {\r\n        \"beautifiers\": [\"ESLint\"],\r\n        \"ESLint\": {\r\n            \"prefer_beautifier_config\": true\r\n        }\r\n    }\r\n}\r\n\n-->\n```json\r\n{\r\n  \"extend\": \"..\",\r\n  \"JavaScript\": {\r\n    \"beautifiers\": [\"ESLint\"],\r\n    \"ESLint\": {\r\n      \"prefer_beautifier_config\": true\r\n    }\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/comments/423394383","html_url":"https://github.com/Unibeautify/unibeautify/issues/184#issuecomment-423394383","issue_url":"https://api.github.com/repos/Unibeautify/unibeautify/issues/184","id":423394383,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzM5NDM4Mw==","user":{"login":"Glavin001","id":1885333,"node_id":"MDQ6VXNlcjE4ODUzMzM=","avatar_url":"https://avatars0.githubusercontent.com/u/1885333?v=4","gravatar_id":"","url":"https://api.github.com/users/Glavin001","html_url":"https://github.com/Glavin001","followers_url":"https://api.github.com/users/Glavin001/followers","following_url":"https://api.github.com/users/Glavin001/following{/other_user}","gists_url":"https://api.github.com/users/Glavin001/gists{/gist_id}","starred_url":"https://api.github.com/users/Glavin001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glavin001/subscriptions","organizations_url":"https://api.github.com/users/Glavin001/orgs","repos_url":"https://api.github.com/users/Glavin001/repos","events_url":"https://api.github.com/users/Glavin001/events{/privacy}","received_events_url":"https://api.github.com/users/Glavin001/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T02:31:07Z","updated_at":"2018-09-21T02:31:07Z","author_association":"MEMBER","body":"> IMHO, absolute pathnames like /Users/myname/... are mainly seen in repos by people who are new to text-based configuration frameworks, since the same absolute pathnames don't tend to work on different computers. \r\n\r\n💯% agree.\r\n\r\n> I was under the impression that Unibeautify is supposed to be a long-lived project for universal use which just happens to be implemented in JS/Node. Therefore I would avoid baking in very Node-specific shortcuts.\r\n\r\nAlso agree. Node.js is an implementation detail.\r\n\r\n> Also, there's a very long Unix tradition that ~ at the start of a pathname refers to a user home directory - another meaning would confuse people who are used to that.\r\n\r\nI definitely do not want to have too much magic or unexpected behaviour. `~` indicates to me the Unix tradition, as I'm sure it will for many other users. Using another symbol may remove the Unix confusion, however, it's yet another non-standard thing for users to memorize.\r\n\r\n>  ```{\r\n>  \"*\": {\r\n>    \"indent_size\": \"2\",\r\n>    \"indent_style\": \"space\"\r\n>  },\r\n> ```\r\n\r\nThe `*` being apply to all? @szeck87 and I actually recently removed the `global` feature from Unibeautify in https://github.com/Unibeautify/unibeautify/pull/62\r\n\r\nI want users to be explicit when defining their Unibeautify configuration. For example, `indent_size` and `indent_style` are not valid `options` for the language `Markdown`: https://unibeautify.com/docs/language-markdown.html\r\n\r\nAlso, `beautifiers` is going to be *required*, as there will no longer be default beautifiers as there was with Atom-Beautify. Still remains a bug at https://github.com/Unibeautify/unibeautify/blob/master/src/beautifier.ts#L336\r\nSee https://github.com/Unibeautify/website/pull/146#issuecomment-416729758 for recent problem @muuvmuuv and @szeck87 were discussing.\r\n\r\nI also want to be careful when dealing with complex cases involving merging.\r\nHow should we merge languages? Merging `beautifiers`? Or other `array` type options?\r\n\r\n> EDIT: as @lassik said, it would be nice if it just looks a dir up when no file name is specified\r\n> ```\r\n> {\r\n>  \"extend\": \"..\",\r\n> ```\r\n\r\nWe can make this work. Currently we resolve the Unibeautify configuration given the directory of either the file being formatted or the project.\r\n\r\n---\r\n\r\nLots to think about 🤔 "}}
{"actor":{"display_login":"Glavin001"}}