Add eslint rule to disallow non-null-assertion (#4613)
* Add rule to disallow non-null-assertion * Fix all linting errors * Fix lint error * Delete samples/Calling/src/app/views/ErrorBoundary.tsx Signed-off-by: Porter Nan <jiangnanhello@live.com> --------- Signed-off-by: Porter Nan <jiangnanhello@live.com>
This commit is contained in:
Родитель
dbdc323815
Коммит
3f044549c3
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -33,6 +33,7 @@ module.exports = {
|
|||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
|
|
|
@ -26,6 +26,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
|
|
|
@ -31,6 +31,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -142,9 +142,9 @@ export const _TagsSurvey = (props: _TagsSurveyProps): JSX.Element => {
|
|||
if (checked) {
|
||||
if (issue) {
|
||||
setSelectedTags((prevState) => {
|
||||
const existingIssues = prevState?.[issueCategory]?.issues;
|
||||
if (existingIssues) {
|
||||
prevState[issueCategory]!.issues = [...existingIssues, issue] as any;
|
||||
const category = prevState?.[issueCategory];
|
||||
if (category && category.issues) {
|
||||
category.issues = [category.issues, issue] as any;
|
||||
} else {
|
||||
prevState[issueCategory] = { issues: [issue] } as any;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -43,7 +43,7 @@ export const TEST_PARTICIPANTS: ChatParticipant[] = TEST_PARTICIPANTS_CHAT.map((
|
|||
* Default fake chat adapter args
|
||||
*/
|
||||
export const DEFAULT_FAKE_CHAT_ADAPTER_ARGS = {
|
||||
localParticipant: TEST_PARTICIPANTS[0]!,
|
||||
localParticipant: TEST_PARTICIPANTS[0] as ChatParticipant,
|
||||
remoteParticipants: TEST_PARTICIPANTS.slice(1)
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ module.exports = {
|
|||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'import/named': 'off', // very time consuming
|
||||
'import/namespace': 'off', // very time consuming
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
|
|
@ -26,6 +26,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
eqeqeq: 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
|
||||
'react/display-name': 'off',
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче