Skip to content

Commit

Permalink
fixed eslist issues | updated packages to fix errors with yarn build
Browse files Browse the repository at this point in the history
  • Loading branch information
YasharthSingh committed Sep 22, 2023
1 parent e86d467 commit f6b772c
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 64 deletions.
94 changes: 47 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,59 +19,59 @@
"author": "Opentext",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/helper-compilation-targets": "^7.20.7",
"@babel/preset-typescript": "^7.13.0",
"@grafana/e2e": "9.5.3",
"@grafana/e2e-selectors": "9.5.3",
"@grafana/eslint-config": "^6.0.0",
"@grafana/experimental": "^1.1.0",
"@grafana/tsconfig": "^1.2.0-rc1",
"@swc/core": "^1.3.62",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.26",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.4",
"@types/enzyme": "3.10.5",
"@babel/core": "^7.22.20",
"@babel/helper-compilation-targets": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@grafana/e2e": "10.1.2",
"@grafana/e2e-selectors": "10.1.2",
"@grafana/eslint-config": "^6.0.1",
"@grafana/experimental": "^1.7.2",
"@grafana/tsconfig": "^1.3.0-rc1",
"@swc/core": "^1.3.87",
"@swc/helpers": "^0.5.2",
"@swc/jest": "^0.2.29",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@types/enzyme": "3.10.13",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^29.5.0",
"@types/lodash": "^4.14.194",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.198",
"@types/node": "^20.6.3",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-adapter-react-16": "^1.15.7",
"enzyme-to-json": "^3.3.4",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsdoc": "^35.0.0",
"eslint-plugin-lodash": "^7.2.0",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-webpack-plugin": "^4.0.1",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"glob": "^10.2.7",
"glob": "^10.3.5",
"identity-obj-proxy": "3.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-expo": "~27.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-expo": "~49.0.0",
"jest-serializer-enzyme": "^1.0.0",
"prettier": "^2.8.7",
"prettier": "^3.0.3",
"react-autosuggest": "^10.1.0",
"replace-in-file-webpack-plugin": "^1.0.6",
"sass": "1.63.2",
"sass-loader": "13.3.1",
"sass": "1.68.0",
"sass-loader": "13.3.2",
"style-loader": "3.3.3",
"swc-loader": "^0.2.3",
"ts-jest": "26.4.4",
"ts-jest": "29.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"tslib": "2.5.3",
"typescript": "4.8.4",
"typescript": "5.2.2",
"webpack": "^5.86.0",
"webpack-cli": "^5.1.4",
"webpack-livereload-plugin": "^3.0.2"
Expand All @@ -84,23 +84,23 @@
},
"dependencies": {
"@emotion/css": "^11.1.3",
"@grafana/data": "9.5.3",
"@grafana/runtime": "7.5.8",
"@grafana/ui": "7.5.8",
"@grafana/data": "10.1.2",
"@grafana/runtime": "10.1.2",
"@grafana/ui": "10.1.2",
"@types/react-autosuggest": "^10.1.6",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"ace-builds": "^1.15.2",
"ace-builds": "^1.27.0",
"brace": "^0.11.1",
"grafana-data": "^2.0.1",
"react": "17.0.2",
"react": "18.2.0",
"react-ace": "^10.1.0",
"react-autosuggest": "^10.1.0",
"react-awesome-query-builder": "^5.4.1",
"react-dom": "17.0.2",
"react-monaco-editor": "^0.51.0",
"react-awesome-query-builder": "^5.4.2",
"react-dom": "18.2.0",
"react-monaco-editor": "^0.54.0",
"react-use": "^17.4.0",
"react-virtualized-auto-sizer": "^1.0.7",
"tslib": "2.5.3",
"react-virtualized-auto-sizer": "^1.0.20",
"tslib": "2.6.2",
"yarn": "^1.22.19"
},
"packageManager": "[email protected]"
Expand Down
5 changes: 4 additions & 1 deletion src/PartListSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { toSelectableValue } from './toSelectableValue';
import { AddButton } from './AddButton';
import { unwrap } from './unwrap';

// eslint-disable-next-line @typescript-eslint/array-type
export type PartParams = Array<{
value: string;
options: (() => Promise<SelectableValue<string>>) | null;
}>;


type Props = {
// eslint-disable-next-line @typescript-eslint/array-type
parts: Array<{
name: string;
params: PartParams;
Expand Down Expand Up @@ -133,7 +136,7 @@ const Part = ({ name, params, onChange, onRemove }: PartProps): JSX.Element => {
>
<RemovableName name={name} onRemove={onRemove} />(
{params.map((p, i) => {
const results = new Promise<Array<SelectableValue<string>>>((resolve) => resolve([]));
const results = new Promise<SelectableValue<string>[]>((resolve) => resolve([]));
const { value, options } = p;
const isLast = i === params.length - 1;
const loadOptions =
Expand Down
28 changes: 14 additions & 14 deletions src/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const label = type.split('|')[0];
const value = type.split('|')[1];
const partType = type.split('|')[2];
let defaultParams: Array<string | number> = [];
let defaultParams: any[] = [];
switch (value) {
case 'column':
defaultParams = ['value'];
Expand Down Expand Up @@ -292,7 +292,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
// handler when WHERE section part is added
const handleWhereParamsAdd = (type: string) => {
const clonedQuery = cloneDeep(query);
let defaultParams: Array<string | number> = [];
let defaultParams: any[] = [];
let partName = '';
switch (type) {
case 'macro':
Expand Down Expand Up @@ -338,7 +338,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const handleGroupParamsAdd = (type: string, data: any = { label: '', value: '', type: '' }) => {
// const clonedQuery = cloneDeep(query);
const clonedQuery = cloneDeep<any | undefined>(query);
let defaultParams: Array<string | number> = [];
let defaultParams: any[] = [];
let partName = '';
switch (type) {
case 'time':
Expand Down Expand Up @@ -374,7 +374,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const getSchemaOptions = () => {
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<any[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildSchemaQuery());
const result = response.map((res: any) => {
Expand All @@ -389,7 +389,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const getTableOptions = () => {
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<any[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildTableQuery());
const result = response.map((res: any) => {
Expand All @@ -404,7 +404,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const getTimeColumnOptions = () => {
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<SelectableValue<string>[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildColumnQuery('time'));
const result = response.map((res: any) => {
Expand All @@ -419,7 +419,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const getMetricColumnOptions = () => {
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<SelectableValue<string>[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildColumnQuery('metric'));
const result = response.map((res: any) => {
Expand All @@ -434,7 +434,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const getColumnOptions = useCallback(async () => {
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<string[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildColumnQuery('value'));
const result = response.map((res: any) => {
Expand All @@ -447,7 +447,7 @@ export const QueryEditor = (props: Props): JSX.Element => {

// method to fetch all the columns selected in the SELECT section and TIME section
const getSelectedColumnOptions = useCallback(() => {
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<any[]>((resolve) => {
setTimeout(() => {
const result: any = [];
result.push(query.timeColumn);
Expand All @@ -466,7 +466,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
// method to fetch all the group columns for the selected table
const getGroupByOptions = () => {
const queryModel = new QueryModel(query, getTemplateSrv());
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<any[]>((resolve) => {
setTimeout(async () => {
const response = await getSelectedColumnOptions();
const options = [];
Expand All @@ -486,7 +486,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const { datasource } = props;
const queryModel = new QueryModel(query, getTemplateSrv());
const metaBuilder = new MetaQuery(query, queryModel);
return new Promise<Array<SelectableValue<string>>>((resolve) => {
return new Promise<any[]>((resolve) => {
setTimeout(async () => {
const response = await datasource.metricFindQuery(metaBuilder.buildColumnQuery(''));
const result = response.map((res: any) => {
Expand All @@ -504,7 +504,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
query.select.map((item) => {
const data: any = [];
item.map((row) => {
const params: Array<{ value: string; options: (() => Promise<SelectableValue<string>>) | null }> = [];
const params: any[] = [];
row.params.map((param, paramIndex) => {
if (row.type === 'column') {
params.push({
Expand Down Expand Up @@ -555,7 +555,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const whereParts = useMemo(() => {
const results: any = [];
query.where?.map((part) => {
const params: Array<{ value: string; options: (() => Promise<SelectableValue<string>>) | null }> = [];
const params: any[] = [];
let partName = '';
part.params.map((param, index) => {
if (part.type === 'expression') {
Expand Down Expand Up @@ -600,7 +600,7 @@ export const QueryEditor = (props: Props): JSX.Element => {
const results: any = [];
query.group &&
query.group.map((part) => {
const params: Array<{ value: string; options: (() => Promise<SelectableValue<string>>) | null }> = [];
const params: any[] = [];
let partName = '';
part.params.map((param, index) => {
if (part.type === 'time') {
Expand Down
2 changes: 1 addition & 1 deletion src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class DataSource extends DataSourceWithBackend<MyQuery, MyDataSourceOptio
const textFieldIdx = frame.fields[0].name === '__text' ? 0 : 1;
const valueFieldIdx = textFieldIdx === 0 ? 1 : 0;
let metricResponse: MetricFindValue[] = [];
var idx: number;
let idx: number;
for (idx = 0; idx < frame.length; idx++) {
metricResponse.push({
text: frame.fields[textFieldIdx].values.get(idx),
Expand Down
3 changes: 3 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DataQuery, DataSourceJsonData, SelectableValue } from '@grafana/data';

export interface QueryPart {
type: string;
// eslint-disable-next-line @typescript-eslint/array-type
params: Array<string | number>;
name?: string;
}
Expand All @@ -22,8 +23,10 @@ export interface MyQuery extends DataQuery {
rawSql?: string;
queryText?: string;
hide: boolean;

}

// eslint-disable-next-line @typescript-eslint/array-type
export type PartParams = Array<{
value: string;
options: (() => Promise<SelectableValue<string>>) | null;
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const config = async (env): Promise<Configuration> => {
});
};

export default config;
export default config;

0 comments on commit f6b772c

Please sign in to comment.