Problems getting eslint to work with Atom

  • Install linter-eslint
  • I don’t like using a global .eslintrc as it is problematic if you are switching different types of JavaScript project. I find it best to use an .eslintrc file in each of your projects.
  • Remove if you have a global .eslintrc file

$ rm -rf ~/.eslintrc

If you get this error: (do the following)

eslint error

Add eslint as a dev dependency

$ npm i -D eslint

You will still see the error and if you follow the instructions and go to view > Developer > Toggle Developer Tools you will see you also need to install eslint-plugin-react

$ npm i -D eslint-plugin-react

And we also see that (from view > Developer > Toggle Developer Tools), we need to install babel-eslint

$ npm i -D babel-eslint

Close and open a JavaScript file and you should see eslint working

As an example, I am using an .eslintrc file in the root of my React/Meteor project

.eslintrc

{
  "env": {
    "browser": true,
    "node": true
  },
  "ecmaFeatures": {
    "jsx": true
  },
  "parser": "babel-eslint",
  "plugins": [
    "react"
  ],
  "rules": {
    "comma-spacing": 2,
    "key-spacing": 0,
    "no-underscore-dangle": 0,
    "no-unused-vars": [2, { "vars": "all", "args": "none" }],
    "no-var": 2,
    "object-shorthand": 2,
    "quotes": [2, "single", "avoid-escape"],
    "react/display-name": 0,
    "react/jsx-no-undef": 2,
    "react/jsx-uses-react": 2,
    "react/no-did-mount-set-state": 2,
    "react/no-did-update-set-state": 2,
    "react/no-multi-comp": 2,
    "react/prop-types": [2, { ignore: [children, className] }],
    "react/react-in-jsx-scope": 2,
    "react/self-closing-comp": 2,
    "react/wrap-multilines": 2,
    "react/jsx-uses-vars": 2,
    "strict": 0
  }
}

5 steps to installing WordPress with MAMP and WP-CLI

This will grab all the current WordPress files from the github WordPress repo, extract them and put them inside your site project folder. This is a huge time saver as it can install WordPress in seconds (with a fast internet connection)

Step One – Create Your WordPress Project folder

Inside your MAMP server root (I like to set my MAMP server root to be ~/Sites) create a folder that will hold your WordPress project.

$ mkdir ~/Sites/my-wordpress-project

Step Two – Pull down latest WordPress copy

$ wp core download

So now you are ready to create your wp-config.php file

Step Three – Create wp-config.php file

$ wp core config --dbuser=root --dbpass=root --dbname=my_wordpress_project

This will create the file to connect you to your MySQL databse. The above code is assuming you used MAMP and the default username and password for MAMP is root and root. Change the --dbname value to match your database name. I recommend using snake case to name your database this_is_snake_case

important Make sure you remember this is the name of your database. It needs to exactly match your database name that you will create in the next step.

Step Four – Create your empty database

Open phpMyAdmin and create a database making sure your database matches the name you used in the previous step (In my example I used my_wordpress_project so I would created a database with that name. Substitute your database name for my database name)

Step Five – Populate your database

With the default WordPress tables and content

$  wp core install --url=http://localhost/my-wordpress-project --title=MyWordPressProject --admin_user=admin --admin_password=password --admin_email=myemail@gmail.com

important – Many people make mistakes at this point. This is what to watch out for to ensure you don’t make the same mistakes

  • Make sure your port is correct
    • Did you use an Apache port of 8888 (default MAMP port) or did you change your MAMP port to be 80? If you used 8888 as your port your wp-cli command should be:
wp core install --url=http://localhost:8888/my-wordpress-project --title=MyWordPressProject --admin_user=admin --admin_password=password --admin_email=myemail@gmail.com
  • Is the email correct? That email should be an email that you can use because this email is the admin email of the site and any problems (like getting locked out of WordPress) get resets sent to this email

  • Is the URL correct? What is the name of your folder your project is in? Does it match the URL in your wp-cli command --url=http://localhost:8888/my-wordpress-project? If it doesn’t your site won’t work and you’ll have to redo everything from the start or do a find and replace in the exported SQL form your database.

  • If you get a can’t connect to database use which php and which mysql in your terminal to find out if your MAC OS knows about the MAMP php and MAMP mysql. If you don’t see MAMP in what is returned from these commands, your path needs to be updated with something like this in your ~/.bash_profile

~/.bash_profile

# The following MAMP export stuff is needed when you work with WP-CLI
# Use MAMP version of PHP
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
# MAMP and MYSQL
export PATH="/Applications/MAMP/Library/bin:$PATH"

Update your ~/.bash_profile with $ source ~/.bash_profile and you now should see the MAMP string somewhere in the output from $ which php and $ which mysql

Make sure you turn debugging on

This will help you track down errors in WordPress. By default all error notices are turned off in WordPress so if problems arise you will only see a white screen commonly referred to as the white screen of death. Turning this option on in wp-config.php will prevent the white screen of death from ruining your day.

wp-config.php

// Set to false when in Production
define( 'WP_DEBUG', true );

Happy coding!

How to transfer a domain name to a new domain host

I had a domain at network solutions. I wanted to have all my domains under one umbrella just to keep myself organized. So I wanted to transfer my domain from network solutions to Namecheap. It is not a straightforward process as you just can’t push a button and the domain is transferred. You need to follow a someone intricate, somewhat pain in the #)@# process.

Luckily hosts want your business so the good ones put up detailed instructions on how to transfer a domain to them. Here’s one such link transferring from network solutions to namecheap.

Essentially, they all follow the same steps. You go to the site that has your domain currently, and you request a transfer. You wait 2-3 days until you get an email from that company and then take their authorization code and use in on the new company. There are a few extra steps in the middle but you catch my drift.

In my example, I logged into Network Solutions found my domain and clicked Turn Off or Request Authorization Code and clicked Save. I had to wait about a week until Network solutions sent me an email (slower than the usual 2-3 days). Then when I had my Authorization Code (in my email), I logged back into Network solutions, browsed to my domain name and clicked Turn Private Registration off (You will see it turn from Private to Public).

You then need to check the whois information for your domain to make sure the information is correct. Please pay specific attention to the Administrative email address, as the Transfer Verification email you will need to approve the transfer will be sent to this address. It is public now so you want to make this change and switch it back to private when you move to your new domain host. Otherwise, people will have access to your address, email, and phone.

Edit WHOIS is hard to see on Network Solutions.

Look for this:

Edit WHOIS

Then you login to the domain hosting company you want to use, browse to their domains > transfer section (they should have documentation online showing you how to do this… if they don’t don’t use them). Then they’ll ask for your Authorization code (in my case the one Network Solutions emailed me) and then they’ll ask for the payment to transfer the domain and sign up with the new domain host. Namecheap charged me $9.69.

Had a slight usability problem with Namecheap.

bad interface

note It took me 4 times to figure out why I wasn’t getting to pay for my domain transfer. The reason is the gray bottom shopping cart needs to be clicked first. I saw the bright orange View Cart button and just kept clicking that first.

You then will get an email (usually within the hour) from your new host. There will be a link in that email you must click to accept them as your new domain host (aka the registrar of record).

And that’s it. You just transferred your domain.