- aaa
- bbb
- ccc
-
- `,
-
- // ArrayExpression
- unIndent`
-
-
-
- `,
-
- // ArrowFunctionExpression
- unIndent`
-
-
-
- `,
-
- // AssignmentExpression / BinaryExpression
- unIndent`
-
-
-
- `,
-
- // AwaitExpression
- unIndent`
-
-
-
- `,
-
- // BreakStatement, LabeledStatement
- unIndent`
-
-
-
- `,
-
- // CallExpression
- unIndent`
-
-
-
- `,
-
- // ClassExpression / ClassDeclaration
- unIndent`
-
-
-
- `,
-
- // ConditionalExpression
- unIndent`
-
-
-
- `,
-
- // DoWhileStatement
- unIndent`
-
-
-
- `,
-
- // ForInStatement, ForOfStatement
- unIndent`
-
-
-
- `,
-
- // ForStatement
- unIndent`
-
-
-
- `,
-
- // FunctionDeclaration, FunctionExpression
- unIndent`
-
-
-
- `,
-
- // IfStatement
- unIndent`
-
-
-
- `,
-
- // MemberExpression, MetaProperty
- unIndent`
-
-
-
- `,
-
- // MethodDefinition, Property
- unIndent`
-
-
-
- `,
-
- // NewExpression
+tester.run('html-indent', rule, loadPatterns(
+ // Valid
+ [
+ // TemplateLiteral
unIndent`
-
- `,
-
- // ObjectExpression
- unIndent`
-
-
-
- `,
-
- // RestElement / SpreadElement
- unIndent`
-
-
-
- `,
-
- // SequenceExpression
- unIndent`
-
-
-
- `,
- unIndent`
-
- {{
- a,
- b,
- c
- }}
-
- `,
-
- // SwitchStatement, SwitchCase
- unIndent`
-
-
-
- `,
-
- // TaggedTemplateExpression
- unIndent`
-
-
-
- `,
-
- // TemplateLiteral
- unIndent`
-
-
-
- `,
-
- // ReturnStatement
- unIndent`
-
-
-
- `,
-
- // TryStatement / CatchClause
- unIndent`
-
-
-
- `,
-
- // UnaryExpression
- unIndent`
-
-
-
- `,
-
- // UpdateExpression
- unIndent`
-
-
-
- `,
-
- // VariableDeclaration, VariableDeclarator
- unIndent`
-
-
-
- `,
-
- // YieldExpression
- unIndent`
-
-
-
- `,
-
- // 2 spaces
- {
- code: unIndent`
-
-
-
- `,
- options: [2]
- },
-
- // Tabs
- {
- code: unIndent`
-
- \t {
- \t\t\t\t\tfoo(a)
- \t\t\t\t}
- \t\t"
- \t>
-
- `,
- options: ['tab']
- },
-
- // options.attribute
- {
- code: unIndent`
-
-
-
- `,
- options: [4, { attribute: 0 }]
- },
- {
- code: unIndent`
-
-
-
- `,
- options: [4, { attribute: 2 }]
- },
-
- // options.closeBracket
- {
- code: unIndent`
-
-
-
- `,
- options: [4, { closeBracket: 1 }]
- },
- {
- code: unIndent`
-
-
-
- `,
- options: [4, { closeBracket: 2 }]
- },
-
- // options.switchCase
- {
- code: unIndent`
-
-
-
- `,
- options: [4, { switchCase: 1 }]
- },
-
- // options.alignAttributesVertically
- {
- code: unIndent`
-
-
-
- `,
- options: [2, {
- alignAttributesVertically: false
- }]
- },
- {
- code: unIndent`
-
-
-
- `,
- options: [2, {
- alignAttributesVertically: false
- }]
- },
-
- // Comments
- unIndent`
-
-
- {{
- // comment
- // comment
- message
- }}
-
- `,
- unIndent`
-
- {{
- /*
- * comment
- */
- message
- }}
-
- `,
- unIndent`
-
- {{
- message
- // comment
- // comment
- }}
-
-
- `,
- unIndent`
-
- {{
- message
- /*
- * comment
- */
- }}
-
- `,
- unIndent`
-
- {{
- message
- // comment
- // comment
- }}
-
-
- `,
- unIndent`
-
- {{
- message
- /*
- * comment
- */
- }}
-
- `,
-
- // Ignores
- {
- code: unIndent`
-
-
- Hello
-
-
- `,
- options: [4, {
- // Ignore all :D
- ignores: ['*']
- }]
- },
-
- // https://github.com/vuejs/eslint-plugin-vue/issues/264
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
- `,
- unIndent`
-
-
-
-
- `
- ],
-
- invalid: [
- // VAttribute
- {
- code: unIndent`
-
-
- Text
-
-
- `,
- output: unIndent`
-
-
- Text
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 3 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 4 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 9 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 }
- ]
- },
- {
- code: unIndent`
-
-
- Text
-
-
- `,
- output: unIndent`
-
-
- Text
-
-
- `,
- options: [2],
- errors: [
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 2 },
- { message: 'Expected indentation of 7 spaces but found 8 spaces.', line: 3 },
- { message: 'Expected indentation of 7 spaces but found 8 spaces.', line: 4 },
- { message: 'Expected indentation of 9 spaces but found 12 spaces.', line: 5 },
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 6 },
- { message: 'Expected indentation of 4 spaces but found 8 spaces.', line: 7 },
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 8 }
- ]
- },
- {
- code: unIndent`
-
-
- Text
-
-
- `,
- output: unIndent`
-
-
- Text
-
-
- `,
- options: [2, {
- alignAttributesVertically: false
- }],
- errors: [
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 2 },
- { message: 'Expected indentation of 4 spaces but found 8 spaces.', line: 3 },
- { message: 'Expected indentation of 4 spaces but found 8 spaces.', line: 4 },
- { message: 'Expected indentation of 6 spaces but found 12 spaces.', line: 5 },
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 6 },
- { message: 'Expected indentation of 4 spaces but found 8 spaces.', line: 7 },
- { message: 'Expected indentation of 2 spaces but found 4 spaces.', line: 8 }
- ]
- },
-
- // VEndTag
- {
- code: unIndent`
-
-
-
-
- {{
- value
- }}
-
-
- `,
- output: unIndent`
-
-
- {{
- value
- }}
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 13 }
- ]
- },
-
- // VForExpression
- {
- code: unIndent`
-
-
-
-
- `,
- output: unIndent`
-
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 19 }
- ]
- },
-
- // VOnExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 }
- ]
- },
-
- // VText
- {
- code: unIndent`
-
- aaa
- bbb
- ccc
-
- `,
- output: unIndent`
-
- aaa
- bbb
- ccc
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 2 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 3 }
- ]
- },
- // Mix of texts and mustaches
- {
- code: unIndent`
-
- aaa
- {{bbb}}
- ccc {{
- ddd
- }}
-
- `,
- output: unIndent`
-
- aaa
- {{bbb}}
- ccc {{
- ddd
- }}
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 2 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 3 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 4 },
- { message: 'Expected indentation of 8 spaces but found 2 spaces.', line: 5 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 6 }
- ]
- },
-
- // ArrayExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 3 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 6 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 11 },
- { message: 'Expected indentation of 14 spaces but found 6 spaces.', line: 12 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 13 }
- ]
- },
-
- // ArrowFunctionExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 30 }
- ]
- },
-
- // AssignmentExpression / BinaryExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 22 }
- ]
- },
-
- // AwaitExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 16 spaces but found 14 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 14 spaces.', line: 6 }
- ]
- },
-
- // BreakExpression / LabeledStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 }
- ]
- },
-
- // CallExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 14 spaces but found 10 spaces.', line: 25 }
- ]
- },
-
- // ClassExpression / ClassDeclaration
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 32 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 33 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 34 }
- ]
- },
-
- // ConditionalExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 30 }
- ]
- },
-
- // DoWhileStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 26 }
- ]
- },
-
- // ForInStatement, ForOfStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 24 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 24 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 31 }
- ]
- },
-
- // ForStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 32 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 33 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 34 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 35 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 36 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 37 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 38 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 41 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 42 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 43 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 44 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 45 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 46 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 47 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 48 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 49 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 50 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 53 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 54 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 55 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 56 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 57 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 58 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 59 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 60 }
- ]
- },
-
- // FunctionDeclaration, FunctionExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 32 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 33 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 34 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 35 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 36 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 37 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 40 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 41 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 42 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 43 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 44 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 45 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 46 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 47 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 48 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 49 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 52 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 53 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 54 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 55 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 56 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 57 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 58 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 59 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 60 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 61 }
- ]
- },
-
- // IfStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 31 }
- ]
- },
-
- // MemberExpression, MetaProperty
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 31 }
- ]
- },
-
- // MethodDefinition, Property
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 32 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 33 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 34 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 35 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 36 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 37 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 38 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 41 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 42 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 43 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 44 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 45 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 46 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 47 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 48 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 49 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 50 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 51 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 52 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 53 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 54 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 55 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 56 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 57 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 58 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 59 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 60 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 61 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 62 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 63 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 64 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 65 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 66 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 67 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 68 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 69 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 70 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 71 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 72 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 73 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 74 }
- ]
- },
-
- // NewExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 24 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 24 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 33 }
- ]
- },
-
- // ObjectExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 3 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 8 },
- { message: 'Expected indentation of 16 spaces but found 6 spaces.', line: 9 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 6 spaces.', line: 11 },
- { message: 'Expected indentation of 17 spaces but found 6 spaces.', line: 12 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 13 }
- ]
- },
-
- // SequenceExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 18 }
- ]
- },
- {
- code: unIndent`
-
- {{
- a,
- b,
- c
- }}
-
- `,
- output: unIndent`
-
- {{
- a,
- b,
- c
- }}
-
- `,
- errors: [
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 3 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 4 },
- { message: 'Expected indentation of 4 spaces but found 2 spaces.', line: 5 }
- ]
- },
-
- // SwitchStatement, SwitchCase
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 23 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 24 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 32 }
- ]
- },
+ test
+ \`
+ "
+ >
+
+ `,
+
+ // VAttribute
+ unIndent`
+
+
+
+ `,
+
+ // Comments
+ unIndent`
+
+
+ {{
+ // comment
+ // comment
+ message
+ }}
+
+ `,
+ unIndent`
+
+ {{
+ /*
+ * comment
+ */
+ message
+ }}
+
+ `,
+ unIndent`
+
+ {{
+ message
+ // comment
+ // comment
+ }}
+
+
+ `,
+ unIndent`
+
+ {{
+ message
+ /*
+ * comment
+ */
+ }}
+
+ `,
+ unIndent`
+
+ {{
+ message
+ // comment
+ // comment
+ }}
+
+
+ `,
+ unIndent`
+
+ {{
+ message
+ /*
+ * comment
+ */
+ }}
+
+ `,
- // TaggedTemplateExpression
+ // Ignores
{
code: unIndent`
-
-
- `,
- output: unIndent`
-
-
+
+ Hello
+
`,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 }
- ]
- },
+ options: [4, {
+ // Ignore all :D
+ ignores: ['*']
+ }]
+ }
+ ],
+ // Invalid
+ [
// TemplateLiteral
{
code: unIndent`
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 16 spaces but found 14 spaces.', line: 6 },
- { message: 'Expected indentation of 20 spaces but found 14 spaces.', line: 7 },
- { message: 'Expected indentation of 16 spaces but found 14 spaces.', line: 10 },
- { message: 'Expected indentation of 20 spaces but found 14 spaces.', line: 11 }
- ]
- },
-
- // ReturnStatement
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 9 }
- ]
- },
-
- // TryStatement / CatchClause
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 5 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 7 },
- { message: 'Expected indentation of 16 spaces but found 8 spaces.', line: 8 },
- { message: 'Expected indentation of 20 spaces but found 8 spaces.', line: 9 },
- { message: 'Expected indentation of 16 spaces but found 8 spaces.', line: 10 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 11 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 12 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 15 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 17 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 18 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 19 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 20 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 23 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 24 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 25 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 26 },
- { message: 'Expected indentation of 16 spaces but found 8 spaces.', line: 27 },
- { message: 'Expected indentation of 20 spaces but found 8 spaces.', line: 28 },
- { message: 'Expected indentation of 16 spaces but found 8 spaces.', line: 29 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 30 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 31 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 32 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 33 },
- { message: 'Expected indentation of 12 spaces but found 8 spaces.', line: 34 }
- ]
- },
-
- // UnaryExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- errors: [
- { message: 'Expected indentation of 6 spaces but found 8 spaces.', line: 4 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 5 }
- ]
- },
-
- // UpdateExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- errors: [
- { message: 'Expected indentation of 6 spaces but found 8 spaces.', line: 4 },
- { message: 'Expected indentation of 8 spaces but found 6 spaces.', line: 5 }
- ]
- },
-
- // VariableDeclaration, VariableDeclarator
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- options: [4],
- errors: [
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 6 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 7 },
- { message: 'Expected indentation of 18 spaces but found 10 spaces.', line: 8 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 12 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 13 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 14 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 15 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 17 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 18 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 19 },
- { message: 'Expected indentation of 18 spaces but found 10 spaces.', line: 20 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 21 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 22 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 25 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 26 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 27 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 28 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 29 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 30 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 31 },
- { message: 'Expected indentation of 20 spaces but found 10 spaces.', line: 32 },
- { message: 'Expected indentation of 16 spaces but found 10 spaces.', line: 33 },
- { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 34 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 35 },
- { message: 'Expected indentation of 18 spaces but found 10 spaces.', line: 36 },
- { message: 'Expected indentation of 18 spaces but found 10 spaces.', line: 37 },
- { message: 'Expected indentation of 22 spaces but found 10 spaces.', line: 38 },
- { message: 'Expected indentation of 18 spaces but found 10 spaces.', line: 39 }
- ]
- },
-
- // YieldExpression
- {
- code: unIndent`
-
-
-
- `,
- output: unIndent`
-
-
-
- `,
- errors: [
- { message: 'Expected indentation of 8 spaces but found 10 spaces.', line: 5 },
- { message: 'Expected indentation of 8 spaces but found 10 spaces.', line: 10 },
- { message: 'Expected indentation of 8 spaces but found 10 spaces.', line: 11 },
- { message: 'Expected indentation of 8 spaces but found 10 spaces.', line: 16 },
- { message: 'Expected indentation of 10 spaces but found 14 spaces.', line: 17 }
- ]
- },
-
- // Tabs
- {
- code: unIndent`
-
- \t {
- \t\tfoo(a)
- \t\t}
- \t\t"
- \t>
-
- `,
- output: unIndent`
-
- \t {
- \t\t\t\t\tfoo(a)
- \t\t\t\t}
- \t\t"
- \t>
-
- `,
- options: ['tab'],
- errors: [
- { message: 'Expected indentation of 3 tabs but found 2 tabs.', line: 4 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 5 },
- { message: 'Expected indentation of 3 tabs but found 2 tabs.', line: 6 },
- { message: 'Expected indentation of 3 tabs but found 2 tabs.', line: 7 },
- { message: 'Expected indentation of 5 tabs but found 2 tabs.', line: 8 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 9 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 10 },
- { message: 'Expected indentation of 5 tabs but found 2 tabs.', line: 11 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 12 },
- { message: 'Expected indentation of 3 tabs but found 2 tabs.', line: 13 },
- { message: 'Expected indentation of 5 tabs but found 2 tabs.', line: 14 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 15 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 16 },
- { message: 'Expected indentation of 5 tabs but found 2 tabs.', line: 17 },
- { message: 'Expected indentation of 4 tabs but found 2 tabs.', line: 18 }
+ { message: 'Expected indentation of 12 spaces but found 10 spaces.', line: 4 }
]
},
@@ -4647,4 +460,4 @@ tester.run('html-indent', rule, {
]
}
]
-})
+))
diff --git a/tests/lib/rules/script-indent.js b/tests/lib/rules/script-indent.js
new file mode 100644
index 000000000..03bd827c7
--- /dev/null
+++ b/tests/lib/rules/script-indent.js
@@ -0,0 +1,232 @@
+/**
+ * @author Toru Nagashima
+ * @copyright 2016 Toru Nagashima. All rights reserved.
+ * See LICENSE file in root directory for full license.
+ */
+'use strict'
+
+// ------------------------------------------------------------------------------
+// Requirements
+// ------------------------------------------------------------------------------
+
+const fs = require('fs')
+const path = require('path')
+const RuleTester = require('eslint').RuleTester
+const rule = require('../../../lib/rules/script-indent')
+
+// ------------------------------------------------------------------------------
+// Helpers
+// ------------------------------------------------------------------------------
+
+const FIXTURE_ROOT = path.resolve(__dirname, '../../fixtures/script-indent/')
+
+/**
+ * Load test patterns from fixtures.
+ *
+ * - Valid tests: All codes in FIXTURE_ROOT are valid code.
+ * - Invalid tests: There is an invalid test for every valid test. It removes
+ * all indentations from the valid test and checks whether
+ * `html-indent` rule restores the removed indentations exactly.
+ *
+ * If a test has some ignored line, we can't use the mechanism.
+ * So `additionalValid` and `additionalInvalid` exist for asymmetry test cases.
+ *
+ * @param {object[]} additionalValid The array of additional valid patterns.
+ * @param {object[]} additionalInvalid The array of additional invalid patterns.
+ * @returns {object} The loaded patterns.
+ */
+function loadPatterns (additionalValid, additionalInvalid) {
+ const valid = fs
+ .readdirSync(FIXTURE_ROOT)
+ .map(filename => {
+ const commentPattern = /^(|\*\/)/
+ const code0 = fs.readFileSync(path.join(FIXTURE_ROOT, filename), 'utf8')
+ const code = code0.replace(commentPattern, `$1${filename}$3`)
+ const baseObj = JSON.parse(commentPattern.exec(code0)[2])
+ return Object.assign(baseObj, { code, filename })
+ })
+ const invalid = valid
+ .map(pattern => {
+ const kind = ((pattern.options && pattern.options[0]) === 'tab') ? 'tab' : 'space'
+ const output = pattern.code
+ const lines = output
+ .split('\n')
+ .map((text, number) => ({
+ number,
+ text,
+ indentSize: (/^[ \t]+/.exec(text) || [''])[0].length
+ }))
+ const code = lines
+ .map(line => line.text.replace(/^[ \t]+/, ''))
+ .join('\n')
+ const errors = lines
+ .map(line =>
+ line.indentSize === 0
+ ? null
+ : { message: `Expected indentation of ${line.indentSize} ${kind}${line.indentSize === 1 ? '' : 's'} but found 0 ${kind}s.`, line: line.number + 1 }
+ )
+ .filter(Boolean)
+
+ return Object.assign({}, pattern, { code, output, errors })
+ })
+ .filter(Boolean)
+
+ return {
+ valid: valid.concat(additionalValid),
+ invalid: invalid.concat(additionalInvalid)
+ }
+}
+
+/**
+ * Prevents leading spaces in a multiline template literal from appearing in the resulting string
+ * @param {string[]} strings The strings in the template literal
+ * @returns {string} The template literal, with spaces removed from all lines
+ */
+function unIndent (strings) {
+ const templateValue = strings[0]
+ const lines = templateValue.replace(/^\n/, '').replace(/\n\s*$/, '').split('\n')
+ const lineIndents = lines.filter(line => line.trim()).map(line => line.match(/ */)[0].length)
+ const minLineIndent = Math.min.apply(null, lineIndents)
+
+ return lines.map(line => line.slice(minLineIndent)).join('\n')
+}
+
+// ------------------------------------------------------------------------------
+// Tests
+// ------------------------------------------------------------------------------
+
+const tester = new RuleTester({
+ parser: 'vue-eslint-parser',
+ parserOptions: {
+ ecmaVersion: 2017,
+ sourceType: 'module'
+ }
+})
+
+tester.run('script-indent', rule, loadPatterns(
+ // Valid
+ [
+ // TemplateLiteral
+ unIndent`
+
+ `,
+
+ // Comments
+ unIndent`
+
+ `,
+ unIndent`
+
+ `,
+ unIndent`
+
+ `,
+
+ // Ignores
+ {
+ code: unIndent`
+
+ `,
+ options: [4, {
+ // Ignore all :D
+ ignores: ['*']
+ }]
+ }
+ ],
+
+ // Invalid
+ [
+ // TemplateLiteral
+ {
+ code: unIndent`
+
+ `,
+ output: unIndent`
+
+ `,
+ options: [4],
+ errors: [
+ { message: 'Expected indentation of 0 spaces but found 2 spaces.', line: 2 }
+ ]
+ },
+
+ // A mix of spaces and tabs.
+ {
+ code: unIndent`
+
+ `,
+ output: unIndent`
+
+ `,
+ errors: [
+ { message: 'Expected " " character, but found "\\t" character.', line: 3 }
+ ]
+ },
+ {
+ code: unIndent`
+
+ `,
+ output: unIndent`
+
+ `,
+ options: ['tab'],
+ errors: [
+ { message: 'Expected "\\t" character, but found " " character.', line: 3 },
+ { message: 'Expected "\\t" character, but found " " character.', line: 4 }
+ ]
+ }
+ ]
+))