{"action":"created","issue":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1248","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1248/labels{/name}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1248/comments","events_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1248/events","html_url":"https://github.com/jscs-dev/node-jscs/issues/1248","id":67174058,"number":1248,"title":"Autofixing indentation causes misalignment of nested lines","user":{"login":"lsjroberts","id":3817697,"avatar_url":"https://avatars.githubusercontent.com/u/3817697?v=3","gravatar_id":"","url":"https://api.github.com/users/lsjroberts","html_url":"https://github.com/lsjroberts","followers_url":"https://api.github.com/users/lsjroberts/followers","following_url":"https://api.github.com/users/lsjroberts/following{/other_user}","gists_url":"https://api.github.com/users/lsjroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/lsjroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsjroberts/subscriptions","organizations_url":"https://api.github.com/users/lsjroberts/orgs","repos_url":"https://api.github.com/users/lsjroberts/repos","events_url":"https://api.github.com/users/lsjroberts/events{/privacy}","received_events_url":"https://api.github.com/users/lsjroberts/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jscs-dev/node-jscs/labels/autofix","name":"autofix","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"mikesherov","id":364532,"avatar_url":"https://avatars.githubusercontent.com/u/364532?v=3","gravatar_id":"","url":"https://api.github.com/users/mikesherov","html_url":"https://github.com/mikesherov","followers_url":"https://api.github.com/users/mikesherov/followers","following_url":"https://api.github.com/users/mikesherov/following{/other_user}","gists_url":"https://api.github.com/users/mikesherov/gists{/gist_id}","starred_url":"https://api.github.com/users/mikesherov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikesherov/subscriptions","organizations_url":"https://api.github.com/users/mikesherov/orgs","repos_url":"https://api.github.com/users/mikesherov/repos","events_url":"https://api.github.com/users/mikesherov/events{/privacy}","received_events_url":"https://api.github.com/users/mikesherov/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-04-08T17:00:04Z","updated_at":"2015-04-08T21:18:15Z","closed_at":null,"body":"Apologies if this has already been reported but I couldn't see an existing issue.\r\n\r\n```\r\n$ jscs --version\r\n1.12.0\r\n```\r\n\r\nRunning:\r\n\r\n```\r\n$ jscs test.js --fix\r\n```\r\n\r\nOn:\r\n\r\n```js\r\n// test.js\r\nvar foo = {\r\n        \"bar\": {\r\n            \"baz\": \"baz\",\r\n            \"qux\": \"qux\"\r\n        }\r\n};\r\n\r\n```\r\n\r\nResult:\r\n\r\n```js\r\nvar foo = {\r\n    \"bar\": {\r\n            \"baz\": \"baz\",\r\n            \"qux\": \"qux\"\r\n        }\r\n};\r\n\r\n```\r\n\r\n**It correctly fixes line 2 but this then leaves the nested and block closing lines 3 & 4 with incorrect indentation.**\r\n\r\nUsing this `.jscsrc`:\r\n\r\n```json\r\n{\r\n    \"disallowEmptyBlocks\": true,\r\n    \"disallowKeywords\": [\r\n        \"do\"\r\n    ],\r\n    \"disallowKeywordsOnNewLine\": [\r\n        \"else\"\r\n    ],\r\n    \"disallowMixedSpacesAndTabs\": \"smart\",\r\n    \"disallowMultipleLineBreaks\": true,\r\n    \"disallowNewlineBeforeBlockStatements\": true,\r\n    \"disallowPaddingNewlinesInBlocks\": true,\r\n    \"disallowSpaceAfterObjectKeys\": true,\r\n    \"disallowSpacesInAnonymousFunctionExpression\": {\r\n        \"beforeOpeningRoundBrace\": true\r\n    },\r\n    \"disallowSpacesInCallExpression\": true,\r\n    \"disallowSpacesInFunctionDeclaration\": {\r\n        \"beforeOpeningRoundBrace\": true\r\n    },\r\n    \"disallowSpacesInsideArrayBrackets\": true,\r\n    \"disallowSpacesInsideObjectBrackets\": true,\r\n    \"disallowSpacesInsideParentheses\": true,\r\n    \"disallowTrailingComma\": true,\r\n    \"disallowTrailingWhitespace\": true,\r\n    \"maximumLineLength\": 120,\r\n    \"requireBlocksOnNewline\": true,\r\n    \"requireCapitalizedConstructors\": true,\r\n    \"requireCommaBeforeLineBreak\": true,\r\n    \"requireCurlyBraces\": [\r\n        \"for\",\r\n        \"if\",\r\n        \"switch\",\r\n        \"try\",\r\n        \"catch\",\r\n        \"while\",\r\n        \"with\",\r\n        \"return\",\r\n        \"function\"\r\n    ],\r\n    \"requireLineBreakAfterVariableAssignment\": true,\r\n    \"requireLineFeedAtFileEnd\": true,\r\n    \"requireMultipleVarDecl\": true,\r\n    \"requireOperatorBeforeLineBreak\": true,\r\n    \"requirePaddingNewlinesBeforeKeywords\": [\r\n        \"for\",\r\n        \"if\",\r\n        \"switch\",\r\n        \"try\",\r\n        \"catch\",\r\n        \"void\",\r\n        \"while\",\r\n        \"with\",\r\n        \"return\",\r\n        \"typeof\",\r\n        \"function\"\r\n    ],\r\n    \"requirePaddingNewLineAfterVariableDeclaration\": true,\r\n    \"requirePaddingNewLinesInObjects\": true,\r\n    \"requireParenthesesAroundIIFE\": true,\r\n    \"requireQuotedKeysInObjects\": true,\r\n    \"requireSpaceAfterBinaryOperators\": true,\r\n    \"requireSpaceAfterKeywords\": [\r\n        \"for\",\r\n        \"if\",\r\n        \"else\",\r\n        \"switch\",\r\n        \"case\",\r\n        \"try\",\r\n        \"catch\",\r\n        \"void\",\r\n        \"while\",\r\n        \"with\",\r\n        \"return\",\r\n        \"typeof\"\r\n    ],\r\n    \"requireSpaceAfterLineComment\": true,\r\n    \"requireSpaceBeforeBinaryOperators\": true,\r\n    \"requireSpaceBeforeBlockStatements\": true,\r\n    \"requireSpaceBeforeKeywords\": [\r\n        \"else\",\r\n        \"catch\",\r\n        \"while\"\r\n    ],\r\n    \"requireSpaceBeforeObjectValues\": true,\r\n    \"requireSpaceBetweenArguments\": true,\r\n    \"requireSpacesInAnonymousFunctionExpression\": {\r\n        \"beforeOpeningCurlyBrace\": true\r\n    },\r\n    \"requireSpacesInConditionalExpression\": true,\r\n    \"requireSpacesInForStatement\": true,\r\n    \"requireSpacesInFunctionDeclaration\": {\r\n        \"beforeOpeningCurlyBrace\": true\r\n    },\r\n    \"requireSpacesInFunctionExpression\": {\r\n        \"beforeOpeningCurlyBrace\": true\r\n    },\r\n    \"requireSpacesInNamedFunctionExpression\": {\r\n        \"beforeOpeningCurlyBrace\": true\r\n    },\r\n    \"validateIndentation\": 4,\r\n    \"validateLineBreaks\": \"LF\",\r\n    \"validateParameterSeparator\": \", \"\r\n}\r\n```\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/10724264-autofixing-indentation-causes-misalignment-of-nested-lines?utm_campaign=plugin&utm_content=tracker%2F281640&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F281640&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/comments/91039762","html_url":"https://github.com/jscs-dev/node-jscs/issues/1248#issuecomment-91039762","issue_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1248","id":91039762,"user":{"login":"TheSavior","id":249164,"avatar_url":"https://avatars.githubusercontent.com/u/249164?v=3","gravatar_id":"","url":"https://api.github.com/users/TheSavior","html_url":"https://github.com/TheSavior","followers_url":"https://api.github.com/users/TheSavior/followers","following_url":"https://api.github.com/users/TheSavior/following{/other_user}","gists_url":"https://api.github.com/users/TheSavior/gists{/gist_id}","starred_url":"https://api.github.com/users/TheSavior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheSavior/subscriptions","organizations_url":"https://api.github.com/users/TheSavior/orgs","repos_url":"https://api.github.com/users/TheSavior/repos","events_url":"https://api.github.com/users/TheSavior/events{/privacy}","received_events_url":"https://api.github.com/users/TheSavior/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T21:18:15Z","updated_at":"2015-04-08T21:18:15Z","body":"Duplicate of #1144 "}}