Skip to content

Commit

Permalink
chore: cleaning unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Sep 27, 2023
1 parent 74cc1e5 commit 0cc6266
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { LunaticComponentDefinition, LunaticState } from '../../type';
import missing from '../../../components/commons/components/missing';
import { isNumber } from '../../../utils/number';

export type FilledProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/use-lunatic/reducer/reduce-on-init.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function reduceOnInit(state: LunaticState, action: ActionInit) {

const variables = LunaticVariablesStore.makeFromSource(source, data);
const pages = checkLoops(createMapPages(source));
const { maxPage, cleaning = {}, missingBlock = {}, resizing = {} } = source;
const { maxPage, cleaning = {}, missingBlock = {} } = source;
const initialPager = getPagerFromPageTag(initialPage);

const pager = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export function resolveSimpleControl(
const { criticality, errorMessage, id, typeOfControl } = control;
const value = control?.control?.value ?? 'true';

const result = executeExpression(value, { iteration });
const result = executeExpression(value, {
iteration: linksIterations ?? iteration,
});

try {
/**
Expand Down
2 changes: 0 additions & 2 deletions src/use-lunatic/type-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { LunaticComponentDefinition } from './type';

/**
* Types used for source data (lunatic models and data.json)
*/
Expand Down
1 change: 0 additions & 1 deletion src/utils/get-component-value.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ReactNode } from 'react';
import { hasResponse, hasResponses } from '../use-lunatic/commons/component';

/**
Expand Down
6 changes: 6 additions & 0 deletions src/utils/vtl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export function interpretVTL<T>(
return result as T;
}

/**
* Extract variables used in a VTL expression
*/
export function parseVTLVariables(expression: string): string[] {
try {
const chars = new antlr4.InputStream(expression);
Expand All @@ -41,6 +44,9 @@ export function parseVTLVariables(expression: string): string[] {
}
}

/**
* Transform a value to make it compatible with VTL (for bindings)
*/
export function getVTLCompatibleValue(value: unknown) {
if (value === undefined) {
return null;
Expand Down
3 changes: 0 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
build: {
ssr: false,
},
test: {
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down

0 comments on commit 0cc6266

Please sign in to comment.