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

@hireupau/eslint-plugin-hu-vue

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hireupau/eslint-plugin-hu-vue - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

configs/index.js

2

index.js

@@ -1,2 +0,2 @@

const configs = require('./config');
const configs = require('./configs');
const rules = require('./rules');

@@ -3,0 +3,0 @@

{
"name": "@hireupau/eslint-plugin-hu-vue",
"version": "0.0.5",
"description": "Hireups vue eslint rules",
"version": "0.0.6",
"description": "Hireup's vue eslint rules",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -0,5 +1,7 @@

const sortComponentRegistrations = require('./sort-component-registrations');
const sortPropDefinitions = require('./sort-prop-definitions');
module.exports = {
'sort-component-registrations': sortComponentRegistrations,
'sort-prop-definitions': sortPropDefinitions,
};

@@ -14,11 +14,6 @@ /**

const propsAreSortedCorrectly = (props) => {
const propsAreSortedCorrectly = (obj) => {
const props = utils.getComponentProps(obj);
const propNames = utils.getPropNames(props);
const sortedPropNames = Array.from(propNames).sort((a, b) => a.localeCompare(b));
for(let i = 0; i < propNames.length; i++) {
if (propNames[i] !== sortedPropNames[i]) {
return false;
}
}
return true;
return utils.areStringsSortedAlphabetically(propNames);
};

@@ -34,12 +29,5 @@

return utils.executeOnVue(context, function(obj) {
const props = utils.getComponentProps(obj);
if (!propsAreSortedCorrectly(props)) {
const propsNode = obj.properties
.find(p =>
p.type === 'Property' &&
p.key.type === 'Identifier' &&
p.key.name === 'props' &&
(p.value.type === 'ObjectExpression' || p.value.type === 'ArrayExpression')
);
if (!propsAreSortedCorrectly(obj)) {
const propsNode = utils
.findNode(obj, 'props', ['ObjectExpression', 'ArrayExpression']);
context.report({

@@ -46,0 +34,0 @@ node: propsNode,

const vueUtils = require('eslint-plugin-vue/lib/utils');
const areStringsSortedAlphabetically = values => {
if (values && values.length) {
const sortedValues = Array.from(values)
.sort((a, b) => a.localeCompare(b));
for(let i = 0; i < values.length; i++) {
if (values[i] !== sortedValues[i]) {
return false;
}
}
}
return true;
};
const findNode = (node, name, type) => (
node.properties.find(p =>
p.type === 'Property' &&
p.key.type === 'Identifier' &&
p.key.name === name &&
((type.length && type.includes(p.value.type)) || p.value.type === type)
)
);
const getPropNames = props => (

@@ -13,3 +36,5 @@ props.map(

...vueUtils,
areStringsSortedAlphabetically,
findNode,
getPropNames,
};
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