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

eslint-plugin-vue-2-object-reactivity

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-vue-2-object-reactivity - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

dist/index.js

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

var f=require("@typescript-eslint/experimental-utils"),e=require("eslint-etc"),p=require("typescript"),l=s=>process.env.DEBUG&&console.log(s),E=f.ESLintUtils.RuleCreator(()=>"https://github.com/Maxim-Mazurok/eslint-plugin-vue-2-object-reactivity")({name:"require-vue-set",meta:{type:"problem",docs:{description:"Require `Vue.set()` for object changes",category:"Possible Errors",recommended:"error"},messages:{useVueSet:"Use `Vue.set()` for changing objects in state"},schema:[]},defaultOptions:[],create:s=>{let{esTreeNodeToTSNodeMap:b,tsNodeToESTreeNodeMap:h}=f.ESLintUtils.getParserServices(s),S=(r,n)=>{(0,p.isObjectLiteralExpression)(r)&&r.properties.map(a=>{if((0,p.isMethodDeclaration)(a)&&(l(`Mutation name: ${a.name.getText()}`),a.parameters.length>=1)){let u=a.parameters[0].name.getText();l(`State parameter name: ${u}`);let g=a.body;if(g!==void 0){let V=s.getScope(),v=h.get(g),d=V.childScopes.find(i=>(0,e.isFunctionExpression)(i.block)&&i.block.body===v);if(d!==void 0){let i=d.variables.find(T=>T.name===u);i!==void 0&&d.references.filter(m=>m.resolved===i).find(m=>{let c=m.identifier.parent;if(c!==void 0&&(0,e.isMemberExpression)(c)){let o=c.parent;o!==void 0&&(0,e.isCallExpression)(o)&&(0,e.isMemberExpression)(o.callee)&&(0,e.isIdentifier)(o.callee.object)&&(0,e.isIdentifier)(o.callee.property)&&(o.callee.object.name==="Vue"&&o.callee.property.name,l("Yay, Vue.set(state) found!"));let t=c;do{if(t.parent===void 0)break;t=t.parent}while(t!==null&&!(0,e.isAssignmentExpression)(t));t!==null&&(0,e.isAssignmentExpression)(t)&&(0,e.isMemberExpression)(t.left)&&(0,e.isMemberExpression)(t.left.object)&&(0,e.isIdentifier)(t.left.object.object)&&t.left.object.object.name===u&&(l("Oh-oh, state.object.something = ... found!"),s.report({node:n,messageId:"useVueSet"}))}})}}}})};function y(r){let n=b.get(r.value);S(n,r)}function j(r){let n=b.get(r.init);S(n,r)}return{'Property[key.name="mutations"][value.type="ObjectExpression"][value.properties.length!=0]':y,"VariableDeclaration > [id.name=mutations]":j}}});module.exports={rules:{"require-vue-set":E}};
var m=require("@typescript-eslint/experimental-utils"),e=require("eslint-etc"),p=require("typescript"),s=(...n)=>process.env.DEBUG&&console.log(...n),E=m.ESLintUtils.RuleCreator(()=>"https://github.com/Maxim-Mazurok/eslint-plugin-vue-2-object-reactivity")({name:"require-vue-set",meta:{type:"problem",docs:{description:"Require `Vue.set()` for object changes",category:"Possible Errors",recommended:"error"},messages:{useVueSet:"Use `Vue.set()` for changing objects in state"},schema:[]},defaultOptions:[],create:n=>{let{esTreeNodeToTSNodeMap:f,tsNodeToESTreeNodeMap:h}=m.ESLintUtils.getParserServices(n),S=(t,a)=>{(0,p.isObjectLiteralExpression)(t)&&t.properties.map(i=>{if((0,p.isMethodDeclaration)(i)&&(s(`Mutation name: ${i.name.getText()}`),i.parameters.length>=1)){let b=i.parameters[0].name.getText();s(`State parameter name: ${b}`);let g=i.body;if(g!==void 0){let v=n.getScope(),k=h.get(g),u=v.childScopes.find(c=>(0,e.isFunctionExpression)(c.block)&&c.block.body===k);if(u!==void 0){let c=u.variables.find(T=>T.name===b);c!==void 0&&u.references.filter(d=>d.resolved===c).forEach(d=>{let l=d.identifier.parent;if(l!==void 0&&(0,e.isMemberExpression)(l)){let o=l.parent;if(o!==void 0&&(0,e.isCallExpression)(o)&&(0,e.isMemberExpression)(o.callee)&&(0,e.isIdentifier)(o.callee.object)&&(0,e.isIdentifier)(o.callee.property)){o.callee.object.name==="Vue"&&o.callee.property.name,s("Yay, Vue.set(state) found!");return}else s("Vue.set not found...");let r=l;do{if(r.parent===void 0)break;r=r.parent,s({assignmentExpression:r})}while(r!==null&&(0,e.isMemberExpression)(r)&&!(0,e.isAssignmentExpression)(r));s("Oh-oh, state.object.something = ... found!"),n.report({node:a,loc:{start:l.loc.start,end:r.loc.end},messageId:"useVueSet"})}})}}}})};function y(t){let a=f.get(t.value);S(a,t)}function V(t){let a=f.get(t.init);S(a,t)}return{'Property[key.name="mutations"][value.type="ObjectExpression"][value.properties.length!=0]':y,"VariableDeclaration > [id.name=mutations]":V}}});module.exports={rules:{"require-vue-set":E}};
{
"name": "eslint-plugin-vue-2-object-reactivity",
"version": "1.1.0",
"version": "1.2.0",
"description": "These rules aim to solve the problem with Vue 2 Object Reactivity",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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