-
Notifications
You must be signed in to change notification settings - Fork 516
/
eslint-test.ts
56 lines (47 loc) · 1.75 KB
/
eslint-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-FileCopyrightText: Copyright (C) 2023-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)<[email protected]>
// SPDX-License-Identifier: MPL-2.0
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
// This file is not used in the app, but exists to test that our eslint config catches the code we want it to catch.
// Because we run eslint with --report-unused-disable-directives, any unused comments will be errors.
/* eslint-disable @typescript-eslint/no-unused-expressions */
({
// eslint-disable-next-line no-restricted-syntax
get x() {
return 1;
},
// @ts-expect-error unused variable
// eslint-disable-next-line no-restricted-syntax
set x(newX) {},
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(str: string, wut: any) => {
console.log = () => 0;
console.log(str); // eslint-disable-line no-restricted-syntax
// All nulls are banned
wut == null; // eslint-disable-line no-restricted-syntax
};
// @ts-expect-error unused function
function useEffectOnce() {} // eslint-disable-line id-denylist, @typescript-eslint/no-unused-vars
class Foo {
private bar = 1; // eslint-disable-line @lichtblick/prefer-hash-private
private static baz = 1; // eslint-disable-line @lichtblick/prefer-hash-private
// eslint-disable-next-line @lichtblick/prefer-hash-private
private foo() {
this.bar = 2;
}
// eslint-disable-next-line @lichtblick/prefer-hash-private
private static getBaz() {
this.baz = 3;
void this.baz;
}
public asdf() {
this.foo();
Foo.getBaz();
void this.bar;
}
}
void Foo;
// keep isolatedModules happy
export default {};