diff --git a/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/ignored.src.js b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/ignored.src.js new file mode 100644 index 000000000000..663bc1e5ec2a --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/ignored.src.js @@ -0,0 +1,9 @@ +const b = ' '; +let c = ' '; +let d = '&'; +const e = { + f: 'id=1&group=2', + g(h = '�') {}, + i: (j = '�') => {}, +}; +e.i('&#x;'); diff --git a/packages/shared-fixtures/fixtures/jsx/escape-patterns-valid.js b/packages/shared-fixtures/fixtures/jsx/escape-patterns-valid.src.js similarity index 100% rename from packages/shared-fixtures/fixtures/jsx/escape-patterns-valid.js rename to packages/shared-fixtures/fixtures/jsx/escape-patterns-valid.src.js diff --git a/packages/shared-fixtures/fixtures/jsx/escape-patters-multi.src.js b/packages/shared-fixtures/fixtures/jsx/escape-patters-multi.src.js new file mode 100644 index 000000000000..15eb28c92ec1 --- /dev/null +++ b/packages/shared-fixtures/fixtures/jsx/escape-patters-multi.src.js @@ -0,0 +1 @@ +  test; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 61608bd35953..109716148c48 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -1285,6 +1285,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/ignored.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src 1`] = ` Object { "column": 4, @@ -1324,7 +1326,13 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-ignored.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-unknown.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-valid.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patters-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute.src 1`] = ` Object { @@ -1639,8 +1647,6 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/unknown-escape-pattern.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot new file mode 100644 index 000000000000..4d8236d2a3c6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot @@ -0,0 +1,1696 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript unicodeCodePointEscapes ignored.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "raw": "' '", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "c", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "' '", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "d", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "raw": "'&'", + "type": "Literal", + "value": "&", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "e", + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "f", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 59, + 76, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 62, + 76, + ], + "raw": "'id=1&group=2'", + "type": "Literal", + "value": "id=1&group=2", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "g", + "range": Array [ + 80, + 81, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "method": true, + "range": Array [ + 80, + 103, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 101, + 103, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "h", + "range": Array [ + 82, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 82, + 99, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 99, + ], + "raw": "'�'", + "type": "Literal", + "value": "�", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 81, + 103, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "i", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 107, + 135, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "j", + "range": Array [ + 111, + 112, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 111, + 128, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 115, + 128, + ], + "raw": "'�'", + "type": "Literal", + "value": "�", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 110, + 135, + ], + "type": "ArrowFunctionExpression", + }, + }, + ], + "range": Array [ + 55, + 138, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 51, + 138, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 139, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 144, + 150, + ], + "raw": "'&#x;'", + "type": "Literal", + "value": "&#x;", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "name": "e", + "range": Array [ + 140, + 141, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "i", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "range": Array [ + 140, + 143, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 140, + 151, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 152, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 153, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "String", + "value": "' '", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "String", + "value": "' '", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "String", + "value": "'&'", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 50, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 62, + 76, + ], + "type": "String", + "value": "'id=1&group=2'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 99, + ], + "type": "String", + "value": "'�'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 115, + 128, + ], + "type": "String", + "value": "'�'", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "range": Array [ + 130, + 132, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 7, + }, + "start": Object { + "column": 30, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 1, + "line": 8, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 144, + 150, + ], + "type": "String", + "value": "'&#x;'", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot similarity index 67% rename from packages/typescript-estree/tests/snapshots/jsx/escape-patterns.src.js.shot rename to packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot index 72c7e238c776..ec4eb166c18b 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`jsx escape-patterns.src 1`] = ` +exports[`jsx escape-patterns-ignored.src 1`] = ` Object { "body": Array [ Object { @@ -9,8 +9,8 @@ Object { "closingElement": null, "loc": Object { "end": Object { - "column": 83, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { "column": 0, @@ -22,70 +22,70 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 3, - "line": 1, + "column": 2, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 3, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "b", "range": Array [ - 3, - 4, + 5, + 6, ], "type": "JSXIdentifier", }, "range": Array [ - 3, - 10, + 5, + 12, ], "type": "JSXAttribute", "value": Object { "expression": Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 6, - 9, + 8, + 11, ], - "raw": "\\" \\"", + "raw": "' '", "type": "Literal", "value": " ", }, "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 10, + 7, + 12, ], "type": "JSXExpressionContainer", }, @@ -93,51 +93,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 3, }, }, "name": Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 3, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 3, }, }, "name": "c", "range": Array [ - 11, - 12, + 15, + 16, ], "type": "JSXIdentifier", }, "range": Array [ - 11, - 16, + 15, + 20, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 13, - 16, + 17, + 20, ], "raw": "\\" \\"", "type": "Literal", @@ -147,105 +147,122 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 4, }, }, "name": Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 4, }, }, "name": "d", "range": Array [ - 17, - 18, + 23, + 24, ], "type": "JSXIdentifier", }, "range": Array [ - 17, - 26, + 23, + 34, ], "type": "JSXAttribute", "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 26, + 33, + ], + "raw": "'&'", + "type": "Literal", + "value": "&", + }, "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 19, - 26, + 25, + 34, ], - "raw": "\\"&\\"", - "type": "Literal", - "value": "&", + "type": "JSXExpressionContainer", }, }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 27, - "line": 1, + "column": 2, + "line": 5, }, }, "name": Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 27, - "line": 1, + "column": 2, + "line": 5, }, }, "name": "e", "range": Array [ - 27, - 28, + 37, + 38, ], "type": "JSXIdentifier", }, "range": Array [ - 27, - 43, + 37, + 53, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 29, - 43, + 39, + 53, ], "raw": "\\"id=1&group=2\\"", "type": "Literal", @@ -255,51 +272,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 17, + "line": 6, }, "start": Object { - "column": 44, - "line": 1, + "column": 2, + "line": 6, }, }, "name": Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 3, + "line": 6, }, "start": Object { - "column": 44, - "line": 1, + "column": 2, + "line": 6, }, }, "name": "f", "range": Array [ - 44, - 45, + 56, + 57, ], "type": "JSXIdentifier", }, "range": Array [ - 44, - 59, + 56, + 71, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 17, + "line": 6, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 46, - 59, + 58, + 71, ], "raw": "\\"�\\"", "type": "Literal", @@ -309,51 +326,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 13, + "line": 7, }, "start": Object { - "column": 60, - "line": 1, + "column": 2, + "line": 7, }, }, "name": Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 60, - "line": 1, + "column": 2, + "line": 7, }, }, "name": "g", "range": Array [ - 60, - 61, + 74, + 75, ], "type": "JSXIdentifier", }, "range": Array [ - 60, - 71, + 74, + 85, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 13, + "line": 7, }, "start": Object { - "column": 62, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 62, - 71, + 76, + 85, ], "raw": "\\"{*;\\"", "type": "Literal", @@ -363,51 +380,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 72, - "line": 1, + "column": 2, + "line": 8, }, }, "name": Object { "loc": Object { "end": Object { - "column": 73, - "line": 1, + "column": 3, + "line": 8, }, "start": Object { - "column": 72, - "line": 1, + "column": 2, + "line": 8, }, }, "name": "h", "range": Array [ - 72, - 73, + 88, + 89, ], "type": "JSXIdentifier", }, "range": Array [ - 72, - 80, + 88, + 96, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 74, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 74, - 80, + 90, + 96, ], "raw": "\\"&#x;\\"", "type": "Literal", @@ -417,8 +434,8 @@ Object { ], "loc": Object { "end": Object { - "column": 83, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { "column": 0, @@ -445,7 +462,7 @@ Object { }, "range": Array [ 0, - 83, + 99, ], "selfClosing": true, "type": "JSXOpeningElement", @@ -453,14 +470,14 @@ Object { }, "range": Array [ 0, - 83, + 99, ], "type": "JSXElement", }, "loc": Object { "end": Object { - "column": 84, - "line": 1, + "column": 3, + "line": 9, }, "start": Object { "column": 0, @@ -469,7 +486,7 @@ Object { }, "range": Array [ 0, - 84, + 100, ], "type": "ExpressionStatement", }, @@ -477,8 +494,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 84, - "line": 1, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -487,7 +504,7 @@ Object { }, "range": Array [ 0, - 84, + 101, ], "sourceType": "script", "tokens": Array [ @@ -530,17 +547,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 3, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 3, - 4, + 5, + 6, ], "type": "JSXIdentifier", "value": "b", @@ -548,17 +565,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 3, + "line": 2, }, }, "range": Array [ - 4, - 5, + 6, + 7, ], "type": "Punctuator", "value": "=", @@ -566,17 +583,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 6, + 7, + 8, ], "type": "Punctuator", "value": "{", @@ -584,35 +601,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 6, - 9, + 8, + 11, ], "type": "String", - "value": "\\" \\"", + "value": "' '", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 9, - 10, + 11, + 12, ], "type": "Punctuator", "value": "}", @@ -620,17 +637,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 3, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 11, - 12, + 15, + 16, ], "type": "JSXIdentifier", "value": "c", @@ -638,17 +655,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 3, + "line": 3, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], "type": "Punctuator", "value": "=", @@ -656,17 +673,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 13, - 16, + 17, + 20, ], "type": "JSXText", "value": "\\" \\"", @@ -674,17 +691,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 17, - 18, + 23, + 24, ], "type": "JSXIdentifier", "value": "d", @@ -692,17 +709,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 4, }, "start": Object { - "column": 18, - "line": 1, + "column": 3, + "line": 4, }, }, "range": Array [ - 18, - 19, + 24, + 25, ], "type": "Punctuator", "value": "=", @@ -710,35 +727,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 19, + 25, 26, ], - "type": "JSXText", - "value": "\\"&\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { - "column": 27, - "line": 1, + "column": 5, + "line": 4, }, }, "range": Array [ - 27, - 28, + 26, + 33, + ], + "type": "String", + "value": "'&'", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, ], "type": "JSXIdentifier", "value": "e", @@ -746,17 +799,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 5, }, "start": Object { - "column": 28, - "line": 1, + "column": 3, + "line": 5, }, }, "range": Array [ - 28, - 29, + 38, + 39, ], "type": "Punctuator", "value": "=", @@ -764,17 +817,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 29, - 43, + 39, + 53, ], "type": "JSXText", "value": "\\"id=1&group=2\\"", @@ -782,17 +835,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 3, + "line": 6, }, "start": Object { - "column": 44, - "line": 1, + "column": 2, + "line": 6, }, }, "range": Array [ - 44, - 45, + 56, + 57, ], "type": "JSXIdentifier", "value": "f", @@ -800,17 +853,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 6, }, "start": Object { - "column": 45, - "line": 1, + "column": 3, + "line": 6, }, }, "range": Array [ - 45, - 46, + 57, + 58, ], "type": "Punctuator", "value": "=", @@ -818,17 +871,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 17, + "line": 6, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 46, - 59, + 58, + 71, ], "type": "JSXText", "value": "\\"�\\"", @@ -836,17 +889,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 60, - "line": 1, + "column": 2, + "line": 7, }, }, "range": Array [ - 60, - 61, + 74, + 75, ], "type": "JSXIdentifier", "value": "g", @@ -854,17 +907,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 62, - "line": 1, + "column": 4, + "line": 7, }, "start": Object { - "column": 61, - "line": 1, + "column": 3, + "line": 7, }, }, "range": Array [ - 61, - 62, + 75, + 76, ], "type": "Punctuator", "value": "=", @@ -872,17 +925,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 13, + "line": 7, }, "start": Object { - "column": 62, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 62, - 71, + 76, + 85, ], "type": "JSXText", "value": "\\"{*;\\"", @@ -890,17 +943,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 73, - "line": 1, + "column": 3, + "line": 8, }, "start": Object { - "column": 72, - "line": 1, + "column": 2, + "line": 8, }, }, "range": Array [ - 72, - 73, + 88, + 89, ], "type": "JSXIdentifier", "value": "h", @@ -908,17 +961,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 74, - "line": 1, + "column": 4, + "line": 8, }, "start": Object { - "column": 73, - "line": 1, + "column": 3, + "line": 8, }, }, "range": Array [ - 73, - 74, + 89, + 90, ], "type": "Punctuator", "value": "=", @@ -926,17 +979,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 74, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 74, - 80, + 90, + 96, ], "type": "JSXText", "value": "\\"&#x;\\"", @@ -944,17 +997,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 82, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 81, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 81, - 82, + 97, + 98, ], "type": "Punctuator", "value": "/", @@ -962,17 +1015,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 83, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { - "column": 82, - "line": 1, + "column": 1, + "line": 9, }, }, "range": Array [ - 82, - 83, + 98, + 99, ], "type": "Punctuator", "value": ">", @@ -980,17 +1033,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 84, - "line": 1, + "column": 3, + "line": 9, }, "start": Object { - "column": 83, - "line": 1, + "column": 2, + "line": 9, }, }, "range": Array [ - 83, - 84, + 99, + 100, ], "type": "Punctuator", "value": ";", diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot new file mode 100644 index 000000000000..25cd76ed83d8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot @@ -0,0 +1,1716 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patterns-unknown.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 20, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "raw": "\\"¬anentity;\\"", + "type": "Literal", + "value": "¬anentity;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 23, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 23, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 28, + 36, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "raw": "\\"&##;\\"", + "type": "Literal", + "value": "&##;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 26, + 27, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 25, + 39, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 25, + 39, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 40, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 44, + 57, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 57, + ], + "raw": "\\"&x01FZZZ;\\"", + "type": "Literal", + "value": "&x01FZZZ;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 42, + 43, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 41, + 60, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 41, + 60, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 41, + 61, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 65, + 70, + ], + "raw": "&abc;", + "type": "Literal", + "value": "&abc;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 70, + 74, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 62, + 65, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 62, + 74, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 75, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 79, + 92, + ], + "raw": "¬anentity;", + "type": "Literal", + "value": "¬anentity;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 94, + 95, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 92, + 96, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 77, + 78, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 76, + 79, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 76, + 96, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 76, + 97, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 101, + 105, + ], + "raw": "&#x;", + "type": "Literal", + "value": "&#x;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "e", + "range": Array [ + 107, + 108, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 105, + 109, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "e", + "range": Array [ + 99, + 100, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 98, + 101, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 98, + 109, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 98, + 110, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "JSXText", + "value": "\\"¬anentity;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "JSXText", + "value": "\\"&##;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 57, + ], + "type": "JSXText", + "value": "\\"&x01FZZZ;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "JSXText", + "value": "&abc;", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 79, + 92, + ], + "type": "JSXText", + "value": "¬anentity;", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 101, + 105, + ], + "type": "JSXText", + "value": "&#x;", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot new file mode 100644 index 000000000000..991dba996a8f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot @@ -0,0 +1,540 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patterns-valid.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 34, + ], + "raw": " +   +", + "type": "Literal", + "value": " +   +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 36, + 37, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 34, + 38, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 12, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "raw": "\\"&\\"", + "type": "Literal", + "value": "&", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 13, + 23, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "raw": "\\"{\\"", + "type": "Literal", + "value": "{", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 24, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 38, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "JSXText", + "value": "\\"&\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "JSXText", + "value": "\\"{\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 34, + ], + "type": "JSXText", + "value": " +   +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/unknown-escape-pattern.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot similarity index 57% rename from packages/typescript-estree/tests/snapshots/jsx/unknown-escape-pattern.src.js.shot rename to packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot index c6e3bbe2d365..d4710d1d5869 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/unknown-escape-pattern.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot @@ -1,15 +1,69 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`jsx unknown-escape-pattern.src 1`] = ` +exports[`jsx escape-patters-multi.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "children": Array [], - "closingElement": null, + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 44, + ], + "raw": "  test", + "type": "Literal", + "value": "  test", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 46, + 47, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 44, + 48, + ], + "type": "JSXClosingElement", + }, "loc": Object { "end": Object { - "column": 23, + "column": 48, "line": 1, }, "start": Object { @@ -22,7 +76,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 32, "line": 1, }, "start": Object { @@ -33,7 +87,7 @@ Object { "name": Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -41,42 +95,42 @@ Object { "line": 1, }, }, - "name": "b", + "name": "href", "range": Array [ 3, - 4, + 7, ], "type": "JSXIdentifier", }, "range": Array [ 3, - 20, + 32, ], "type": "JSXAttribute", "value": Object { "loc": Object { "end": Object { - "column": 20, + "column": 32, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 20, + 8, + 32, ], - "raw": "\\"¬anentity;\\"", + "raw": "\\"test=1&bar=1{\\"", "type": "Literal", - "value": "¬anentity;", + "value": "test=1&bar=1{", }, }, ], "loc": Object { "end": Object { - "column": 23, + "column": 33, "line": 1, }, "start": Object { @@ -104,21 +158,21 @@ Object { }, "range": Array [ 0, - 23, + 33, ], - "selfClosing": true, + "selfClosing": false, "type": "JSXOpeningElement", "typeParameters": undefined, }, "range": Array [ 0, - 23, + 48, ], "type": "JSXElement", }, "loc": Object { "end": Object { - "column": 24, + "column": 49, "line": 1, }, "start": Object { @@ -128,7 +182,7 @@ Object { }, "range": Array [ 0, - 24, + 49, ], "type": "ExpressionStatement", }, @@ -136,8 +190,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -146,7 +200,7 @@ Object { }, "range": Array [ 0, - 24, + 50, ], "sourceType": "script", "tokens": Array [ @@ -189,7 +243,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -199,25 +253,25 @@ Object { }, "range": Array [ 3, - 4, + 7, ], "type": "JSXIdentifier", - "value": "b", + "value": "href", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, - 5, + 7, + 8, ], "type": "Punctuator", "value": "=", @@ -225,35 +279,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 32, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 32, + ], + "type": "JSXText", + "value": "\\"test=1&bar=1{\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, "line": 1, }, "start": Object { - "column": 5, + "column": 33, "line": 1, }, }, "range": Array [ - 5, - 20, + 33, + 44, ], "type": "JSXText", - "value": "\\"¬anentity;\\"", + "value": "  test", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 45, "line": 1, }, "start": Object { - "column": 21, + "column": 44, "line": 1, }, }, "range": Array [ - 21, - 22, + 44, + 45, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, ], "type": "Punctuator", "value": "/", @@ -261,17 +369,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, "line": 1, }, "start": Object { - "column": 22, + "column": 47, "line": 1, }, }, "range": Array [ - 22, - 23, + 47, + 48, ], "type": "Punctuator", "value": ">", @@ -279,17 +405,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 49, "line": 1, }, "start": Object { - "column": 23, + "column": 48, "line": 1, }, }, "range": Array [ - 23, - 24, + 48, + 49, ], "type": "Punctuator", "value": ";",