Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cherry pick changes for 0.39.1-222.1 #1223

Merged
merged 8 commits into from
May 10, 2019
3 changes: 2 additions & 1 deletion packages/@lwc/babel-plugin-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"dependencies": {
"@babel/helper-module-imports": "7.0.0",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@lwc/errors": "0.39.1"
"@lwc/errors": "0.39.1",
"line-column": "^1.0.2"
},
"devDependencies": {
"common-tags": "^1.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ describe('Transform property', () => {
error: {
message: '@api get something and @api set something',
loc: {
line: 2,
column: 9,
line: 7,
column: 0,
length: 46,
start: 95,
},
},
}
Expand Down Expand Up @@ -426,8 +428,10 @@ describe('Transform property', () => {
error: {
message: 'Boolean public property must default to false.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 23,
start: 55,
},
},
}
Expand All @@ -445,8 +449,10 @@ describe('Transform property', () => {
error: {
message: 'Invalid property name "is". "is" is a reserved attribute.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 8,
start: 55,
},
},
}
Expand All @@ -465,8 +471,10 @@ describe('Transform property', () => {
message:
'Invalid property name "onChangeHandler". Properties starting with "on" are reserved for event handlers.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 21,
start: 55,
},
},
}
Expand Down Expand Up @@ -522,8 +530,10 @@ describe('Transform property', () => {
message:
'Invalid property name "dataFooBar". Properties starting with "data" are reserved attributes.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 16,
start: 55,
},
},
}
Expand All @@ -542,8 +552,10 @@ describe('Transform property', () => {
message:
'Ambiguous attribute name "tabindex". "tabindex" will never be called from template because its corresponding property is camel cased. Consider renaming to "tabIndex".',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 14,
start: 55,
},
},
}
Expand All @@ -562,8 +574,10 @@ describe('Transform property', () => {
message:
'Ambiguous attribute name "maxlength". "maxlength" will never be called from template because its corresponding property is camel cased. Consider renaming to "maxLength".',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 15,
start: 55,
},
},
}
Expand Down Expand Up @@ -618,8 +632,10 @@ describe('Transform property', () => {
error: {
message: 'Invalid property name "slot". "slot" is a reserved attribute.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 10,
start: 55,
},
},
}
Expand All @@ -638,8 +654,10 @@ describe('Transform property', () => {
message:
'Invalid property name "part". "part" is a future reserved attribute for web components.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 10,
start: 55,
},
},
}
Expand All @@ -659,8 +677,10 @@ describe('Transform property', () => {
error: {
message: '@api method or property cannot be used with @track',
loc: {
line: 2,
column: 20,
line: 4,
column: 0,
length: 4,
start: 69,
},
},
}
Expand All @@ -679,8 +699,10 @@ describe('Transform property', () => {
error: {
message: 'Duplicate @api property "foo".',
loc: {
line: 2,
column: 9,
line: 4,
column: 0,
length: 4,
start: 69,
},
},
}
Expand All @@ -704,8 +726,10 @@ describe('Transform property', () => {
error: {
message: 'Duplicate @api property "foo".',
loc: {
line: 2,
column: 9,
line: 5,
column: 0,
length: 4,
start: 84,
},
},
}
Expand All @@ -724,8 +748,10 @@ describe('Transform property', () => {
error: {
message: 'Duplicate @api property "foo".',
loc: {
line: 2,
column: 9,
line: 4,
column: 0,
length: 4,
start: 69,
},
},
}
Expand Down Expand Up @@ -778,8 +804,10 @@ describe('Transform method', () => {
error: {
message: '@api cannot be applied to a computed property, getter, setter or method.',
loc: {
line: 2,
column: 9,
line: 3,
column: 0,
length: 22,
start: 109,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ describe('Element import', () => {
loc: {
line: 1,
column: 7,
length: 6,
start: 7,
},
},
}
Expand All @@ -35,6 +37,8 @@ describe('Element import', () => {
loc: {
line: 1,
column: 7,
length: 11,
start: 7,
},
},
}
Expand Down Expand Up @@ -76,7 +80,9 @@ describe('Element import', () => {
message: `Invalid import. "registerTemplate" is not part of the lwc api.`,
loc: {
line: 1,
column: 7,
column: 0,
length: 104,
start: 0,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ describe('decorators', () => {
message:
'Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"',
loc: {
line: 10,
line: 2,
column: 0,
length: 18,
start: 28,
},
},
}
Expand All @@ -39,8 +41,10 @@ describe('decorators', () => {
message:
'Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"',
loc: {
line: 10,
line: 2,
column: 0,
length: 14,
start: 28,
},
},
}
Expand All @@ -56,8 +60,10 @@ describe('decorators', () => {
error: {
message: '"track" can only be used as a class decorator',
loc: {
line: 10,
line: 2,
column: 0,
length: 11,
start: 29,
},
},
}
Expand All @@ -76,8 +82,10 @@ describe('decorators', () => {
error: {
message: '"track" can only be used as a class decorator',
loc: {
line: 10,
line: 2,
column: 0,
length: 20,
start: 29,
},
},
}
Expand All @@ -94,8 +102,10 @@ describe('decorators', () => {
error: {
message: '"@track" can only be applied on class properties',
loc: {
line: 10,
line: 2,
column: 0,
length: 19,
start: 29,
},
},
}
Expand All @@ -113,6 +123,12 @@ describe('decorators', () => {
error: {
message:
'Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"',
loc: {
line: 3,
column: 0,
length: 20,
start: 93,
},
},
}
);
Expand All @@ -129,6 +145,12 @@ describe('decorators', () => {
error: {
message:
'Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"',
loc: {
line: 3,
column: 0,
length: 22,
start: 93,
},
},
}
);
Expand All @@ -147,6 +169,12 @@ describe('decorators', () => {
error: {
message:
'Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"',
loc: {
line: 4,
column: 0,
length: 29,
start: 125,
},
},
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ describe('Transform property', () => {
error: {
message: '@track decorator can only be applied to class properties.',
loc: {
line: 2,
column: 11,
line: 3,
column: 0,
length: 6,
start: 57,
},
},
}
Expand All @@ -119,7 +121,9 @@ describe('Transform property', () => {
message: '@track decorator can only be applied to class properties.',
loc: {
line: 4,
column: 11,
column: 0,
length: 6,
start: 66,
},
},
}
Expand All @@ -142,7 +146,9 @@ describe('Transform property', () => {
message: '@track decorator can only be applied to class properties.',
loc: {
line: 4,
column: 11,
column: 0,
length: 6,
start: 66,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function pluginTest(plugin, pluginOpts, opts = {}) {
}

expect(transformError.toString()).toContain(expected.error.message);
expect(transformError.loc).toEqual(expected.error.loc);
} else if (expected.output) {
const output = testTransform(actual);
if (expected.output.code !== undefined) {
Expand Down
Loading