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

eslint-plugin-dollar-sign

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-dollar-sign - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.travis.yml

0

index.js

@@ -0,0 +0,0 @@ /**

2

package.json
{
"name": "eslint-plugin-dollar-sign",
"version": "0.0.2",
"version": "0.0.3",
"description": "Enforce $varName for jQuery assignment.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,5 +0,18 @@

# eslint-plugin-dollar-sign
# eslint-plugin-dollar-sign [![Build Status](https://travis-ci.org/erikdesjardins/eslint-plugin-dollar-sign.svg?branch=master)](https://travis-ci.org/erikdesjardins/eslint-plugin-dollar-sign)
Enforce $varName for jQuery assignment.
An direct port of the `requireDollarBeforejQueryAssignment` rule from JSCS.
A direct port of the `requireDollarBeforejQueryAssignment` rule from JSCS.
`npm i --save-dev eslint-plugin-dollar-sign`
```json
{
"plugins": [
"dollar-sign"
],
"rules": {
"dollar-sign/dollar-sign": [2, "ignoreProperties"]
}
}
```

@@ -24,28 +24,15 @@ /**

var nextToken = sourceCode.getFirstToken(right.callee);
if (nextToken.value !== '$') {
if (right.callee.type !== 'Identifier' || right.callee.name !== '$') {
return;
}
nextToken = sourceCode.getTokenAfter(nextToken);
if (nextToken.value !== '(') {
return;
}
var identifier = sourceCode.getLastToken(left);
while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) {
nextToken = sourceCode.getTokenAfter(nextToken);
}
nextToken = sourceCode.getTokenAfter(nextToken);
if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) {
var identifier = sourceCode.getLastToken(left);
context.report({
node: identifier,
message: 'jQuery identifiers must start with a $',
fix: function(fixer) {
return fixer.insertTextBefore(identifier, '$');
}
});
}
context.report({
node: identifier,
message: 'jQuery identifiers must start with a $',
fix: function(fixer) {
return fixer.insertTextBefore(identifier, '$');
}
});
}

@@ -52,0 +39,0 @@

@@ -209,2 +209,13 @@ /**

},
// multiple var declarations
{
code: 'var bar, foo = $(".foo");',
output: 'var bar, $foo = $(".foo");',
errors: [{
message: errorMessage,
type: 'Identifier',
line: 1,
column: 10
}]
},

@@ -211,0 +222,0 @@ //// in object definition

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