Commit 9a555221 authored by Mark Florian's avatar Mark Florian

Merge branch 'slashmanov/restrict-private-instance-next-tick' into 'master'

Add an eslint rule to restrict component instance $nextTick usage

See merge request gitlab-org/gitlab!79108
parents 6803d6a7 2c3fad40
...@@ -95,7 +95,8 @@ rules: ...@@ -95,7 +95,8 @@ rules:
order: ignore order: ignore
overrides: overrides:
- files: - files:
- '**/spec/**/*' - 'ee/spec/frontend*/**/*'
- 'spec/frontend*/**/*'
rules: rules:
'@gitlab/require-i18n-strings': off '@gitlab/require-i18n-strings': off
'@gitlab/no-runtime-template-compiler': off '@gitlab/no-runtime-template-compiler': off
...@@ -103,6 +104,8 @@ overrides: ...@@ -103,6 +104,8 @@ overrides:
- error - error
- selector: CallExpression[callee.object.name=/(wrapper|vm)/][callee.property.name="setData"] - selector: CallExpression[callee.object.name=/(wrapper|vm)/][callee.property.name="setData"]
message: 'Avoid using "setData" on VTU wrapper' message: 'Avoid using "setData" on VTU wrapper'
- selector: MemberExpression[object.type!='ThisExpression'][property.type='Identifier'][property.name='$nextTick']
message: 'Using $nextTick from a component instance is discouraged. Import nextTick directly from the Vue package.'
- files: - files:
- 'config/**/*' - 'config/**/*'
- 'scripts/**/*' - 'scripts/**/*'
......
...@@ -121,7 +121,7 @@ describe('IDE clientside preview', () => { ...@@ -121,7 +121,7 @@ describe('IDE clientside preview', () => {
it('pings usage success', async () => { it('pings usage success', async () => {
dispatchCodesandboxReady(); dispatchCodesandboxReady();
await wrapper.vm.$nextTick(); await nextTick();
expect(storeClientsideActions.pingUsage).toHaveBeenCalledTimes(2); expect(storeClientsideActions.pingUsage).toHaveBeenCalledTimes(2);
expect(storeClientsideActions.pingUsage).toHaveBeenCalledWith( expect(storeClientsideActions.pingUsage).toHaveBeenCalledWith(
expect.anything(), expect.anything(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment