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

eslint-plugin-shopify

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-shopify - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

lib/rules/binary-assignment-parens.js

2

index.js
module.exports = {
rules: {
'require-flow': require('./lib/rules/require-flow'),
'binary-assignment-parens': require('./lib/rules/binary-assignment-parens'),
},

@@ -8,3 +9,4 @@

'require-flow': 0,
'binary-assignment-parens': 0,
},
};
var ALWAYS_MESSAGE = 'You must include a @flow declaration at the top of your file.';
var NEVER_MESSAGE = 'You must not include a @flow declaration in your file.';
var EXPLICIT_MESSAGE = 'You must include a @flow or @noflow declaration at the top of your file.';
var FLOW_REGEX = /@flow/;
var EXPLICIT_FLOW_REGEX = /@(no)?flow/;
function commentIsFlowDirective(comment, regex) {
return Boolean(comment) && comment.type === 'Block' && comment.start === 0 && regex.test(comment.value);
}
module.exports = function(context) {

@@ -11,6 +17,7 @@ var config = context.options[0] || 'always';

var commentNode = node.comments && node.comments[0];
var isFlowDirective = commentIsFlowDirective(commentNode, config === 'explicit' ? EXPLICIT_FLOW_REGEX : FLOW_REGEX);
switch (config) {
case 'always':
if (!commentNode || !FLOW_REGEX.test(commentNode.value)) {
if (!isFlowDirective) {
context.report(node, ALWAYS_MESSAGE);

@@ -20,4 +27,10 @@ }

case 'explicit':
if (!isFlowDirective) {
context.report(node, EXPLICIT_MESSAGE);
}
break;
case 'never':
if (commentNode && FLOW_REGEX.test(commentNode.value)) {
if (isFlowDirective) {
context.report(node, NEVER_MESSAGE);

@@ -32,3 +45,3 @@ }

module.exports.schema = [{
enum: ['always', 'never'],
enum: ['always', 'explicit', 'never'],
}];

21

package.json
{
"name": "eslint-plugin-shopify",
"version": "1.0.2",
"version": "1.0.3",
"description": "Shopify-specific ESLint rules.",
"repository": {
"type": "git",
"url": "https://github.com/shopify/eslint-plugin-shopify"
},
"keywords": [

@@ -16,5 +12,5 @@ "eslint",

"scripts": {
"lint": "node_modules/.bin/eslint .",
"test:unit": "istanbul cover --dir reports/coverage node_modules/.bin/_mocha tests/**/*.js -- --reporter dot",
"test": "npm run lint && npm run test:unit"
"lint": "node_modules/.bin/eslint . --max-warnings 0",
"test:cover": "istanbul cover --dir reports/coverage node_modules/.bin/_mocha tests/ --recursive -- --reporter dot",
"test": "mocha tests/ --recursive"
},

@@ -29,9 +25,10 @@ "files": [

"bugs": {
"url": "https://github.com/shopify/eslint-plugin-shopify/issues"
"url": "https://github.com/Shopify/javascript/issues"
},
"homepage": "https://github.com/shopify/eslint-plugin-shopify",
"homepage": "https://github.com/Shopify/javascript/tree/master/packages/eslint-plugin-shopify",
"repository": "https://github.com/Shopify/javascript/tree/master/packages/eslint-plugin-shopify",
"devDependencies": {
"babel-eslint": "^4.1.3",
"eslint": "^1.5.0",
"eslint-config-shopify": "*",
"eslint-config-shopify": "^1.0.0",
"eslint-plugin-shopify": "file:.",
"istanbul": "^0.3.20",

@@ -38,0 +35,0 @@ "mocha": "^2.3.2"

@@ -11,2 +11,3 @@ # eslint-plugin-shopify

```

@@ -50,2 +51,3 @@ $ npm i eslint --save-dev

- [require-flow](docs/rules/require-flow.md): Requires (or disallows) @flow declarations be present at the top of each file.
- [binary-assignment-parens](docs/rules/binary-assignment-parens.md): Requires (or disallows) assignments of binary, boolean-producing expressions to be wrapped in parentheses.

@@ -56,16 +58,2 @@ ## Contributing

## Changelog
### 1.0.2 - September 21, 2015
Fixed issue with recursive references in the lint config.
### 1.0.1 - September 21, 2015
Fixed package URLs.
### 1.0.0 - September 21, 2015
- Initial commit.
[npm-url]: https://npmjs.org/package/eslint-plugin-shopify

@@ -72,0 +60,0 @@ [npm-image]: http://img.shields.io/npm/v/eslint-plugin-shopify.svg?style=flat-square

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