Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): delete deprecated rules
- Loading branch information
1 parent
3947418
commit 4696e36
Showing
16 changed files
with
4 additions
and
1,366 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,8 @@ | ||
# Enforce camelCase naming convention (`camelcase`) | ||
|
||
## DEPRECATED | ||
|
||
This rule has been deprecated in favour of the [`naming-convention`](./naming-convention.md) rule. | ||
It will be removed in a future version of this plugin. | ||
|
||
## Rule Details | ||
|
||
This rule extends the base [`eslint/camelcase`](https://eslint.org/docs/rules/camelcase) rule. | ||
It adds support for numerous TypeScript features. | ||
|
||
## How to use | ||
|
||
```jsonc | ||
{ | ||
// note you must disable the base rule as it can report incorrect errors | ||
"camelcase": "off", | ||
"@typescript-eslint/camelcase": ["error"] | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
See [`eslint/camelcase` options](https://eslint.org/docs/rules/camelcase#options). | ||
This rule adds the following options: | ||
|
||
```ts | ||
interface Options extends BaseCamelcaseOptions { | ||
genericType?: 'always' | 'never'; | ||
} | ||
|
||
const defaultOptions: Options = { | ||
...baseCamelcaseDefaultOptions, | ||
genericType: 'never', | ||
}; | ||
``` | ||
|
||
- `"genericType": "never"` (default) does not check generic identifiers | ||
- `"genericType": "always"` enforces camelCase style for generic identifiers | ||
|
||
### `genericType: "always"` | ||
|
||
Examples of **incorrect** code for this rule with the default `{ "genericType": "always" }` option: | ||
|
||
```typescript | ||
/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "always" }] */ | ||
|
||
interface Foo<t_foo> {} | ||
function foo<t_foo>() {} | ||
class Foo<t_foo> {} | ||
type Foo<t_foo> = {}; | ||
class Foo { | ||
method<t_foo>() {} | ||
} | ||
|
||
interface Foo<t_foo extends object> {} | ||
function foo<t_foo extends object>() {} | ||
class Foo<t_foo extends object> {} | ||
type Foo<t_foo extends object> = {}; | ||
class Foo { | ||
method<t_foo extends object>() {} | ||
} | ||
|
||
interface Foo<t_foo = object> {} | ||
function foo<t_foo = object>() {} | ||
class Foo<t_foo = object> {} | ||
type Foo<t_foo = object> = {}; | ||
class Foo { | ||
method<t_foo = object>() {} | ||
} | ||
``` | ||
|
||
Examples of **correct** code for this rule with the default `{ "genericType": "always" }` option: | ||
|
||
```typescript | ||
/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "always" }] */ | ||
|
||
interface Foo<T> {} | ||
function foo<t>() {} | ||
class Foo<T> {} | ||
type Foo<T> = {}; | ||
class Foo { | ||
method<T>() {} | ||
} | ||
|
||
interface Foo<T extends object> {} | ||
function foo<T extends object>() {} | ||
class Foo<T extends object> {} | ||
type Foo<T extends object> = {}; | ||
class Foo { | ||
method<T extends object>() {} | ||
} | ||
|
||
interface Foo<T = object> {} | ||
function foo<T = object>() {} | ||
class Foo<T = object> {} | ||
type Foo<T = object> = {}; | ||
class Foo { | ||
method<T = object>() {} | ||
} | ||
``` | ||
|
||
### `genericType: "never"` | ||
|
||
Examples of **correct** code for this rule with the `{ "genericType": "never" }` option: | ||
|
||
```typescript | ||
/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "never" }] */ | ||
|
||
interface Foo<t_foo> {} | ||
function foo<t_foo>() {} | ||
class Foo<t_foo> {} | ||
type Foo<t_foo> = {}; | ||
class Foo { | ||
method<t_foo>() {} | ||
} | ||
|
||
interface Foo<t_foo extends object> {} | ||
function foo<t_foo extends object>() {} | ||
class Foo<t_foo extends object> {} | ||
type Foo<t_foo extends object> = {}; | ||
class Foo { | ||
method<t_foo extends object>() {} | ||
} | ||
|
||
interface Foo<t_foo = object> {} | ||
function foo<t_foo = object>() {} | ||
class Foo<t_foo = object> {} | ||
type Foo<t_foo = object> = {}; | ||
class Foo { | ||
method<t_foo = object>() {} | ||
} | ||
``` | ||
|
||
<sup>Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/camelcase.md)</sup> | ||
<!-- | ||
This doc file has been left on purpose because `camelcase` is a core eslint rule. | ||
This exists to help direct people to the replacement rule. | ||
--> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.