Skip to content

Commit 907ceb1

Browse files
authored
Merge branch 'main' into copilot/fix-screen-reader-prompt-issue
2 parents 297ca4c + f84ac32 commit 907ceb1

File tree

469 files changed

+7381
-4417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

469 files changed

+7381
-4417
lines changed

.eslint-plugin-local/code-amd-node-module.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
78
import { join } from 'path';
89

910

@@ -33,13 +34,13 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
3334
}
3435

3536

36-
const checkImport = (node: any) => {
37+
const checkImport = (node: ESTree.Literal & { parent?: ESTree.Node & { importKind?: string } }) => {
3738

38-
if (node.type !== 'Literal' || typeof node.value !== 'string') {
39+
if (typeof node.value !== 'string') {
3940
return;
4041
}
4142

42-
if (node.parent.importKind === 'type') {
43+
if (node.parent?.type === 'ImportDeclaration' && node.parent.importKind === 'type') {
4344
return;
4445
}
4546

.eslint-plugin-local/code-declare-service-brand.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
78

89
export = new class DeclareServiceBrand implements eslint.Rule.RuleModule {
910

@@ -14,7 +15,7 @@ export = new class DeclareServiceBrand implements eslint.Rule.RuleModule {
1415

1516
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1617
return {
17-
['PropertyDefinition[key.name="_serviceBrand"][value]']: (node: any) => {
18+
['PropertyDefinition[key.name="_serviceBrand"][value]']: (node: ESTree.PropertyDefinition) => {
1819
return context.report({
1920
node,
2021
message: `The '_serviceBrand'-property should not have a value`,

.eslint-plugin-local/code-limited-top-functions.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import * as eslint from 'eslint';
77
import { dirname, relative } from 'path';
88
import minimatch from 'minimatch';
9+
import * as ESTree from 'estree';
910

1011
export = new class implements eslint.Rule.RuleModule {
1112

@@ -43,8 +44,8 @@ export = new class implements eslint.Rule.RuleModule {
4344
const restrictedFunctions = ruleArgs[matchingKey];
4445

4546
return {
46-
FunctionDeclaration: (node: any) => {
47-
const isTopLevel = node.parent.type === 'Program';
47+
FunctionDeclaration: (node: ESTree.FunctionDeclaration & { parent?: ESTree.Node }) => {
48+
const isTopLevel = node.parent?.type === 'Program';
4849
const functionName = node.id.name;
4950
if (isTopLevel && !restrictedFunctions.includes(node.id.name)) {
5051
context.report({
@@ -53,10 +54,10 @@ export = new class implements eslint.Rule.RuleModule {
5354
});
5455
}
5556
},
56-
ExportNamedDeclaration(node: any) {
57+
ExportNamedDeclaration(node: ESTree.ExportNamedDeclaration & { parent?: ESTree.Node }) {
5758
if (node.declaration && node.declaration.type === 'FunctionDeclaration') {
5859
const functionName = node.declaration.id.name;
59-
const isTopLevel = node.parent.type === 'Program';
60+
const isTopLevel = node.parent?.type === 'Program';
6061
if (isTopLevel && !restrictedFunctions.includes(node.declaration.id.name)) {
6162
context.report({
6263
node,

.eslint-plugin-local/code-must-use-result.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
78
import { TSESTree } from '@typescript-eslint/utils';
89

910
const VALID_USES = new Set<TSESTree.AST_NODE_TYPES | undefined>([
@@ -24,9 +25,9 @@ export = new class MustUseResults implements eslint.Rule.RuleModule {
2425
for (const { message, functions } of config) {
2526
for (const fn of functions) {
2627
const query = `CallExpression[callee.property.name='${fn}'], CallExpression[callee.name='${fn}']`;
27-
listener[query] = (node: any) => {
28-
const cast: TSESTree.CallExpression = node;
29-
if (!VALID_USES.has(cast.parent?.type)) {
28+
listener[query] = (node: ESTree.Node) => {
29+
const callExpression = node as TSESTree.CallExpression;
30+
if (!VALID_USES.has(callExpression.parent?.type)) {
3031
context.report({ node, message });
3132
}
3233
};

.eslint-plugin-local/code-must-use-super-dispose.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
8+
import { TSESTree } from '@typescript-eslint/utils';
79

810
export = new class NoAsyncSuite implements eslint.Rule.RuleModule {
911

1012
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
11-
function doesCallSuperDispose(node: any) {
13+
function doesCallSuperDispose(node: TSESTree.MethodDefinition) {
1214

1315
if (!node.override) {
1416
return;
1517
}
1618

17-
const body = context.getSourceCode().getText(node);
19+
const body = context.getSourceCode().getText(node as ESTree.Node);
1820

1921
if (body.includes('super.dispose')) {
2022
return;

.eslint-plugin-local/code-no-dangerous-type-assertions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
78
import { TSESTree } from '@typescript-eslint/utils';
89

910
export = new class NoDangerousTypeAssertions implements eslint.Rule.RuleModule {
1011

1112
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1213
return {
1314
// Disallow type assertions on object literals: <T>{ ... } or {} as T
14-
['TSTypeAssertion > ObjectExpression, TSAsExpression > ObjectExpression']: (node: any) => {
15-
const objectNode = node as TSESTree.Node;
15+
['TSTypeAssertion > ObjectExpression, TSAsExpression > ObjectExpression']: (node: ESTree.ObjectExpression) => {
16+
const objectNode = node as TSESTree.ObjectExpression;
1617

1718
const parent = objectNode.parent as TSESTree.TSTypeAssertion | TSESTree.TSAsExpression;
1819
if (

.eslint-plugin-local/code-no-deep-import-of-internal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export = new class implements eslint.Rule.RuleModule {
2828

2929
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
3030
const patterns = context.options[0] as Record<string, boolean>;
31-
const internalModulePattern = Object.entries(patterns).map(([key, v]) => v ? key : undefined).filter(v => !!v);
32-
const allowedPatterns = Object.entries(patterns).map(([key, v]) => !v ? key : undefined).filter(v => !!v);
31+
const internalModulePattern = Object.entries(patterns).map(([key, v]) => v ? key : undefined).filter((v): v is string => !!v);
32+
const allowedPatterns = Object.entries(patterns).map(([key, v]) => !v ? key : undefined).filter((v): v is string => !!v);
3333

3434
return createImportRuleListener((node, path) => {
3535
const importerModuleDir = dirname(context.filename);

.eslint-plugin-local/code-no-in-operator.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
8+
import { TSESTree } from '@typescript-eslint/utils';
79

810
/**
911
* Disallows the use of the `in` operator in TypeScript code, except within
@@ -26,9 +28,10 @@ export = new class NoInOperator implements eslint.Rule.RuleModule {
2628

2729
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
2830

29-
function checkInOperator(inNode: any) {
31+
function checkInOperator(inNode: ESTree.BinaryExpression) {
32+
const node = inNode as TSESTree.BinaryExpression;
3033
// Check if we're inside a type predicate function
31-
const ancestors = context.sourceCode.getAncestors(inNode);
34+
const ancestors = context.sourceCode.getAncestors(node as ESTree.Node);
3235

3336
for (const ancestor of ancestors) {
3437
if (ancestor.type === 'FunctionDeclaration' ||
@@ -45,7 +48,7 @@ export = new class NoInOperator implements eslint.Rule.RuleModule {
4548
}
4649

4750
context.report({
48-
node: inNode,
51+
node,
4952
messageId: 'noInOperator'
5053
});
5154
}

.eslint-plugin-local/code-no-native-private.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7+
import * as ESTree from 'estree';
78

89
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
910

@@ -17,13 +18,13 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
1718
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1819

1920
return {
20-
['PropertyDefinition PrivateIdentifier']: (node: any) => {
21+
['PropertyDefinition PrivateIdentifier']: (node: ESTree.Node) => {
2122
context.report({
2223
node,
2324
messageId: 'slow'
2425
});
2526
},
26-
['MethodDefinition PrivateIdentifier']: (node: any) => {
27+
['MethodDefinition PrivateIdentifier']: (node: ESTree.Node) => {
2728
context.report({
2829
node,
2930
messageId: 'slow'

.eslint-plugin-local/code-no-observable-get-in-reactive-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export = new class NoObservableGetInReactiveContext implements eslint.Rule.RuleM
1919

2020
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
2121
return {
22-
'CallExpression': (node: any) => {
22+
'CallExpression': (node: ESTree.CallExpression) => {
2323
const callExpression = node as TSESTree.CallExpression;
2424

2525
if (!isReactiveFunctionWithReader(callExpression.callee)) {

0 commit comments

Comments
 (0)