You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,7 @@ class Animal {
164
164
}
165
165
```
166
166
167
-
### Overrides
167
+
### `overrides`
168
168
169
169
There are three ways in which an override can be used.
170
170
@@ -312,7 +312,7 @@ class Animal {
312
312
}
313
313
```
314
314
315
-
### Except specific methods
315
+
### `ignoredMethodNames`
316
316
317
317
If you want to ignore some specific methods, you can do it by specifying method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly.
318
318
e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]`
Copy file name to clipboardExpand all lines: packages/eslint-plugin/docs/rules/no-this-alias.md
+69
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,75 @@ setTimeout(() => {
33
33
34
34
## Options
35
35
36
+
### `allowDestructuring`
37
+
38
+
It can sometimes be useful to destructure properties from a class instance, such as retrieving multiple properties from the instance in one of its methods.
39
+
`allowDestructuring` allows those destructures and is `true` by default.
40
+
You can explicitly disallow them by setting `allowDestructuring` to `false`.
41
+
42
+
Examples of code for the `{ "allowDestructuring": false }` option:
43
+
44
+
<!--tabs-->
45
+
46
+
#### ❌ Incorrect
47
+
48
+
```ts option='{ "allowDestructuring": false }'
49
+
classComponentLike {
50
+
props:unknown;
51
+
state:unknown;
52
+
53
+
render() {
54
+
const { props, state } =this;
55
+
56
+
console.log(props);
57
+
console.log(state);
58
+
}
59
+
}
60
+
```
61
+
62
+
#### ✅ Correct
63
+
64
+
```ts option='{ "allowDestructuring": false }'
65
+
classComponentLike {
66
+
props:unknown;
67
+
state:unknown;
68
+
69
+
render() {
70
+
console.log(this.props);
71
+
console.log(this.state);
72
+
}
73
+
}
74
+
```
75
+
76
+
### `allowedNames`
77
+
78
+
`no-this-alias` can alternately be used to allow only a specific list of names as `this` aliases.
79
+
We recommend against this except as a transitory step towards fixing all rule violations.
80
+
81
+
Examples of code for the `{ "allowedNames": ["self"] }` option:
82
+
83
+
<!--tabs-->
84
+
85
+
#### ❌ Incorrect
86
+
87
+
```ts option='{ "allowedNames": ["self"] }'
88
+
classExample {
89
+
method() {
90
+
const that =this;
91
+
}
92
+
}
93
+
```
94
+
95
+
#### ✅ Correct
96
+
97
+
```ts option='{ "allowedNames": ["self"] }'
98
+
classExample {
99
+
method() {
100
+
const self =this;
101
+
}
102
+
}
103
+
```
104
+
36
105
## When Not To Use It
37
106
38
107
If your project is structured in a way that it needs to assign `this` to variables, this rule is likely not for you.
Copy file name to clipboardExpand all lines: packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
+10
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,16 @@ foo ?? 'a string';
167
167
168
168
Also, if you would like to ignore all primitives types, you can set `ignorePrimitives: true`. It is equivalent to `ignorePrimitives: { string: true, number: true, bigint: true, boolean: true }`.
If this is set to `false`, then the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.
173
+
174
+
Without `strictNullChecks`, TypeScript essentially erases `undefined` and `null` from the types. This means when this rule inspects the types from a variable, **it will not be able to tell that the variable might be `null` or `undefined`**, which essentially makes this rule useless.
175
+
176
+
You should be using `strictNullChecks` to ensure complete type-safety in your codebase.
177
+
178
+
If for some reason you cannot turn on `strictNullChecks`, but still want to use this rule - you can use this option to allow it - but know that the behavior of this rule is _undefined_ with the compiler option turned off. We will not accept bug reports if you are using this option.
179
+
170
180
## When Not To Use It
171
181
172
182
If you are not using TypeScript 3.7 (or greater), then you will not be able to use this rule, as the operator is not supported.
0 commit comments