| 1 | # import/no-deprecated
|
|---|
| 2 |
|
|---|
| 3 | <!-- end auto-generated rule header -->
|
|---|
| 4 |
|
|---|
| 5 | Reports use of a deprecated name, as indicated by a JSDoc block with a `@deprecated`
|
|---|
| 6 | tag or TomDoc `Deprecated:` comment.
|
|---|
| 7 |
|
|---|
| 8 | using a JSDoc `@deprecated` tag:
|
|---|
| 9 |
|
|---|
| 10 | ```js
|
|---|
| 11 | // @file: ./answer.js
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * this is what you get when you trust a mouse talk show
|
|---|
| 15 | * @deprecated need to restart the experiment
|
|---|
| 16 | * @returns {Number} nonsense
|
|---|
| 17 | */
|
|---|
| 18 | export function multiply(six, nine) {
|
|---|
| 19 | return 42
|
|---|
| 20 | }
|
|---|
| 21 | ```
|
|---|
| 22 |
|
|---|
| 23 | will report as such:
|
|---|
| 24 |
|
|---|
| 25 | ```js
|
|---|
| 26 | import { multiply } from './answer' // Deprecated: need to restart the experiment
|
|---|
| 27 |
|
|---|
| 28 | function whatever(y, z) {
|
|---|
| 29 | return multiply(y, z) // Deprecated: need to restart the experiment
|
|---|
| 30 | }
|
|---|
| 31 | ```
|
|---|
| 32 |
|
|---|
| 33 | or using the TomDoc equivalent:
|
|---|
| 34 |
|
|---|
| 35 | ```js
|
|---|
| 36 | // Deprecated: This is what you get when you trust a mouse talk show, need to
|
|---|
| 37 | // restart the experiment.
|
|---|
| 38 | //
|
|---|
| 39 | // Returns a Number nonsense
|
|---|
| 40 | export function multiply(six, nine) {
|
|---|
| 41 | return 42
|
|---|
| 42 | }
|
|---|
| 43 | ```
|
|---|
| 44 |
|
|---|
| 45 | Only JSDoc is enabled by default. Other documentation styles can be enabled with
|
|---|
| 46 | the `import/docstyle` setting.
|
|---|
| 47 |
|
|---|
| 48 | ```yaml
|
|---|
| 49 | # .eslintrc.yml
|
|---|
| 50 | settings:
|
|---|
| 51 | import/docstyle: ['jsdoc', 'tomdoc']
|
|---|
| 52 | ```
|
|---|
| 53 |
|
|---|
| 54 | ## Worklist
|
|---|
| 55 |
|
|---|
| 56 | - [x] report explicit imports on the import node
|
|---|
| 57 | - [x] support namespaces
|
|---|
| 58 | - [x] should bubble up through deep namespaces (#157)
|
|---|
| 59 | - [x] report explicit imports at reference time (at the identifier) similar to namespace
|
|---|
| 60 | - [x] mark module deprecated if file JSDoc has a @deprecated tag?
|
|---|
| 61 | - [ ] don't flag redeclaration of imported, deprecated names
|
|---|
| 62 | - [ ] flag destructuring
|
|---|