mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
JS: Add support for createNamespacedHelpers
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import { mapGetters, mapState, mapMutations, mapActions } from 'vuex';
|
||||
import { mapGetters, mapState, mapMutations, mapActions, createNamespacedHelpers } from 'vuex';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -18,6 +18,9 @@ const submoduleB = {
|
||||
}
|
||||
};
|
||||
|
||||
const { mapGetters: mapGettersA } = createNamespacedHelpers('submoduleA');
|
||||
const { mapGetters: mapGettersB } = createNamespacedHelpers('submoduleB');
|
||||
|
||||
const store = new Vuex.Store({
|
||||
getters: {
|
||||
getterWithSink: state => { sink(state.tainted); }, // NOT OK
|
||||
@@ -72,8 +75,10 @@ const Component = new Vue({
|
||||
derivedUntainted: state => state.untainted,
|
||||
}),
|
||||
...mapState(['tainted2']),
|
||||
...mapGetters('submoduleA', {fooA: 'foo'}),
|
||||
...mapGetters('submoduleB', {fooB: 'foo'}),
|
||||
...mapGetters('submoduleA', {fooA1: 'foo'}),
|
||||
...mapGettersA({fooA2: 'foo'}),
|
||||
...mapGetters('submoduleB', {fooB1: 'foo'}),
|
||||
...mapGettersB({fooB2: 'foo'}),
|
||||
},
|
||||
methods: {
|
||||
doCommitsAndActions() {
|
||||
@@ -95,8 +100,10 @@ const Component = new Vue({
|
||||
sink(this.untaintedGetter); // OK
|
||||
sink(this.derivedUntainted); // OK
|
||||
|
||||
sink(this.fooA); // NOT OK
|
||||
sink(this.fooB); // OK
|
||||
sink(this.fooA1); // NOT OK
|
||||
sink(this.fooA2); // NOT OK
|
||||
sink(this.fooB1); // OK
|
||||
sink(this.fooB2); // OK
|
||||
},
|
||||
...mapMutations({ sneakyTaint3: 'setTainted3' }),
|
||||
...mapActions({ emitTaint4: 'doTaint4' }),
|
||||
|
||||
Reference in New Issue
Block a user