New Rules
New Rules
Changed rules
New Rules
Changed rules
Changed Rules
Changed Rules
New Rules
Changed Rules
Removed Rules
New Rules
Changed Rules
For certain scenarios of the following rules, Code Linter checks report errors after DevEco Studio is upgraded to 5.0.3.600, which do not occur in previous versions.
// Scenario 1: logical expression check
interface GeneratedTypeLiteralInterface {}
declare let foo: GeneratedTypeLiteralInterface;
foo ??= 1; // This does not trigger an error before the upgrade, but it will after the upgrade.
// Scenario 2: In chain expressions where non-nullity can be inferred, there is no need to add null checks.
interface GeneratedTypeLiteralInterface {
bar: () => number;
}
type Foo = GeneratedTypeLiteralInterface | null;
declare const foo: Foo;
foo?.bar()?.toExponential(); // This does not trigger an error before the upgrade, but it will after the upgrade. // In scenarios where a function's return type is not explicitly defined and the return value could be a Promise, the function should be defined as async.
function promiseInUnionWithoutExplicitReturnType(p: boolean) { // This does not trigger an error before the upgrade, but it will after the upgrade.
return p ? Promise.resolve(5) : 5;
} // When the optionalityOrder option is configured and the class property does not contain optional variables, the order option configured in the rule is ineffective in previous versions.
// Rule settings: "@typescript-eslint/member-ordering": ["error", {"default": {"memberTypes": 'never', "order": 'natural-case-insensitive', "optionalityOrder": 'required-first',}}].
class X {
b: string = '';
a: string = ''; // This does not trigger an error before the upgrade, but it will after the upgrade.
} // Support for checking typeMethod in the interface
// Rule settings: "@typescript-eslint/naming-convention": ["error", {selector: 'typeMethod', format: ['PascalCase']}].
interface SOME_INTERFACE {
someMethod: () => void; // This does not trigger an error before the upgrade, but it will after the upgrade.
some_property: string;
} // Support for checking the type after extend and implements
// Rule settings: "@typescript-eslint/ban-types": ["error",{"types": {"Bar": {"message": ""}}}].
interface Bar {}
interface Baz {}
interface Foo extends Bar, Baz {} // This does not trigger an error before the upgrade, but it will after the upgrade. // Scenario 1: .finally() is considered as not effectively handling potential exceptions that may occur in the Promise.
Promise.reject().finally(() => {}) // This does not trigger an error before the upgrade, but it will after the upgrade.
// Scenario 2: If the second parameter in .then() is undefined or null, it is considered as not effectively handling potential exceptions that may occur in the Promise.
Promise.resolve().then(() => {}, undefined); // This does not trigger an error before the upgrade, but it will after the upgrade.
Promise.resolve().then(() => {}, null); // This does not trigger an error before the upgrade, but it will after the upgrade. // Support for checking the parameter type in the constructor
class Foo {
constructor(param: boolean = true) {} // This does not trigger an error before the upgrade, but it will after the upgrade.
} interface GeneratedObjectLiteralInterface {
prop?: string
}
class Test {
// Support for checking private properties
#testObj: GeneratedObjectLiteralInterface = {}; // This does not trigger an error before the upgrade, but it will after the upgrade.
public test(): void {
this.#testObj?.prop;
}
} New Rules
Changed Rules
Removed Rules