eslint-plugin-prefer-let
Advanced tools
Comparing version 1.0.1 to 1.0.2-447f893
@@ -25,3 +25,3 @@ /** | ||
create: function(context) { | ||
// variables should be defined here | ||
let sourceCode = context.getSourceCode(); | ||
@@ -60,5 +60,10 @@ //---------------------------------------------------------------------- | ||
} else if (node.kind !== 'let' && !isTopLevelScope(node)) { | ||
let constToken = sourceCode.getFirstToken(node); | ||
context.report({ | ||
message: '`const` declaration outside top-level scope', | ||
node | ||
node, | ||
fix: function(fixer) { | ||
return fixer.replaceText(constToken, 'let'); | ||
} | ||
}); | ||
@@ -65,0 +70,0 @@ } |
{ | ||
"name": "eslint-plugin-prefer-let", | ||
"version": "1.0.1", | ||
"version": "1.0.2-447f893", | ||
"description": "Rule to prefer using `let` to bind names to values", | ||
@@ -10,4 +10,2 @@ "keywords": [ | ||
], | ||
"author": "Charles Lowell", | ||
"homepage": "https://github.com/cowboyd/eslint-plugin-prefer-let", | ||
"main": "lib/index.js", | ||
@@ -14,0 +12,0 @@ "scripts": { |
# eslint-plugin-prefer-let | ||
[![Build Status](https://travis-ci.org/cowboyd/eslint-plugin-prefer-let.svg?branch=master)](https://travis-ci.org/cowboyd/eslint-plugin-prefer-let) | ||
An eslint plugin to encourage semantic of usage of `let` and `const`. | ||
@@ -86,1 +84,14 @@ | ||
``` | ||
### Possible Conflicts | ||
This plugin may conflict with other plugins or configs that set `eslint prefer-const`. You can configure the rules to avoid this: | ||
```json | ||
{ | ||
"rules": { | ||
"prefer-let/prefer-let": 2, | ||
"prefer-const": "off" | ||
} | ||
} | ||
``` |
@@ -54,2 +54,3 @@ /** | ||
code: "function y() { const x = 'y'; return x; }", | ||
output: "function y() { let x = 'y'; return x; }", | ||
errors: [{ | ||
@@ -62,2 +63,3 @@ message: "`const` declaration outside top-level scope", | ||
code: "function y() { const {x, y} = {x: 'x', y: 'y'}}", | ||
output: "function y() { let {x, y} = {x: 'x', y: 'y'}}", | ||
errors: [{ | ||
@@ -97,2 +99,3 @@ message: "`const` declaration outside top-level scope", | ||
code: "function y() { const x = 'y'; return x; }", | ||
output: "function y() { let x = 'y'; return x; }", | ||
errors: [{ | ||
@@ -99,0 +102,0 @@ message: "`const` declaration outside top-level scope", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
eslint-plugin-prettier |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8363
170
97
0
6
2
2
1