← Repo overview
/
vuejs/ vue
/
file
@9e88707
1 var emailRE = /^(([^<>()[\]\\.,;:\ s@\ "]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 2 3 // Setup Firebase 4 var config = { 5 apiKey: "AIzaSyAi_yuJciPXLFr_PYPeU3eTvtXf8jbJ8zw" , 6 authDomain: "vue-demo-537e6.firebaseapp.com" , 7 databaseURL: "https://vue-demo-537e6.firebaseio.com" 8 } 9 firebase. initializeApp( config) 10 11 var usersRef = firebase. database(). ref ( 'users' ) 12 13 // create Vue app 14 var app = new Vue ({ 15 // element to mount to 16 el: '#app' , 17 // initial data 18 data : { 19 newUser: { 20 name: '' , 21 email: '' 22 } 23 }, 24 // firebase binding 25 // https://github.com/vuejs/vuefire 26 firebase: { 27 users: usersRef 28 }, 29 // computed property for form validation state 30 computed: { 31 validation: function () { 32 return { 33 name: !! this . newUser. name. trim(), 34 email: emailRE. test( this . newUser. email) 35 } 36 }, 37 isValid: function () { 38 var validation = this . validation 39 return Object . keys( validation). every( function ( key) { 40 return validation[ key] 41 }) 42 } 43 }, 44 // methods 45 methods: { 46 addUser: function () { 47 if ( this . isValid) { 48 usersRef. push( this . newUser) 49 this . newUser. name = '' 50 this . newUser. email = '' 51 } 52 }, 53 removeUser: function ( user) { 54 usersRef. child( user[ '.key' ]). remove() 55 } 56 } 57 })
Code quality findings 5
Use let or const to avoid scope issues and hoisting
info
correctness
var-declaration
var emailRE = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Use let or const to avoid scope issues and hoisting
info
correctness
var-declaration
var config = {
Use let or const to avoid scope issues and hoisting
info
correctness
var-declaration
var usersRef = firebase.database().ref('users')
Use let or const to avoid scope issues and hoisting
info
correctness
var-declaration
var app = new Vue({
Use let or const to avoid scope issues and hoisting
info
correctness
var-declaration
var validation = this.validation
Security findings 1
Matches Google/GCP/Drive/Gmail/YouTube API keys
security
Google API Key
Get this view in your editor
Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.