Mobile/Fennec/Android/Lint/Eslint: Difference between revisions

< Mobile‎ | Fennec‎ | Android‎ | Lint
(Created page with "==Install== npm global install is the recommended way of getting eslint. On OS X: brew install npm npm -g install eslint ==Run== To run eslint, cd to `mobile/android` and...")
 
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Install==
==Install==
npm global install is the recommended way of getting eslint. On OS X:
Easiest way to install <code>eslint</code> is to use <code>mach</code>:
mach eslint --setup
 
You can manually install <code>eslint</code> using <code>npm</code> as well. For example, on OS X:


  brew install npm
  brew install npm
Line 6: Line 9:


==Run==
==Run==
To run eslint, cd to `mobile/android` and run eslint on all .js and .jsm files:
<code>eslint</code> should be run from mobile/android as it contains the base .eslintignore and .eslintrc files. If you run from another directory, <code>eslint</code> may not parse these files and the output may be unexpected. For example, from the repository root:
 
  mach eslint mobile/android
  # From mozilla-central
pushd mobile/android
eslint . --ext "[.js,.jsm]"
popd

Latest revision as of 14:52, 29 November 2015

Install

Easiest way to install eslint is to use mach:

mach eslint --setup

You can manually install eslint using npm as well. For example, on OS X:

brew install npm
npm -g install eslint

Run

eslint should be run from mobile/android as it contains the base .eslintignore and .eslintrc files. If you run from another directory, eslint may not parse these files and the output may be unexpected. For example, from the repository root:

mach eslint mobile/android