-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
496 additions
and
97 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Rules in progress. | ||
* | ||
* Do not expect these to adhere to semver across releases. | ||
* @type {Object} | ||
*/ | ||
module.exports = { | ||
plugins: ['import'], | ||
rules: { | ||
'import/no-deprecated': 1, | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# no-deprecated | ||
|
||
**Stage: 0** | ||
|
||
**NOTE**: this rule is currently a work in progress. There may be "breaking" changes: most likely, additional cases that are flagged. | ||
|
||
Reports use of a deprecated name, as indicated by a JSDoc block with a `@deprecated` | ||
tag, i.e. | ||
|
||
```js | ||
// @file: ./answer.js | ||
|
||
/** | ||
* this is what you get when you trust a mouse talk show | ||
* @deprecated need to restart the experiment | ||
* @returns {Number} nonsense | ||
*/ | ||
export function multiply(six, nine) { | ||
return 42 | ||
} | ||
``` | ||
|
||
will report as such: | ||
|
||
```js | ||
import { multiply } from './answer' // Deprecated: need to restart the experiment | ||
|
||
function whatever(y, z) { | ||
return multiply(y, z) // Deprecated: need to restart the experiment | ||
} | ||
``` | ||
|
||
### Worklist | ||
|
||
- [x] report explicit imports on the import node | ||
- [ ] support namespaces | ||
- [ ] should bubble up through deep namespaces (#157) | ||
- [x] report explicit imports at reference time (at the identifier) similar to namespace | ||
- [x] mark module deprecated if file JSDoc has a @deprecated tag? | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function declaredScope(context, name) { | ||
let references = context.getScope().references | ||
, i | ||
for (i = 0; i < references.length; i++) { | ||
if (references[i].identifier.name === name) { | ||
break | ||
} | ||
} | ||
if (!references[i]) return undefined | ||
return references[i].resolved.scope.type | ||
} |
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
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
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
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
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
Oops, something went wrong.