Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/eslint-plugin

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/eslint-plugin - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

lib/no-untyped-underscore.d.ts

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "0.2.0",
"tag": "@rushstack/eslint-plugin_v0.2.0",
"date": "Thu, 09 Jan 2020 06:44:12 GMT",
"comments": {
"minor": [
{
"comment": "Add new rule `@rushstack/no-untyped-underscore`"
}
]
}
},
{
"version": "0.1.0",

@@ -7,0 +19,0 @@ "tag": "@rushstack/eslint-plugin_v0.1.0",

9

CHANGELOG.md
# Change Log - @rushstack/eslint-plugin
This log was last generated on Wed, 08 Jan 2020 00:11:31 GMT and should not be manually modified.
This log was last generated on Thu, 09 Jan 2020 06:44:12 GMT and should not be manually modified.
## 0.2.0
Thu, 09 Jan 2020 06:44:12 GMT
### Minor changes
- Add new rule `@rushstack/no-untyped-underscore`
## 0.1.0

@@ -6,0 +13,0 @@ Wed, 08 Jan 2020 00:11:31 GMT

4

lib/index.js

@@ -5,6 +5,8 @@ "use strict";

const no_null_1 = require("./no-null");
const no_untyped_underscore_1 = require("./no-untyped-underscore");
const plugin = {
rules: {
// NOTE: The actual ESLint rule name will be "@rushstack/no-null".
'no-null': no_null_1.noNullRule
'no-null': no_null_1.noNullRule,
'no-untyped-underscore': no_untyped_underscore_1.noUntypedUnderscoreRule
}

@@ -11,0 +13,0 @@ };

@@ -13,6 +13,6 @@ "use strict";

docs: {
description: 'Prevents usage of JavaScript\'s "null" keyword.',
description: 'Prevent usage of JavaScript\'s "null" keyword',
category: 'Stylistic Issues',
recommended: "error",
url: 'https://www.npmjs.com/package/@rushstack/eslint-config'
url: 'https://www.npmjs.com/package/@rushstack/eslint-plugin'
}

@@ -24,3 +24,3 @@ },

// Is it a "null" literal?
if (node.type === 'Literal' && node.value === null) {
if (node.value === null) {
// Does the "null" appear in a comparison such as "if (x === null)"?

@@ -27,0 +27,0 @@ let isComparison = false;

{
"name": "@rushstack/eslint-plugin",
"version": "0.1.0",
"version": "0.2.0",
"description": "An ESLint plugin providing supplementary rules for use with the @rushstack/eslint-config package",

@@ -5,0 +5,0 @@ "repository": {

@@ -10,5 +10,5 @@ # @rushstack/eslint-plugin

Prevents usage of JavaScript's `null` keyword.
Prevent usage of JavaScript's `null` keyword.
### Rule Details
#### Rule Details

@@ -29,3 +29,3 @@ Most programming languages have a "null" or "nil" value that serves several purposes:

### Examples
#### Examples

@@ -53,1 +53,47 @@ The following patterns are considered problems when `@rushstack/no-null` is enabled:

```
## `@rushstack/no-untyped-underscore` (Opt-in)
Prevent TypeScript code from accessing legacy JavaScript members whose name has an underscore prefix.
#### Rule Details
JavaScript does not provide a straightforward way to restrict access to object members, so API names commonly
indicate a private member by using an underscore prefix (e.g. `exampleObject._privateMember`). For inexperienced
developers who may be unfamiliar with this convention, in TypeScript we can mark the APIs as `private` or omit them
from the typings. However, when migrating a large code base to TypeScript, it may be difficult to declare types
for every legacy API. In this situation, the `@rushstack/no-untyped-underscore` rule can help.
This rule detects expressions that access a member with an underscore prefix, EXCEPT in cases where:
- The object is typed: specifically, `exampleObject` has a TypeScript type that declares `_privateMember`; OR
- The object expression uses: the `this` or `super` keywords; OR
- The object expression is a variable named `that`. (In older ES5 code, `that` was commonly used as an alias
for `this` in unbound contexts.)
#### Examples
The following patterns are considered problems when `@rushstack/no-untyped-underscore` is enabled:
```ts
let x: any;
x._privateMember = 123; // error, because x is untyped
let x: { [key: string]: number };
x._privateMember = 123; // error, because _privateMember is not a declared member of x's type
```
The following patterns are NOT considered problems:
```ts
let x: { _privateMember: any };
x._privateMember = 123; // okay, because _privateMember is declared by x's type
let x = { _privateMember: 0 };
x._privateMember = 123; // okay, because _privateMember is part of the inferred type
enum E {
_PrivateMember
}
let e: E._PrivateMember = E._PrivateMember; // okay, because _PrivateMember is declared by E
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc