mirror of https://github.com/grafana/grafana.git
Chore: use `satisfies` and remove a load of `any`s (#108397)
use satisfies and remove a load of anys
This commit is contained in:
parent
52a0485d5b
commit
85a1a35948
|
|
@ -3692,19 +3692,6 @@ exports[`better eslint`] = {
|
|||
[0, 0, 0, "Using localeCompare() can cause performance issues when sorting large datasets. Consider using Intl.Collator for better performance when sorting arrays, or add an eslint-disable comment if sorting a small, known dataset.", "4"],
|
||||
[0, 0, 0, "Using localeCompare() can cause performance issues when sorting large datasets. Consider using Intl.Collator for better performance when sorting arrays, or add an eslint-disable comment if sorting a small, known dataset.", "5"]
|
||||
],
|
||||
"public/app/plugins/datasource/tempo/traceql/traceql.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"]
|
||||
],
|
||||
"public/app/plugins/datasource/zipkin/QueryField.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ describe('TraceQL grammar', () => {
|
|||
|
||||
describe('TraceQL patterns', () => {
|
||||
it('should match span-set patterns', () => {
|
||||
const spanSetRule = (traceqlGrammar as any)['span-set'];
|
||||
const spanSetRule = traceqlGrammar['span-set'];
|
||||
expect(spanSetRule).toBeDefined();
|
||||
expect(spanSetRule.pattern).toBeDefined();
|
||||
const spanSetPattern = spanSetRule.pattern as RegExp;
|
||||
|
|
@ -84,7 +84,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should match with-clause patterns', () => {
|
||||
const withClauseRule = (traceqlGrammar as any)['with-clause'];
|
||||
const withClauseRule = traceqlGrammar['with-clause'];
|
||||
expect(withClauseRule).toBeDefined();
|
||||
expect(withClauseRule.pattern).toBeDefined();
|
||||
const withClausePattern = withClauseRule.pattern as RegExp;
|
||||
|
|
@ -95,7 +95,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should match comment patterns', () => {
|
||||
const commentRule = (traceqlGrammar as any).comment;
|
||||
const commentRule = traceqlGrammar.comment;
|
||||
expect(commentRule).toBeDefined();
|
||||
expect(commentRule.pattern).toBeDefined();
|
||||
const commentPattern = commentRule.pattern as RegExp;
|
||||
|
|
@ -104,7 +104,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should match number patterns', () => {
|
||||
const numberRule = (traceqlGrammar as any).number;
|
||||
const numberRule = traceqlGrammar.number;
|
||||
expect(numberRule).toBeDefined();
|
||||
const numberPattern = numberRule as RegExp;
|
||||
expect(numberPattern.test('123')).toBe(true);
|
||||
|
|
@ -114,7 +114,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should match operator patterns', () => {
|
||||
const operatorRule = (traceqlGrammar as any).operator;
|
||||
const operatorRule = traceqlGrammar.operator;
|
||||
expect(operatorRule).toBeDefined();
|
||||
const operatorPattern = operatorRule as RegExp;
|
||||
expect(operatorPattern.test('=')).toBe(true);
|
||||
|
|
@ -345,7 +345,7 @@ describe('TraceQL grammar', () => {
|
|||
|
||||
testCases.forEach(({ name, query, shouldMatch }) => {
|
||||
it(`should ${shouldMatch ? 'match' : 'not match'} ${name}`, () => {
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const spanSetPattern = grammar['span-set']?.pattern as RegExp;
|
||||
const withClausePattern = grammar['with-clause']?.pattern as RegExp;
|
||||
const commentPattern = grammar.comment?.pattern as RegExp;
|
||||
|
|
@ -367,7 +367,7 @@ describe('TraceQL grammar', () => {
|
|||
|
||||
describe('With clause validation', () => {
|
||||
it('should validate with clause parameter names', () => {
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const withClause = grammar['with-clause'];
|
||||
expect(withClause).toBeDefined();
|
||||
expect(withClause.inside).toBeDefined();
|
||||
|
|
@ -382,7 +382,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should validate with clause parameter values', () => {
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const withClause = grammar['with-clause'];
|
||||
expect(withClause).toBeDefined();
|
||||
expect(withClause.inside).toBeDefined();
|
||||
|
|
@ -400,7 +400,7 @@ describe('TraceQL grammar', () => {
|
|||
});
|
||||
|
||||
it('should validate with clause keyword', () => {
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const withClause = grammar['with-clause'];
|
||||
expect(withClause).toBeDefined();
|
||||
expect(withClause.inside).toBeDefined();
|
||||
|
|
@ -418,7 +418,7 @@ describe('TraceQL grammar', () => {
|
|||
describe('Edge cases', () => {
|
||||
it('should handle multiple with clauses (invalid but should not crash)', () => {
|
||||
const query = '{span.name="test"} with (most_recent=true) with (other=false)';
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const withClausePattern = grammar['with-clause']?.pattern as RegExp;
|
||||
|
||||
if (withClausePattern) {
|
||||
|
|
@ -432,7 +432,7 @@ describe('TraceQL grammar', () => {
|
|||
|
||||
it('should handle with clause without parameters', () => {
|
||||
const query = '{span.name="test"} with ()';
|
||||
const grammar = traceqlGrammar as any;
|
||||
const grammar = traceqlGrammar;
|
||||
const withClausePattern = grammar['with-clause']?.pattern as RegExp;
|
||||
|
||||
if (withClausePattern) {
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ export const languageDefinition = {
|
|||
};
|
||||
|
||||
// For "Search" tab (query builder)
|
||||
export const traceqlGrammar: Grammar = {
|
||||
export const traceqlGrammar = {
|
||||
comment: {
|
||||
pattern: /\/\/.*/,
|
||||
},
|
||||
|
|
@ -277,4 +277,4 @@ export const traceqlGrammar: Grammar = {
|
|||
number: /\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,
|
||||
operator: new RegExp(`/[-+*/=%^~]|&&?|\\|?\\||!=?|<(?:=>?|<|>)?|>[>=]?|`, 'i'),
|
||||
punctuation: /[{};()`,.]/,
|
||||
};
|
||||
} satisfies Grammar;
|
||||
|
|
|
|||
Loading…
Reference in New Issue